An intelligent recipe recommendation system that suggests personalized recipes based on the ingredients you have. Built with a modern tech stack including FastAPI, React, and Google's Gemini AI for smart features.
- Smart Ingredient Matching: Find recipes based on ingredients you have.
- AI-Powered Image Analysis: Upload a photo of your ingredients, and let the AI identify them for you.
- Dietary Preferences: Filter by vegetarian, vegan, gluten-free, and more.
- Personalization: Save favorites, rate recipes, and get recommendations.
- Serving Adjustments: Dynamically adjust ingredient quantities for any number of servings.
- Responsive Design: Works seamlessly on desktop and mobile devices.
The application is live and ready to use:
- Frontend Application: Chef's Cam on Vercel
- Backend API Docs: The backend is hosted on Render. You can access the interactive API documentation at
https://<your-backend-render-url>/docs.
Frontend
- React 18 with TypeScript
- Vite for fast development builds
- Tailwind CSS for styling
- Lucide React for icons
- Context API for state management
Backend
- FastAPI with Python
- SQLite with SQLAlchemy ORM
- JWT authentication
- Google Gemini AI for image analysis
- Scikit-learn for TF-IDF matching
- Pillow for image processing
Deployment
- Vercel for frontend hosting
- Render for backend API
- Environment-based configuration
smart-recipe-generator/
├── frontend/
│ ├── src/
│ │ ├── components/ # Reusable React UI components (buttons, cards, etc.)
│ │ ├── pages/ # Main pages of the application (Home, RecipeDetails, etc.)
│ │ ├── context/ # React Context for global state management (e.g., auth)
│ │ ├── lib/ # Utility functions, including the API client
│ │ └── types/ # TypeScript type definitions for the project
│ └── package.json
├── backend/
│ ├── dataset/ # Recipe data and images
│ ├── models.py # SQLAlchemy ORM models for database tables (User, Recipe, etc.)
│ ├── schemas.py # Pydantic schemas for data validation and serialization (API request/response shapes)
│ ├── services.py # Core business logic (searching, recommendations, database operations)
│ ├── auth.py # JWT-based authentication logic (user registration, login, token verification)
│ ├── database.py # SQLAlchemy database connection and session management
│ ├── main.py # FastAPI application entrypoint, defines all API endpoints
│ └── requirements.txt
└── start-app.bat # Development startup script
- Node.js 16+ and npm
- Python 3.8+
- Google Gemini API key
cd backend
python -m venv venv
# Windows: venv\Scripts\activate
source venv/bin/activate
pip install -r requirements.txtCreate .env file:
DATABASE_URL=sqlite:///./recipes.db
SECRET_KEY=your-jwt-secret-key
GEMINI_API_KEY=your-gemini-api-key
FRONTEND_URL=http://localhost:5173Start backend:
python main.pycd frontend
npm install
npm run devAccess the application:
- Frontend:
http://localhost:5173 - API Docs:
http://localhost:8000/docs
Run start-app.bat from the project root to start both servers automatically.
-
Ingredient Matching Algorithm
- TF-IDF vectorization converts ingredients to numerical features.
- Cosine similarity ranks recipes by match score with intelligent filtering.
-
AI Enhancement Pipeline
- Gemini AI automatically enhances recipes missing nutritional data.
- Generates cooking times, difficulty levels, and dietary tags.
- Implements rate limiting to optimize API usage.
-
Smart Caching
- Caches search results to improve performance.
- Reduces redundant API calls.
- Automatic cache invalidation strategies.
-
Image Analysis
- Uses Gemini Vision API to analyze food images.
- Extracts ingredients automatically with confidence scores.
Authentication
POST /auth/register- User registrationPOST /auth/login- User loginGET /auth/me- Get current userDELETE /auth/delete- Delete account
Recipes
POST /recipes/search- Search by ingredientsGET /recipes- Get all recipes with filteringGET /recipes/{id}- Get specific recipePOST /recipes/{id}/favorite- Toggle favoritePOST /recipes/{id}/rate- Rate recipe (1-5 stars)
User Features
GET /favorites- Get user's favorite recipesGET /recommendations- Get personalized recommendationsGET /popular- Get popular recipes
Analysis
POST /analyze/image- Analyze image for ingredients
Users (id, email, hashed_password, full_name, created_at)
Recipes (id, title, description, image_url, difficulty, cooking_time, servings, cuisine, calories, protein, carbs, fat, instructions, dietary_tags, average_rating, rating_count, created_at)
Ingredients (id, name, amount, unit)
Favorites (id, user_id, recipe_id, created_at)
Ratings (id, user_id, recipe_id, rating, created_at)
Includes 25+ curated recipes with:
- Diverse cuisines: Italian, Asian, Mexican, Indian, etc.
- Multiple dietary options: Vegetarian, Vegan, Gluten-Free
- Complete nutritional information
- High-quality food images
- JWT-based authentication
- Password hashing with PBKDF2
- CORS configuration for secure cross-origin requests
- Input validation with Pydantic schemas
- SQL injection prevention with SQLAlchemy
Frontend (Vercel)
- Connect GitHub repository to Vercel
- Set environment variable:
VITE_API_URL=https://your-backend-url.render.com - Deploy automatically on git push
Backend (Render)
- Connect GitHub repository to Render
- Build command:
pip install -r requirements.txt - Start command:
uvicorn main:app --host 0.0.0.0 --port $PORT - Configure environment variables
- Fork the repository
- Create a 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 recipe enhancement
- FastAPI for excellent API framework
- Vercel and Render for hosting services
- Pexels for food photography
For support, open an issue on GitHub or contact the development team.
Built with ❤️ for food lovers and home cooks everywhere!