How gaganashreea/ai-food-recipe works
This is a recipe-generation web app: users upload a food image, review detected ingredients, optionally set a dietary preference, and request a full recipe or suggestions. The client context holds workflow state and makes API requests; the server routes those requests to image-analysis, generation, suggestions, and saved-recipe handlers. Generated recipes can be saved, searched/filtered, viewed, and deleted. The server handlers use a Groq-backed AI client and a MongoDB recipe model. The README is empty, and several UI/server files were not excerpted, so unsampled details and unsupported connections are omitted.
Main entry points: Home.jsx Ingredient workflow · RecipeContext.jsx Workflow state and API · App.jsx Route shell · RecipeResult.jsx Recipe result
Components 23
Recipe client
- Route shell
client/src/App.jsx - Ingredient workflow
client/src/pages/Home.jsx - Image upload
client/src/components/ImageUploader.jsx - Ingredient list
client/src/components/IngredientList.jsx - Diet filter
client/src/components/DietaryFilter.jsx - Suggestion choices
client/src/components/SuggestionsList.jsx - Workflow state and API
client/src/context/RecipeContext.jsx - Recipe result
client/src/pages/RecipeResult.jsx - Saved detail
client/src/pages/RecipeDetail.jsx - Saved collection
client/src/pages/SavedRecipes.jsx - Recipe details view
client/src/components/RecipeDisplay.jsx - Recipe card
client/src/components/RecipeCard.jsx - Loading indicator
client/src/components/Loader.jsx - Navigation
client/src/components/Navbar.jsx
Recipe API
- Recipe routes
server/routes/recipeRoutes.js - Image validation
server/middleware/upload.js - Recipe handlers
server/controllers/recipeController.js
AI generation
- Groq AI service
- AI client config
server/config/gemini.js
Saved recipes
- Recipe schema
server/models/Recipe.js - MongoDB
- Database connection
server/config/db.js
Other components
- User
Connections 25
- User → Ingredient workflow: uses
- Route shell → Ingredient workflow: routes to
client/src/App.jsx - Route shell → Recipe result: routes to
client/src/App.jsx - Route shell → Saved collection: routes to
client/src/App.jsx - Route shell → Saved detail: routes to
client/src/App.jsx - Ingredient workflow → Image upload: renders
client/src/pages/Home.jsx - Ingredient workflow → Ingredient list: renders
client/src/pages/Home.jsx - Ingredient workflow → Diet filter: renders
client/src/pages/Home.jsx - Ingredient workflow → Suggestion choices: renders
client/src/pages/Home.jsx - Ingredient workflow → Workflow state and API: requests generation
client/src/pages/Home.jsx - Image upload → Workflow state and API: analyzes image
client/src/components/ImageUploader.jsx - Recipe result → Workflow state and API: reads recipe
client/src/pages/RecipeResult.jsx - Recipe result → Recipe details view: renders
client/src/pages/RecipeResult.jsx - Recipe details view → Recipe card: renders
client/src/components/RecipeDisplay.jsx - Saved collection → Workflow state and API: fetches recipes
client/src/pages/SavedRecipes.jsx - Saved collection → Recipe card: renders
client/src/pages/SavedRecipes.jsx - Saved detail → Recipe details view: renders
client/src/pages/RecipeDetail.jsx - Recipe card → Workflow state and API: saves or deletes
client/src/components/RecipeCard.jsx - Workflow state and API → Recipe routes: requests API
client/src/context/RecipeContext.jsx - Recipe routes → Image validation: validates image
server/routes/recipeRoutes.js - Recipe routes → Recipe handlers: dispatches handlers
server/routes/recipeRoutes.js - Recipe handlers → AI client config: uses AI client
server/controllers/recipeController.js - AI client config → Groq AI service: configures
- Recipe handlers → Recipe schema: queries or saves
server/controllers/recipeController.js - Database connection → MongoDB: connects
server/config/db.js