# zaraimran03/ai-recipe-generator- architecture

> Architecture diagram of the GitHub repository zaraimran03/ai-recipe-generator-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zaraimran03/ai-recipe-generator-
- Repository: https://github.com/zaraimran03/ai-recipe-generator-

## Overview

SaaDish AI turns user ingredients and preferences into AI-generated recipes, then supports saving, adapting, cooking, and tracking them alongside pantry, family-recipe, nutrition, and account features. The principal path is browser route → recipe API route/controller → Groq generation, with authenticated recipes and history persisted in MongoDB. The README documents additional product capabilities whose detailed wiring is not visible in the sampled source; those are represented as subsystems without speculative call edges.

Main entry points: [`frontend/src/App.jsx`](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/frontend/src/App.jsx) (Web routes), [`backend/controllers/recipeController.js`](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/controllers/recipeController.js) (Recipe workflows), [`backend/server.js`](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/server.js) (Express server), [`backend/controllers/authController.js`](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/controllers/authController.js) (Auth workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_webapp["Web routes<br/>[App.jsx]"]
  node_recipe_ui["Recipe generation<br/>[GenerateRecipe.jsx]"]
  node_recipe_detail["Recipe details<br/>[RecipeDetails.jsx]"]
  node_family_ui["Family recipes<br/>[FamilyRecipes.jsx]"]
end

subgraph group_identity["Identity and profiles"]
  node_account_ui["Account access<br/>[AuthContext.jsx]"]
  node_auth_service["Auth client<br/>[auth.js]"]
  node_auth_routes["Auth endpoints<br/>[auth.js]"]
  node_auth_logic["Auth workflows<br/>[authController.js]"]
  node_user_store[("User records<br/>[User.js]")]
  node_user_api["Profile workflows<br/>[userController.js]"]
end

subgraph group_recipes["Recipe workflows"]
  node_recipe_routes["Recipe endpoints<br/>[recipes.js]"]
  node_recipe_logic["Recipe workflows"]
  node_ai["Groq recipe AI<br/>[groqService.js]"]
  node_recipe_store[("Recipe records<br/>[Recipe.js]")]
  node_family_logic["Family recipe workflows"]
  node_family_store[("Family recipe records<br/>[FamilyRecipe.js]")]
end

subgraph group_personal["Personal cooking data"]
  node_pantry["Pantry manager"]
  node_pantry_store[("Pantry records<br/>[Pantry.js]")]
  node_saved_data[("Favorites and history<br/>[Favorite.js]")]
  node_nutrition["Nutrition analytics<br/>[nutrition.js]"]
end

subgraph group_platform["Backend platform"]
  node_admin["Admin operations<br/>[admin.js]"]
  node_server["Express server<br/>[server.js]"]
  node_email["Email delivery<br/>[email.js]"]
end

node_cook(("Cook"))
node_mail_provider["EmailJS"]

node_cook -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_recipe_ui
node_webapp -->|"routes to"| node_recipe_detail
node_webapp -->|"routes to"| node_family_ui
node_webapp -->|"provides context"| node_account_ui
node_account_ui -->|"calls"| node_auth_service
node_auth_routes -->|"dispatches"| node_auth_logic
node_auth_logic -->|"reads and writes"| node_user_store
node_auth_logic -->|"sends OTP"| node_email
node_email -.->|"delivers email"| node_mail_provider
node_server -->|"mounts"| node_auth_routes
node_server -->|"mounts"| node_recipe_routes
node_server -->|"mounts"| node_nutrition
node_server -->|"mounts"| node_admin
node_recipe_routes -->|"dispatches"| node_recipe_logic
node_recipe_logic -->|"generates and adapts"| node_ai
node_recipe_logic -->|"reads and writes"| node_recipe_store
node_recipe_logic -->|"reads preferences"| node_user_store
node_recipe_logic -->|"records activity"| node_saved_data
node_family_logic -->|"reads and writes"| node_family_store
node_family_logic -->|"modernizes recipe"| node_ai
node_pantry -->|"reads and writes"| node_pantry_store
node_user_api -->|"reads and writes"| node_user_store
node_nutrition -->|"reads recipes"| node_recipe_store

click node_webapp "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/frontend/src/App.jsx"
click node_recipe_ui "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/frontend/src/pages/GenerateRecipe.jsx"
click node_recipe_detail "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/frontend/src/pages/RecipeDetails.jsx"
click node_family_ui "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/frontend/src/pages/FamilyRecipes.jsx"
click node_account_ui "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/frontend/src/context/AuthContext.jsx"
click node_auth_service "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/frontend/src/services/auth.js"
click node_auth_routes "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/routes/auth.js"
click node_auth_logic "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/controllers/authController.js"
click node_user_store "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/models/User.js"
click node_user_api "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/controllers/userController.js"
click node_recipe_routes "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/routes/recipes.js"
click node_recipe_logic "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/controllers/recipeController.js"
click node_ai "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/services/groqService.js"
click node_recipe_store "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/models/Recipe.js"
click node_family_logic "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/controllers/familyRecipeController.js"
click node_family_store "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/models/FamilyRecipe.js"
click node_pantry "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/controllers/pantryController.js"
click node_pantry_store "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/models/Pantry.js"
click node_saved_data "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/models/Favorite.js"
click node_nutrition "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/routes/nutrition.js"
click node_admin "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/routes/admin.js"
click node_server "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/server.js"
click node_email "https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/services/email.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webapp,node_recipe_ui,node_recipe_detail,node_family_ui toneBlue
class node_account_ui,node_auth_service,node_auth_routes,node_auth_logic,node_user_store,node_user_api toneAmber
class node_recipe_routes,node_recipe_logic,node_ai,node_recipe_store,node_family_logic,node_family_store toneMint
class node_pantry,node_pantry_store,node_saved_data,node_nutrition toneRose
class node_admin,node_server,node_email,node_cook,node_mail_provider toneIndigo
```

## Components

### Web experience

- [Web routes](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Recipe generation](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/frontend/src/pages/GenerateRecipe.jsx): `frontend/src/pages/GenerateRecipe.jsx`
- [Recipe details](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/frontend/src/pages/RecipeDetails.jsx): `frontend/src/pages/RecipeDetails.jsx`
- [Family recipes](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/frontend/src/pages/FamilyRecipes.jsx): `frontend/src/pages/FamilyRecipes.jsx`

### Identity and profiles

- [Account access](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Auth client](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/frontend/src/services/auth.js): `frontend/src/services/auth.js`
- [Auth endpoints](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Auth workflows](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [User records](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/models/User.js): `backend/models/User.js`
- [Profile workflows](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`

### Recipe workflows

- [Recipe endpoints](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/routes/recipes.js): `backend/routes/recipes.js`
- [Recipe workflows](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/controllers/recipeController.js): `backend/controllers/recipeController.js`
- [Groq recipe AI](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/services/groqService.js): `backend/services/groqService.js`
- [Recipe records](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/models/Recipe.js): `backend/models/Recipe.js`
- [Family recipe workflows](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/controllers/familyRecipeController.js): `backend/controllers/familyRecipeController.js`
- [Family recipe records](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/models/FamilyRecipe.js): `backend/models/FamilyRecipe.js`

### Personal cooking data

- [Pantry manager](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/controllers/pantryController.js): `backend/controllers/pantryController.js`
- [Pantry records](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/models/Pantry.js): `backend/models/Pantry.js`
- [Favorites and history](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/models/Favorite.js): `backend/models/Favorite.js`
- [Nutrition analytics](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/routes/nutrition.js): `backend/routes/nutrition.js`

### Backend platform

- [Admin operations](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/routes/admin.js): `backend/routes/admin.js`
- [Express server](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/server.js): `backend/server.js`
- [Email delivery](https://github.com/zaraimran03/ai-recipe-generator-/blob/main/backend/services/email.js): `backend/services/email.js`

### Other components

- **Cook**
- **EmailJS**

## Connections

- Cook → Web routes: uses (evidence: `README.md`)
- Web routes → Recipe generation: routes to (evidence: `frontend/src/App.jsx`)
- Web routes → Recipe details: routes to (evidence: `frontend/src/App.jsx`)
- Web routes → Family recipes: routes to (evidence: `frontend/src/App.jsx`)
- Web routes → Account access: provides context (evidence: `frontend/src/App.jsx`)
- Account access → Auth client: calls (evidence: `frontend/src/context/AuthContext.jsx`)
- Auth endpoints → Auth workflows: dispatches (evidence: `backend/routes/auth.js`)
- Auth workflows → User records: reads and writes (evidence: `backend/controllers/authController.js`)
- Auth workflows → Email delivery: sends OTP (evidence: `backend/controllers/authController.js`)
- Email delivery → EmailJS: delivers email (evidence: `README.md`)
- Express server → Auth endpoints: mounts (evidence: `backend/server.js`)
- Express server → Recipe endpoints: mounts (evidence: `backend/server.js`)
- Express server → Nutrition analytics: mounts (evidence: `backend/server.js`)
- Express server → Admin operations: mounts (evidence: `backend/server.js`)
- Recipe endpoints → Recipe workflows: dispatches (evidence: `backend/routes/recipes.js`)
- Recipe workflows → Groq recipe AI: generates and adapts (evidence: `backend/controllers/recipeController.js`)
- Recipe workflows → Recipe records: reads and writes (evidence: `backend/controllers/recipeController.js`)
- Recipe workflows → User records: reads preferences (evidence: `backend/controllers/recipeController.js`)
- Recipe workflows → Favorites and history: records activity (evidence: `backend/controllers/recipeController.js`)
- Family recipe workflows → Family recipe records: reads and writes (evidence: `backend/controllers/familyRecipeController.js`)
- Family recipe workflows → Groq recipe AI: modernizes recipe (evidence: `backend/controllers/familyRecipeController.js`)
- Pantry manager → Pantry records: reads and writes (evidence: `backend/controllers/pantryController.js`)
- Profile workflows → User records: reads and writes (evidence: `backend/controllers/userController.js`)
- Nutrition analytics → Recipe records: reads recipes (evidence: `backend/routes/nutrition.js`)
