A food wastage reduction app that helps users transform leftover ingredients into delicious recipes.
Chaos Cooking empowers users to reduce food waste by discovering creative recipes using ingredients they already have, before they go bad. Perfect for students, busy professionals, and content creators who want to save money, reduce waste, and gamify their cooking experience.
- Recipe Discovery: Browse community-uploaded recipes designed to use up leftover ingredients
- Smart Ingredient Matching: Search recipes based on what you have in your fridge
- Upload Your Own Recipes: Share your leftover-rescue recipes with the community
- Duplicate Prevention: Smart validation ensures users don't accidentally upload the same recipe twice
- Recipe History Tracking: Track which recipes you've viewed, cooked, favorited, or rated
Our app is designed for:
- ๐ฉโ๐จ Content Creators (like Chloe) - Create aesthetic cooking content while reducing waste
- ๐ผ Busy Professionals (like Marcus) - Quick 15-minute meals using leftovers after long workdays
- ๐ Students (like Emma) - Budget-friendly recipes that save money and reduce dorm food waste
Our application follows a three-tier architecture ensuring clean separation of concerns:
๐ฏ How the UML Sequence Diagram Works ๐จ Presentation Layer (Frontend)
User clicks "Upload Recipe" button Recipe form displays input fields User fills in recipe details (title, description, instructions, ingredients) Form submits data to Business Logic Layer
This design choice makes sense because:
- Recipe sharing - Multiple users can contribute their unique takes on popular dishes
- Prevents accidents - Users won't accidentally duplicate their own submissions
- Community diversity - Encourages variety in the recipe database
- Data integrity - Maintains clean user-specific recipe collections
This separation means:
- Frontend developers can work independently from backend
- Business logic can be tested without UI or database
- Each layer can be updated without affecting others
- System is scalable and maintainable
- HTML5, CSS3, JavaScript, React, Node.js
- Responsive design for a we-based app MVP fit for demo day
- Python Flask - Lightweight web framework
- PostgreSQL - Relational database for recipes, ingredients, and user data
- psycopg2 - PostgreSQL adapter for Python
- Flask-CORS - Cross-Origin Resource Sharing support
- PostgreSQL 14+
- Pre-populated with sample recipes and ingredients
users
- Stores user account information (username, email, password_hash, name)
- Tracks account creation and updates
ingredients
- Library of common leftover ingredients categorized by type
- Includes nutritional information (calories per unit)
- Categories: leftover_protein, leftover_vegetable, leftover_fruit, leftover_starch, pantry
recipes
- User-created recipes with instructions, prep/cook time, and difficulty
- Each recipe linked to its creator via
created_byforeign key - Includes metadata like servings, prep time, cook time
recipe_ingredients (Junction Table)
- Links recipes to their required ingredients
- Stores quantity, unit, and optional notes for each ingredient
recipe_history
- Tracks user interactions with recipes
- Actions: 'viewed', 'cooked', 'favorited', 'rated'
- Enables popularity tracking and personalized recommendations
- User-Specific Duplicate Prevention: Users cannot upload multiple recipes with the same title
- Shared Recipe Library: Multiple users can save and interact with the same community recipes
- Cascade Deletion: Removing a recipe automatically removes its ingredient associations
Chaos_cooking_backend/
โโโ app.py # Main Flask application
โโโ db.py # Database connection configuration
โโโ .env # Environment variables (not in git)
โโโ requirements.txt # Python dependencies
โโโ routes/
โ โโโ recipes.py # Recipe-related endpoints
โ โโโ ingredients.py # Ingredient-related endpoints
โโโ Recipes_with_sample_data.sql # Database schema and sample data
โโโ README.md # This file
- Python 3.8+
- PostgreSQL 14+
- pip (Python package manager)
- Clone the repository
git clone <repository-url>
cd Chaos_cooking_backend- Set up Python virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Set up PostgreSQL database
# Create database
createdb chaos_cooking
# Run SQL script to create tables and insert sample data
psql -d chaos_cooking -f Recipes_with_sample_data.sql- Configure environment variables
Create a .env file in the root directory:
DB_USER=your_postgres_username
DB_HOST=localhost
DB_NAME=chaos_cooking
DB_PASSWORD=your_postgres_password
DB_PORT=5432
PORT=5000- Run the application
python app.pyThe server will start on http://localhost:5000
Visit these endpoints in your browser:
http://localhost:5000/- Health checkhttp://localhost:5000/api/recipes- Get all recipeshttp://localhost:5000/api/ingredients- Get all ingredients
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/recipes |
Get all recipes |
| GET | /api/recipes/<id> |
Get single recipe with ingredients |
| POST | /api/recipes |
Upload new recipe (with duplicate check) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/ingredients |
Get all ingredients |
| GET | /api/ingredients/category/<category> |
Get ingredients by category |
| GET | /api/ingredients/categories |
Get all available categories |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/ingredients/recipe-history |
Record user action (viewed, cooked, favorited, rated) |
| GET | /api/ingredients/recipe-history/user/<user_id> |
Get user's recipe history |
Create a new recipe:
POST /api/recipes
Content-Type: application/json
{
"title": "Leftover Pasta Bake",
"description": "Transform yesterday's pasta into cheesy goodness",
"instructions": "1. Preheat oven to 350ยฐF...",
"prep_time": 10,
"cook_time": 20,
"servings": 4,
"difficulty_level": "easy",
"created_by": 1,
"ingredients": [
{"ingredient_id": 22, "quantity": 200, "unit": "gram"},
{"ingredient_id": 28, "quantity": 100, "unit": "gram"}
]
}Our recipe upload follows a three-tier architecture:
- Presentation Layer: User submits recipe form
- Business Logic Layer:
- Validates required fields
- Checks if user already has a recipe with the same title
- If duplicate exists โ returns 409 error
- If valid โ proceeds to save
- Persistence Layer: Saves recipe and ingredient associations to database
This ensures users don't accidentally submit the same recipe multiple times while allowing different users to share recipes with the same name.
- Mathijs: Recipe endpoints and business logic
- Isaac: Ingredient endpoints and recipe history tracking
- Alex: User interface and recipe display
- Andrew: Search functionality and user interactions
- User authentication and authorization
- Recipe rating and review system
- Advanced search with multiple ingredient filters
- Expiration date tracking for ingredients
- Meal planning calendar
- Nutritional information calculator
- Social sharing features
- Mobile app version
This project is part of the Holberton school, Australia curriculum.
This is a student project. If you're part of the team:
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Happy Cooking! Let's reduce food waste together! ๐ฑ
Your developers:
- Mathijs
- Alex
- Isaac
- Andrew