# mananpgit/meal_planner architecture

> Architecture diagram of the GitHub repository mananpgit/meal_planner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mananpgit/meal_planner
- Repository: https://github.com/mananpgit/meal_planner

## Overview

MealMate supports recipe search and detail/nutrition lookup, saving favorites, and arranging saved recipes into a weekly breakfast/lunch/dinner plan. The main user journey runs from the React app to search results, then recipe details or saved-recipes actions; saved items can also be dragged into the planner. The planner currently keeps its plan in component state, so it resets on reload. The README documents planner and nutrition capabilities; source excerpts show their implementation, but the planner is imported by the entry file and is not rendered by the sampled App component.

Main entry points: [`frontend/src/App.jsx`](https://github.com/mananpgit/meal_planner/blob/main/frontend/src/App.jsx) (App navigation), [`frontend/src/components/RecipeCard.jsx`](https://github.com/mananpgit/meal_planner/blob/main/frontend/src/components/RecipeCard.jsx) (Recipe card), [`backend/routes/recipes.js`](https://github.com/mananpgit/meal_planner/blob/main/backend/routes/recipes.js) (Recipe endpoints), [`frontend/src/utils/local.js`](https://github.com/mananpgit/meal_planner/blob/main/frontend/src/utils/local.js) (Saved recipe client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React experience"]
  node_app["App navigation<br/>[App.jsx]"]
  node_home["Home page<br/>[HomePage.jsx]"]
  node_search["Recipe search<br/>[Search.jsx]"]
  node_recipe_card["Recipe card<br/>[RecipeCard.jsx]"]
  node_recipe_modal["Recipe details<br/>[RecipeModal.jsx]"]
  node_saved_page["Saved recipes<br/>[SavedRecipes.jsx]"]
  node_meal_planner["Weekly planner<br/>[MealPlanner.jsx]"]
  node_day_card["Day meal slots<br/>[DayCard.jsx]"]
  node_saved_client["Saved recipe client<br/>[local.js]"]
end

subgraph group_backend["Recipe API"]
  node_api_entry["Express app<br/>[index.js]"]
  node_recipe_routes["Recipe endpoints<br/>[recipes.js]"]
end

subgraph group_persistence["Saved recipe storage"]
  node_saved_routes["Saved endpoints<br/>[savedRecipes.js]"]
  node_db_pool["PostgreSQL pool<br/>[database.js]"]
end

node_user(("MealMate user"))
node_postgres[("PostgreSQL")]
node_spoonacular{{"Spoonacular API"}}

node_user -->|"uses"| node_app
node_app -->|"renders"| node_home
node_app -->|"renders"| node_search
node_app -->|"renders"| node_saved_page
node_home -->|"selects page"| node_app
node_search -->|"requests search"| node_recipe_routes
node_recipe_routes -->|"searches and fetches"| node_spoonacular
node_search -->|"renders results"| node_recipe_card
node_saved_page -->|"renders saved"| node_recipe_card
node_recipe_card -->|"renders details"| node_recipe_modal
node_recipe_card -->|"requests details"| node_recipe_routes
node_recipe_card -->|"checks and toggles"| node_saved_client
node_saved_page -->|"loads saved"| node_saved_client
node_saved_client -->|"calls saved API"| node_saved_routes
node_meal_planner -->|"loads saved"| node_saved_client
node_meal_planner -->|"renders days"| node_day_card
node_day_card -->|"updates meal state"| node_meal_planner
node_day_card -->|"requests nutrition"| node_recipe_routes
node_api_entry -->|"mounts routes"| node_recipe_routes
node_api_entry -->|"mounts routes"| node_saved_routes
node_saved_routes -->|"queries"| node_db_pool
node_db_pool -->|"connects"| node_postgres

click node_app "https://github.com/mananpgit/meal_planner/blob/main/frontend/src/App.jsx"
click node_home "https://github.com/mananpgit/meal_planner/blob/main/frontend/src/pages/HomePage.jsx"
click node_search "https://github.com/mananpgit/meal_planner/blob/main/frontend/src/pages/Search.jsx"
click node_recipe_card "https://github.com/mananpgit/meal_planner/blob/main/frontend/src/components/RecipeCard.jsx"
click node_recipe_modal "https://github.com/mananpgit/meal_planner/blob/main/frontend/src/components/RecipeModal.jsx"
click node_saved_page "https://github.com/mananpgit/meal_planner/blob/main/frontend/src/pages/SavedRecipes.jsx"
click node_meal_planner "https://github.com/mananpgit/meal_planner/blob/main/frontend/src/pages/MealPlanner.jsx"
click node_day_card "https://github.com/mananpgit/meal_planner/blob/main/frontend/src/components/DayCard.jsx"
click node_saved_client "https://github.com/mananpgit/meal_planner/blob/main/frontend/src/utils/local.js"
click node_api_entry "https://github.com/mananpgit/meal_planner/blob/main/backend/index.js"
click node_recipe_routes "https://github.com/mananpgit/meal_planner/blob/main/backend/routes/recipes.js"
click node_saved_routes "https://github.com/mananpgit/meal_planner/blob/main/backend/routes/savedRecipes.js"
click node_db_pool "https://github.com/mananpgit/meal_planner/blob/main/backend/config/database.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_app,node_home,node_search,node_recipe_card,node_recipe_modal,node_saved_page,node_meal_planner,node_day_card,node_saved_client,node_user toneBlue
class node_api_entry,node_recipe_routes,node_postgres toneAmber
class node_saved_routes,node_db_pool,node_spoonacular toneMint
```

## Components

### React experience

- [App navigation](https://github.com/mananpgit/meal_planner/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Home page](https://github.com/mananpgit/meal_planner/blob/main/frontend/src/pages/HomePage.jsx): `frontend/src/pages/HomePage.jsx`
- [Recipe search](https://github.com/mananpgit/meal_planner/blob/main/frontend/src/pages/Search.jsx): `frontend/src/pages/Search.jsx`
- [Recipe card](https://github.com/mananpgit/meal_planner/blob/main/frontend/src/components/RecipeCard.jsx): `frontend/src/components/RecipeCard.jsx`
- [Recipe details](https://github.com/mananpgit/meal_planner/blob/main/frontend/src/components/RecipeModal.jsx): `frontend/src/components/RecipeModal.jsx`
- [Saved recipes](https://github.com/mananpgit/meal_planner/blob/main/frontend/src/pages/SavedRecipes.jsx): `frontend/src/pages/SavedRecipes.jsx`
- [Weekly planner](https://github.com/mananpgit/meal_planner/blob/main/frontend/src/pages/MealPlanner.jsx): `frontend/src/pages/MealPlanner.jsx`
- [Day meal slots](https://github.com/mananpgit/meal_planner/blob/main/frontend/src/components/DayCard.jsx): `frontend/src/components/DayCard.jsx`
- [Saved recipe client](https://github.com/mananpgit/meal_planner/blob/main/frontend/src/utils/local.js): `frontend/src/utils/local.js`

### Recipe API

- [Express app](https://github.com/mananpgit/meal_planner/blob/main/backend/index.js): `backend/index.js`
- [Recipe endpoints](https://github.com/mananpgit/meal_planner/blob/main/backend/routes/recipes.js): `backend/routes/recipes.js`

### Saved recipe storage

- [Saved endpoints](https://github.com/mananpgit/meal_planner/blob/main/backend/routes/savedRecipes.js): `backend/routes/savedRecipes.js`
- [PostgreSQL pool](https://github.com/mananpgit/meal_planner/blob/main/backend/config/database.js): `backend/config/database.js`

### Other components

- **MealMate user**
- **PostgreSQL**
- **Spoonacular API**

## Connections

- MealMate user → App navigation: uses (evidence: `frontend/src/App.jsx`)
- App navigation → Home page: renders (evidence: `frontend/src/App.jsx`)
- App navigation → Recipe search: renders (evidence: `frontend/src/App.jsx`)
- App navigation → Saved recipes: renders (evidence: `frontend/src/App.jsx`)
- Home page → App navigation: selects page (evidence: `frontend/src/pages/HomePage.jsx`)
- Recipe search → Recipe endpoints: requests search (evidence: `frontend/src/pages/Search.jsx`)
- Recipe endpoints → Spoonacular API: searches and fetches (evidence: `backend/routes/recipes.js`)
- Recipe search → Recipe card: renders results (evidence: `frontend/src/pages/Search.jsx`)
- Saved recipes → Recipe card: renders saved (evidence: `frontend/src/pages/SavedRecipes.jsx`)
- Recipe card → Recipe details: renders details (evidence: `frontend/src/components/RecipeCard.jsx`)
- Recipe card → Recipe endpoints: requests details (evidence: `frontend/src/components/RecipeCard.jsx`)
- Recipe card → Saved recipe client: checks and toggles (evidence: `frontend/src/components/RecipeCard.jsx`)
- Saved recipes → Saved recipe client: loads saved (evidence: `frontend/src/pages/SavedRecipes.jsx`)
- Saved recipe client → Saved endpoints: calls saved API (evidence: `frontend/src/utils/local.js`)
- Weekly planner → Saved recipe client: loads saved (evidence: `frontend/src/pages/MealPlanner.jsx`)
- Weekly planner → Day meal slots: renders days (evidence: `frontend/src/pages/MealPlanner.jsx`)
- Day meal slots → Weekly planner: updates meal state (evidence: `frontend/src/components/DayCard.jsx`)
- Day meal slots → Recipe endpoints: requests nutrition (evidence: `frontend/src/components/DayCard.jsx`)
- Express app → Recipe endpoints: mounts routes (evidence: `backend/index.js`)
- Express app → Saved endpoints: mounts routes (evidence: `backend/index.js`)
- Saved endpoints → PostgreSQL pool: queries (evidence: `backend/routes/savedRecipes.js`)
- PostgreSQL pool → PostgreSQL: connects (evidence: `backend/config/database.js`)
