An AI-powered meal planning application that generates personalized, budget-conscious meal plans with accurate grocery pricing and store integration.
NutriGenie combines the power of AI with real-world grocery data to create practical meal plans that fit your budget and nutritional needs. Using GPT-4 with RAG (Retrieval Augmented Generation), it generates intelligent meal suggestions based on ingredients actually available at your local stores.
- π€ AI-Powered Meal Planning: Uses GPT-4 with semantic ingredient matching
- π° Budget-Conscious: Stays within your specified budget using real grocery pricing
- πͺ Multi-Store Support: Kroger, Safeway, Walmart, Whole Foods, and more
- π Smart Ingredient Matching: Vector similarity search for ingredient alternatives
- π± Modern UI: Clean, responsive React/Next.js interface
- π Nutritional Tracking: Detailed macro and calorie breakdowns
- π Smart Shopping Lists: Auto-generated lists with store-specific pricing
- π PDF Export: Export meal plans and grocery lists
- Comprehensive Onboarding: Collects age, weight, height, activity level, and fitness goals
- Automatic Macro Calculation: Uses Mifflin-St Jeor equation to calculate TDEE and optimal macronutrient distribution
- Dietary Preferences: Supports vegetarian, vegan, gluten-free, keto, paleo, and custom restrictions
- Location-Based Setup: ZIP code integration for nearby store discovery
- Profile Persistence: Secure user data storage with Supabase authentication
- GPT-4 Integration: Advanced language model creates realistic, varied meal plans
- RAG Enhancement: Retrieval Augmented Generation ensures ingredient availability and pricing accuracy
- Function Calling: Structured JSON schema ensures consistent meal plan format
- Budget Optimization: AI considers ingredient costs to stay within weekly budget constraints
- Nutritional Balance: Ensures daily calorie and macro targets are met across all meals
- Recipe Variety: Generates diverse recipes to prevent meal plan monotony
- Multi-Store Support: Integrates with major grocery chains:
- Kroger: Full API integration with real-time pricing
- Safeway: Web scraping with intelligent fallback pricing
- Walmart: Product availability and price matching
- Whole Foods, Target, ALDI: Research-based price multipliers
- Geographic Discovery: Finds nearby stores using ZIP code lookup
- Price Validation: Filters out unrealistic prices (e.g., uniform $5.00 errors)
- Store-Specific Adjustments: Applies realistic price multipliers for unsupported stores
- Automated Price Refresh: Daily GitHub Actions workflows update pricing data
- Vector Embeddings: OpenAI text-embedding-3-small for semantic ingredient matching
- Similarity Search: pgvector database for finding ingredient alternatives
- Unit Conversion Intelligence:
- Weight β Volume conversions (gβml, lbβoz)
- Liquid density calculations for accurate milk/juice pricing
- Package size assumptions (realistic portions vs. bulk quantities)
- Ingredient Availability: Cross-references meal plan ingredients with store inventory
- Substitution Suggestions: Recommends alternatives when ingredients are unavailable
- Detailed Macro Tracking: Protein, carbohydrates, fat, and calorie counts per meal and day
- Nutritional Goals: Customizable targets based on fitness objectives (weight loss, muscle gain, maintenance)
- Serving Size Accuracy: Precise portion calculations for accurate nutritional data
- Dietary Compliance: Ensures generated meals adhere to specified dietary restrictions
- Visual Nutrition Display: Clean charts and progress indicators for macro tracking
- Auto-Generated Lists: Consolidates ingredients across all meals into organized shopping lists
- Store-Specific Pricing: Shows current prices from selected grocery stores
- Quantity Optimization: Calculates exact amounts needed to minimize waste
- Category Organization: Groups ingredients by store sections (produce, dairy, meat, etc.)
- Cost Breakdown: Displays individual item costs and total estimated spending
- Multi-Store Support: Generates separate lists if shopping at multiple stores
- Responsive Design: Works seamlessly on desktop, tablet, and mobile devices
- Loading States: Skeleton loaders and progress indicators during meal generation
- Error Handling: Graceful error recovery with helpful user feedback
- Real-Time Updates: Live status updates during meal plan generation
- Accessible UI: WCAG compliant design with keyboard navigation support
- Dark/Light Mode: Theme options for user preference
- PDF Generation: Professional meal plan and grocery list exports
- Print Optimization: Clean, printer-friendly layouts
- Email Integration: Share meal plans via email
- Recipe Details: Complete cooking instructions, prep times, and serving information
- Nutritional Summaries: Exportable nutrition data for tracking apps
- Supabase Authentication: Secure user registration and login
- Row-Level Security: Database-level access controls
- API Key Management: Secure storage of third-party API credentials
- Data Encryption: All sensitive data encrypted at rest and in transit
- Privacy Compliance: GDPR-compliant data handling practices
- Caching Strategy: Intelligent caching of pricing data and store information
- Batch Processing: Efficient ingredient embedding and price lookups
- Database Optimization: Indexed queries for fast meal plan retrieval
- CDN Integration: Fast asset delivery for global users
- Background Jobs: Non-blocking price updates and data processing
- Comprehensive API: RESTful endpoints for all application functionality
- Type Safety: Full TypeScript implementation across frontend and backend
- Error Logging: Detailed logging for debugging and monitoring
- Testing Suite: Unit and integration tests for critical functionality
- Development Tools: Hot reloading, debugging, and development server setup
- FastAPI - Modern Python web framework
- Supabase - PostgreSQL with pgvector for embeddings
- OpenAI GPT-4 - Meal plan generation and RAG
- Python 3.9+ - Core backend language
- Next.js 14 - React framework with App Router
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first styling
- Shadcn/UI - Modern component library
- Price Scraping: Real-time pricing from Kroger, Walmart, Safeway
- RAG System: Semantic ingredient matching with OpenAI embeddings
- Unit Conversion: Smart quantity conversions (gβml, lbβoz, etc.)
- Store Integration: Multi-store price comparison and availability
- Node.js 18+
- Python 3.9+
- Supabase account
- OpenAI API key
- Clone and setup:
git clone <repository-url>
cd NutriGenie/backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt- Environment variables:
Create
.envfile:
OPENAI_API_KEY=your_openai_api_key
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
KROGER_CLIENT_ID=your_kroger_client_id
KROGER_CLIENT_SECRET=your_kroger_client_secret- Start backend:
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000- Setup and start:
cd ../frontend
npm install- Environment variables:
Create
.env.local:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
NEXT_PUBLIC_API_URL=http://localhost:8000- Start frontend:
npm run dev- Users: Authentication and preferences
- Meal Plans: Generated plans with dates and costs
- Recipes: Individual recipes with nutrition data
- Ingredients: Master list with vector embeddings
- Stores: Grocery store locations and details
- Pricing: Real-time prices by store and ingredient
RAG Meal Planning (app/services/rag_meal_plan.py):
- Semantic ingredient matching using vector similarity
- Context-aware GPT prompts with available ingredients
- Budget-conscious recipe generation with real pricing
Pricing System (app/services/pricing.py):
- Multi-store price aggregation and validation
- Store-specific multipliers for unsupported locations
- Price outlier detection and fallback logic
Unit Conversion (app/services/unit_conversion.py):
- Smart quantity conversions between units
- Liquid density calculations for accurate pricing
- Package size assumptions for realistic quantities
- Account Setup: Create account and complete onboarding
- Set Preferences: Budget, nutrition goals, dietary restrictions, stores
- Generate Plan: AI creates personalized 7-day meal plan
- Review & Export: View recipes, ingredients, costs, and export to PDF
- Shop Smart: Use generated grocery list with store-specific pricing
Automated daily price updates via GitHub Actions:
PYTHONPATH=backend python backend/scripts/refresh_prices.pyRequired secrets:
SUPABASE_URL/SUPABASE_SERVICE_KEYKROGER_CLIENT_ID/KROGER_CLIENT_SECRET
Add SQL migrations to backend/migrations/ and apply via Supabase dashboard.
cd backend && pytestPOST /auth/signup- User registrationPOST /auth/signin- User loginGET /auth/verify- Email verification
GET /profiles- Get user profilePUT /profiles- Update user profilePOST /profiles/macros- Calculate and update macros
POST /meal-plans/generate- Generate new meal planGET /meal-plans- List user's meal plansGET /meal-plans/{id}- Get specific meal planDELETE /meal-plans/{id}- Delete meal plan
GET /stores/nearby- Find nearby grocery storesGET /stores/{id}/prices- Get store-specific pricingPOST /stores/refresh-prices- Trigger price refresh
GET /ingredients/search- Search ingredients with embeddingsPOST /ingredients/embed- Generate ingredient embeddingsGET /ingredients/suggestions- Get ingredient alternatives