π½οΈ AI-powered recipe generation app that creates personalized recipes from photos of ingredients using Google Gemini AI.
- π· Smart Ingredient Recognition: Take photos of ingredients and get AI-powered identification
- π€ AI Recipe Generation: Generate 5 personalized recipes instantly
- π Detailed Recipes: Complete recipes with ingredients, instructions, cooking time, and difficulty
- π Recipe Refresh: Generate new recipes using the same ingredients
- π± Cross-Platform: React Native app for iOS and Android
- β‘ Fast API: Optimized FastAPI backend with Google Gemini integration
This is a full-stack application with two main components:
- React Native with Expo
- TypeScript for type safety
- Expo Camera for photo capture
- Native mobile app for iOS and Android
- FastAPI Python web framework
- Google Gemini AI for vision and text generation
- Pydantic for data validation
- RESTful API with automatic documentation
- Node.js 16+
- Python 3.11+
- Google API key (Get one here)
- iOS Simulator or Android Emulator (for mobile development)
cd core
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env and add your GOOGLE_API_KEY
# Run backend server
python run.pyThe API will be available at http://localhost:8000
cd client
# Install dependencies
npm install
# Start development server
npx expo start
# Run on iOS/Android
npx expo run:ios
npx expo run:androidGET http://localhost:8000/healthPOST http://localhost:8000/api/generate-recipes-json
Content-Type: application/json
{
"image": "base64_encoded_image_data",
"exclude_recipe_ids": ["recipe_1"]
}Response:
{
"recipes": [
{
"id": "recipe_1",
"title": "Sesame Ginger Tofu Stir-Fry",
"summary": "Quick and savory stir-fry...",
"ingredients": ["14 oz tofu", "8 oz mushrooms"],
"instructions": ["Heat oil", "Add ingredients"],
"cookingTime": 20,
"servings": 2,
"difficulty": "Easy",
"tags": ["Asian", "Quick"]
}
],
"identifiedIngredients": ["tofu", "mushrooms"]
}Edit /core/.env:
GOOGLE_API_KEY=your_google_api_key_here
LLM_MODEL=gemini-3-flash-preview
API_HOST=0.0.0.0
API_PORT=8000
DEBUG=True
ALLOWED_ORIGINS=http://localhost:3000,exp://192.168.1.100:8081Edit /client/services/config.ts:
export const apiConfig = {
baseURL: 'http://localhost:8000', // Backend URL
timeout: 120000, // 2 minutes for image processing
};- Built-in camera interface
- Gallery photo selection
- Automatic image optimization
- Base64 encoding for API transmission
- Grid layout with recipe cards
- Detailed recipe views with ingredients and instructions
- Cooking time, servings, and difficulty indicators
- Tag-based categorization
- File-based routing with Expo Router
- Smooth transitions between screens
- Back button and navigation controls
- Gemini Vision API for image analysis
- Confidence scoring for ingredient recognition
- Filtering of non-food items
- Specific ingredient naming (e.g., "cremini mushrooms" not "mushrooms")
- Exactly 5 recipes per request
- Difficulty variety (2 Easy, 2 Medium, 1 Hard)
- Diverse cuisines (Italian, Asian, American, etc.)
- Complete recipes with measured ingredients
- Step-by-step cooking instructions
- Optimized prompts for token efficiency
- Structured JSON outputs
- Example-driven responses
- Error handling with fallback recipes
- Clean, modern interface
- Consistent typography and spacing
- Platform-specific styling (iOS/Android)
- Responsive layouts for different screen sizes
- Intuitive camera-first workflow
- Loading states with progress indicators
- Error handling with helpful messages
- Smooth animations and transitions
- Input validation with Pydantic
- CORS configuration for mobile apps
- Environment variable management
- Error sanitization
- No recipe data storage
- Temporary image processing
- No user tracking
- API key protection
- ~30% token reduction in AI prompts
- Base64 image encoding for mobile compatibility
- Efficient JSON API design
- Optimized image processing (RGBAβRGB conversion)
- Ingredient identification: ~2-5 seconds
- Recipe generation: ~5-15 seconds
- Total processing: ~10-20 seconds
- API timeout: 120 seconds
cd core
# Health check
curl http://localhost:8000/health
# API documentation
open http://localhost:8000/docs- Test on iOS Simulator and Android Emulator
- Real device testing for camera functionality
- Network connectivity testing
- Error scenario testing
- Docker containerization support
- Gunicorn for production WSGI
- Environment-specific configuration
- Health monitoring endpoints
- Expo EAS Build for app stores
- Over-the-air updates
- Platform-specific builds
- Development and production variants
- Frontend:
/client/README.md- React Native app documentation - Backend:
/core/README.md- FastAPI server documentation - API Docs:
http://localhost:8000/docs- Interactive API documentation
"Model not found" Error
- Check Google API key in
/core/.env - Verify model name:
gemini-3-flash-preview - Ensure API key has Gemini access
Camera Not Working
- Check device permissions for camera access
- Test on physical device (camera doesn't work in all simulators)
- Verify Expo Camera installation
API Connection Failed
- Ensure backend is running on
localhost:8000 - Check CORS configuration for mobile app URLs
- Verify network connectivity
Image Processing Errors
- Check image format (JPEG, PNG supported)
- Verify image size (under 10MB)
- Test with different images
- User accounts and recipe saving
- Recipe sharing and social features
- Dietary restrictions and preferences
- Nutritional information
- Shopping list generation
- Recipe rating and reviews
- Offline recipe storage
- Multi-language support
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Google Gemini AI for vision and text generation capabilities
- Expo for React Native development tools
- FastAPI for the excellent Python web framework
- React Native community for mobile development resources
Built with β€οΈ using React Native, FastAPI, and Google Gemini AI