How mehedihasan3000/flavor-ai works
FlavorAI is a recipe-sharing and AI-assisted meal-planning application. A user interacts with the Next.js pages, which call the Express API; the API authenticates requests, applies domain logic, and persists account and cooking data in MongoDB. The core journey spans pantry and preference input, recipe or weekly-plan generation, shopping-list creation, and pantry updates. Community recipes, nutrition analysis, diet planning, chat assistance, and administration are distinct capabilities. The README documents the product scope; sampled source supports key meal-plan, grocery, pantry, auth, and server boundaries, while unsampled feature wiring is shown only where directory structure and module roles support it.
Main entry points: v1.ts API v1 routes · Recipe.ts Recipe records · groceryController.ts Shopping-list controller · mealPlanService.ts Plan generation
Components 33
Web experience
- Product pages
frontend/src/app - Sign-in pages
frontend/src/app/(auth) - API client
frontend/src/lib/api.ts - Assistant page
frontend/src/app/assistant/page.tsx - Chat session storage
frontend/src/lib/assistant-storage.ts - Auth proxy routes
frontend/src/app/api/auth
API boundary
- Express app
backend/src/server.ts - API v1 routes
backend/src/routes/v1.ts - Auth controller
backend/src/controllers/authController.ts - AI controller
backend/src/controllers/aiController.ts - Assistant controller
backend/src/controllers/assistantController.ts
Cooking workflows
- Pantry controller
backend/src/controllers/pantryController.ts - Pantry operations
backend/src/services/pantryService.ts - Pantry records
backend/src/models/PantryItem.ts - Meal-plan controller
backend/src/controllers/mealPlanController.ts - Plan generation
backend/src/services/mealPlanService.ts - Meal plans
backend/src/models/MealPlan.ts - Shopping-list controller
backend/src/controllers/groceryController.ts - List calculations
backend/src/services/groceryService.ts - Grocery lists
backend/src/models/GroceryList.ts - AI generation
backend/src/services/aiService.ts - Assistant context and chat
backend/src/services/assistantService.ts - Diet planning
backend/src/services/dietService.ts
Recipes and community
- Recipe controller
backend/src/controllers/recipeController.ts - Community actions
backend/src/controllers/commentController.ts - Recipe records
backend/src/models/Recipe.ts - Ratings and saves
backend/src/models/Rating.ts
Identity and data
- User profiles
backend/src/models/User.ts
Other components
- Home cook
- MongoDB
- Groq AI
- ImgBB images
- Google identity
Connections 48
- Home cook → Product pages: uses
- Home cook → Sign-in pages: signs in
- Product pages → API client: requests data
- Assistant page → API client: sends chat
- Assistant page → Chat session storage: persists turns
- Sign-in pages → Auth proxy routes: submits credentials
- Auth proxy routes → Auth controller: verifies account
- Auth proxy routes → Google identity: verifies token
- API client → Express app: calls API
- Express app → API v1 routes: dispatches
- API v1 routes → Auth controller: dispatches
- API v1 routes → Recipe controller: dispatches
- API v1 routes → Community actions: dispatches
- API v1 routes → Pantry controller: dispatches
- API v1 routes → Meal-plan controller: dispatches
- API v1 routes → Shopping-list controller: dispatches
- API v1 routes → AI controller: dispatches
- API v1 routes → Assistant controller: dispatches
- Recipe controller → Recipe records: reads/writes
- Community actions → Ratings and saves: reads/writes
- Community actions → Recipe records: references
- Pantry controller → Pantry records: reads/writes
- Pantry controller → Pantry operations: uses
- Meal-plan controller → Plan generation: generates or swaps
- Meal-plan controller → Meal plans: reads/writes
- Meal-plan controller → Recipe records: loads recipe cards
- Plan generation → Pantry operations: reads stock
- Plan generation → Meal plans: persists plans
- Plan generation → Recipe records: selects recipes
- Plan generation → Groq AI: requests generation
- Shopping-list controller → Meal plans: reads plan
- Shopping-list controller → Recipe records: loads ingredients
- Shopping-list controller → Pantry operations: reads or updates stock
- Shopping-list controller → List calculations: calculates requirements
- Shopping-list controller → Grocery lists: reads/writes
- AI controller → AI generation: requests AI work
- AI generation → Groq AI: requests generation
- Assistant controller → Assistant context and chat: handles chat
- Assistant context and chat → Pantry operations: uses kitchen context
- Assistant context and chat → User profiles: reads preferences
- Assistant context and chat → Recipe records: reads saved recipes
- Assistant context and chat → Groq AI: requests response
- Diet planning → User profiles: uses profile
- Auth controller → User profiles: reads/writes
- User profiles → MongoDB: persists
- Recipe records → MongoDB: persists
- Ratings and saves → MongoDB: persists
- Pantry records → MongoDB: persists