# arnavvvvvvvvvv/smart-meal-planner architecture

> Architecture diagram of the GitHub repository arnavvvvvvvvvv/smart-meal-planner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arnavvvvvvvvvv/smart-meal-planner
- Repository: https://github.com/arnavvvvvvvvvv/smart-meal-planner

## Overview

Smart Meal Planner is a web app for generating and saving recipes, managing a pantry, scheduling meals, and organizing groceries. Users enter through the React app, authenticate, then use protected feature pages that call the REST API. On the backend, routes dispatch to domain controllers, which use models for persistent data; recipe generation and pantry suggestions also use Gemini. The README documents the broader feature set; controller-to-model and request-flow links are supported by sampled source, while unsampled route wiring is represented at directory level.

Main entry points: [`backend/models`](https://github.com/arnavvvvvvvvvv/smart-meal-planner/tree/main/backend/models) (Domain models), [`backend/routes`](https://github.com/arnavvvvvvvvvv/smart-meal-planner/tree/main/backend/routes) (REST routes), [`frontend/AIrecipe/src/services/api.js`](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/services/api.js) (API client), [`backend/controllers/recipeController.js`](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/controllers/recipeController.js) (Recipe controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["React app<br/>[App.jsx]"]
  node_authctx["Auth context<br/>[AuthContext.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_recipe_pages["Recipe pages"]
  node_pantry_page["Pantry page<br/>[Pantry.jsx]"]
  node_planner_page["Meal planner<br/>[MealPlanner.jsx]"]
  node_shopping_page["Shopping list<br/>[ShoppingList.jsx]"]
  node_account_pages["Account pages<br/>[Settings.jsx]"]
end

subgraph group_api["API and domain"]
  node_server["Express server<br/>[server.js]"]
  node_routes["REST routes"]
  node_auth_controller["Auth controller<br/>[authController.js]"]
  node_recipe_controller["Recipe controller"]
  node_pantry_controller["Pantry controller"]
  node_meal_controller["Meal plan controller"]
  node_shopping_controller["Shopping controller"]
  node_user_controller["User controller<br/>[userController.js]"]
end

subgraph group_data["Persistence"]
  node_models["Domain models"]
  node_database[("PostgreSQL<br/>[db.js]")]
end

subgraph group_integrations["External services"]
  node_gemini["Gemini integration<br/>[gemini.js]"]
  node_gemini_service(("Google Gemini"))
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"provides auth"| node_authctx
node_authctx -->|"sends auth requests"| node_api_client
node_recipe_pages -->|"requests recipes"| node_api_client
node_pantry_page -->|"requests pantry"| node_api_client
node_planner_page -->|"requests plans"| node_api_client
node_shopping_page -->|"requests shopping"| node_api_client
node_account_pages -->|"requests account"| node_api_client
node_api_client -->|"REST requests"| node_server
node_server -->|"mounts routes"| node_routes
node_routes -->|"dispatches auth"| node_auth_controller
node_routes -->|"dispatches recipes"| node_recipe_controller
node_routes -->|"dispatches pantry"| node_pantry_controller
node_routes -->|"dispatches plans"| node_meal_controller
node_routes -->|"dispatches shopping"| node_shopping_controller
node_routes -->|"dispatches users"| node_user_controller
node_auth_controller -->|"reads and writes users"| node_models
node_recipe_controller -->|"reads and writes recipes"| node_models
node_recipe_controller -->|"reads pantry items"| node_models
node_pantry_controller -->|"manages pantry items"| node_models
node_meal_controller -->|"manages meal plans"| node_models
node_shopping_controller -->|"manages shopping items"| node_models
node_shopping_controller -->|"moves checked items"| node_models
node_user_controller -->|"manages profiles"| node_models
node_models -->|"persists domain data"| node_database
node_recipe_controller -->|"generates recipes"| node_gemini
node_recipe_controller -->|"requests pantry suggestions"| node_gemini
node_gemini -->|"calls"| node_gemini_service

click node_app "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/App.jsx"
click node_authctx "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/context/AuthContext.jsx"
click node_api_client "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/services/api.js"
click node_recipe_pages "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/pages/RecipeGenerator.jsx"
click node_pantry_page "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/pages/Pantry.jsx"
click node_planner_page "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/pages/MealPlanner.jsx"
click node_shopping_page "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/pages/ShoppingList.jsx"
click node_account_pages "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/pages/Settings.jsx"
click node_server "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/server.js"
click node_routes "https://github.com/arnavvvvvvvvvv/smart-meal-planner/tree/main/backend/routes"
click node_auth_controller "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/controllers/authController.js"
click node_recipe_controller "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/controllers/recipeController.js"
click node_pantry_controller "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/controllers/pantryController.js"
click node_meal_controller "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/controllers/mealPlanController.js"
click node_shopping_controller "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/controllers/shoppingListController.js"
click node_user_controller "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/controllers/userController.js"
click node_models "https://github.com/arnavvvvvvvvvv/smart-meal-planner/tree/main/backend/models"
click node_database "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/config/db.js"
click node_gemini "https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/utils/gemini.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_authctx,node_api_client,node_recipe_pages,node_pantry_page,node_planner_page,node_shopping_page,node_account_pages,node_user toneBlue
class node_server,node_routes,node_auth_controller,node_recipe_controller,node_pantry_controller,node_meal_controller,node_shopping_controller,node_user_controller toneAmber
class node_models,node_database toneMint
class node_gemini,node_gemini_service toneRose
```

## Components

### Web client

- [React app](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/App.jsx): `frontend/AIrecipe/src/App.jsx`
- [Auth context](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/context/AuthContext.jsx): `frontend/AIrecipe/src/context/AuthContext.jsx`
- [API client](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/services/api.js): `frontend/AIrecipe/src/services/api.js`
- [Recipe pages](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/pages/RecipeGenerator.jsx): `frontend/AIrecipe/src/pages/RecipeGenerator.jsx`
- [Pantry page](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/pages/Pantry.jsx): `frontend/AIrecipe/src/pages/Pantry.jsx`
- [Meal planner](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/pages/MealPlanner.jsx): `frontend/AIrecipe/src/pages/MealPlanner.jsx`
- [Shopping list](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/pages/ShoppingList.jsx): `frontend/AIrecipe/src/pages/ShoppingList.jsx`
- [Account pages](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/frontend/AIrecipe/src/pages/Settings.jsx): `frontend/AIrecipe/src/pages/Settings.jsx`

### API and domain

- [Express server](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/server.js): `backend/server.js`
- [REST routes](https://github.com/arnavvvvvvvvvv/smart-meal-planner/tree/main/backend/routes): `backend/routes`
- [Auth controller](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Recipe controller](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/controllers/recipeController.js): `backend/controllers/recipeController.js`
- [Pantry controller](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/controllers/pantryController.js): `backend/controllers/pantryController.js`
- [Meal plan controller](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/controllers/mealPlanController.js): `backend/controllers/mealPlanController.js`
- [Shopping controller](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/controllers/shoppingListController.js): `backend/controllers/shoppingListController.js`
- [User controller](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`

### Persistence

- [Domain models](https://github.com/arnavvvvvvvvvv/smart-meal-planner/tree/main/backend/models): `backend/models`
- [PostgreSQL](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/config/db.js): `backend/config/db.js`

### External services

- [Gemini integration](https://github.com/arnavvvvvvvvvv/smart-meal-planner/blob/main/backend/utils/gemini.js): `backend/utils/gemini.js`
- **Google Gemini**

### Other components

- **User**

## Connections

- User → React app: uses
- React app → Auth context: provides auth
- Auth context → API client: sends auth requests
- Recipe pages → API client: requests recipes
- Pantry page → API client: requests pantry
- Meal planner → API client: requests plans
- Shopping list → API client: requests shopping
- Account pages → API client: requests account
- API client → Express server: REST requests
- Express server → REST routes: mounts routes
- REST routes → Auth controller: dispatches auth
- REST routes → Recipe controller: dispatches recipes
- REST routes → Pantry controller: dispatches pantry
- REST routes → Meal plan controller: dispatches plans
- REST routes → Shopping controller: dispatches shopping
- REST routes → User controller: dispatches users
- Auth controller → Domain models: reads and writes users
- Recipe controller → Domain models: reads and writes recipes
- Recipe controller → Domain models: reads pantry items
- Pantry controller → Domain models: manages pantry items
- Meal plan controller → Domain models: manages meal plans
- Shopping controller → Domain models: manages shopping items
- Shopping controller → Domain models: moves checked items
- User controller → Domain models: manages profiles
- Domain models → PostgreSQL: persists domain data
- Recipe controller → Gemini integration: generates recipes
- Recipe controller → Gemini integration: requests pantry suggestions
- Gemini integration → Google Gemini: calls
