# utkarsh3904/chefnova---ai-recipe-platform architecture

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

- Interactive diagram: https://gitdiagram.com/utkarsh3904/chefnova---ai-recipe-platform
- Repository: https://github.com/utkarsh3904/chefnova---ai-recipe-platform

## Overview

ChefNova is an authenticated recipe platform whose main loop is managing pantry ingredients, discovering pantry-matched suggestions, and generating or saving recipes. Users can also browse TheMealDB by category or cuisine, export recipes as PDFs, and access free or premium plans. The graph combines documented capabilities with sampled imports and calls; several route implementations and integrations were not sampled, so their documented links use the README as evidence rather than implying inspected source details.

Main entry points: [`actions/recipe.actions.js`](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/actions/recipe.actions.js) (Recipe actions), [`actions/pantry.actions.js`](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/actions/pantry.actions.js) (Pantry actions), [`lib/checkUser.js`](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/lib/checkUser.js) (User resolution), [`actions/mealdb.actions.js`](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/actions/mealdb.actions.js) (MealDB browsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_landing["Landing and pricing<br/>[page.jsx]"]
  node_dashboard["Dashboard<br/>[page.jsx]"]
end

subgraph group_pantry["Pantry workflow"]
  node_pantry_page["Pantry manager<br/>[page.jsx]"]
  node_pantry_modal["Add ingredients"]
  node_pantry_actions["Pantry actions<br/>[pantry.actions.js]"]
  node_pantry_suggestions["Pantry suggestions<br/>[page.jsx]"]
end

subgraph group_recipes["Recipe discovery"]
  node_mealdb_actions["MealDB browsing<br/>[mealdb.actions.js]"]
  node_category_browse["Category and cuisine<br/>[page.jsx]"]
  node_recipe_grid["Recipe grid<br/>[RecipeGrid.jsx]"]
  node_saved_browse["Saved collection<br/>[page.jsx]"]
  node_recipe_actions["Recipe actions<br/>[recipe.actions.js]"]
  node_recipe_detail["Recipe detail<br/>[page.jsx]"]
  node_recipe_pdf["PDF export<br/>[RecipePDF.jsx]"]
end

subgraph group_identity["Identity and plans"]
  node_auth_middleware["Route protection<br/>[middleware.js]"]
  node_user_helper["User resolution<br/>[checkUser.js]"]
  node_pricing["Plan checkout<br/>[PricingSection.jsx]"]
end

subgraph group_persistence["Data layer"]
  node_db["Mongo connection<br/>[db.js]"]
  node_models[("Domain models<br/>[models.js]")]
end

node_cook(("Home cook"))
node_mealdb["TheMealDB"]
node_gemini["Google Gemini"]
node_clerk["Clerk"]

node_cook -->|"visits"| node_landing
node_landing -->|"renders"| node_pricing
node_cook -->|"opens"| node_dashboard
node_dashboard -->|"loads meals"| node_mealdb_actions
node_mealdb_actions -.->|"fetches meals"| node_mealdb
node_category_browse -->|"loads selections"| node_mealdb_actions
node_category_browse -->|"renders"| node_recipe_grid
node_recipe_grid -->|"fetches meals"| node_mealdb_actions
node_pantry_page -->|"opens"| node_pantry_modal
node_pantry_modal -->|"submits items"| node_pantry_actions
node_pantry_page -->|"manages pantry"| node_pantry_actions
node_pantry_page -->|"opens suggestions"| node_pantry_suggestions
node_pantry_suggestions -->|"requests suggestions"| node_recipe_actions
node_pantry_actions -->|"resolves user"| node_user_helper
node_recipe_actions -->|"resolves user"| node_user_helper
node_user_helper -->|"checks session"| node_clerk
node_auth_middleware -->|"protects routes"| node_clerk
node_user_helper -->|"connects"| node_db
node_db -->|"initializes"| node_models
node_pantry_actions -->|"reads and writes"| node_db
node_recipe_actions -->|"reads and writes"| node_db
node_recipe_actions -->|"generates recipes"| node_gemini
node_pantry_actions -.->|"scans ingredients"| node_gemini
node_saved_browse -->|"loads collection"| node_recipe_actions
node_recipe_detail -->|"requests recipe"| node_recipe_actions
node_recipe_detail -->|"renders PDF"| node_recipe_pdf
node_cook -->|"chooses plan"| node_pricing
node_pricing -.->|"starts checkout"| node_clerk

click node_landing "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/app/page.jsx"
click node_dashboard "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/app/(main)/dashboard/page.jsx"
click node_pantry_page "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/app/(main)/pantry/page.jsx"
click node_pantry_modal "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/components/AddToPantryModal.jsx"
click node_pantry_actions "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/actions/pantry.actions.js"
click node_pantry_suggestions "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/app/(main)/pantry/recipes/page.jsx"
click node_mealdb_actions "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/actions/mealdb.actions.js"
click node_category_browse "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/app/(main)/recipes/category/%5Bcategory%5D/page.jsx"
click node_recipe_grid "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/components/RecipeGrid.jsx"
click node_saved_browse "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/app/(main)/recipes/page.jsx"
click node_recipe_actions "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/actions/recipe.actions.js"
click node_recipe_detail "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/app/(main)/recipe/page.jsx"
click node_recipe_pdf "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/components/RecipePDF.jsx"
click node_auth_middleware "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/middleware.js"
click node_user_helper "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/lib/checkUser.js"
click node_pricing "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/components/PricingSection.jsx"
click node_db "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/lib/db.js"
click node_models "https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/lib/models.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_landing,node_dashboard toneBlue
class node_pantry_page,node_pantry_modal,node_pantry_actions,node_pantry_suggestions toneAmber
class node_mealdb_actions,node_category_browse,node_recipe_grid,node_saved_browse,node_recipe_actions,node_recipe_detail,node_recipe_pdf toneMint
class node_auth_middleware,node_user_helper,node_pricing toneRose
class node_db,node_models,node_cook,node_mealdb,node_gemini,node_clerk toneIndigo
```

## Components

### User experience

- [Landing and pricing](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/app/page.jsx): `app/page.jsx`
- [Dashboard](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/app/(main)/dashboard/page.jsx): `app/(main)/dashboard/page.jsx`

### Pantry workflow

- [Pantry manager](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/app/(main)/pantry/page.jsx): `app/(main)/pantry/page.jsx`
- [Add ingredients](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/components/AddToPantryModal.jsx): `components/AddToPantryModal.jsx`
- [Pantry actions](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/actions/pantry.actions.js): `actions/pantry.actions.js`
- [Pantry suggestions](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/app/(main)/pantry/recipes/page.jsx): `app/(main)/pantry/recipes/page.jsx`

### Recipe discovery

- [MealDB browsing](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/actions/mealdb.actions.js): `actions/mealdb.actions.js`
- [Category and cuisine](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/app/(main)/recipes/category/%5Bcategory%5D/page.jsx): `app/(main)/recipes/category/[category]/page.jsx`
- [Recipe grid](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/components/RecipeGrid.jsx): `components/RecipeGrid.jsx`
- [Saved collection](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/app/(main)/recipes/page.jsx): `app/(main)/recipes/page.jsx`
- [Recipe actions](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/actions/recipe.actions.js): `actions/recipe.actions.js`
- [Recipe detail](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/app/(main)/recipe/page.jsx): `app/(main)/recipe/page.jsx`
- [PDF export](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/components/RecipePDF.jsx): `components/RecipePDF.jsx`

### Identity and plans

- [Route protection](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/middleware.js): `middleware.js`
- [User resolution](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/lib/checkUser.js): `lib/checkUser.js`
- [Plan checkout](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/components/PricingSection.jsx): `components/PricingSection.jsx`

### Data layer

- [Mongo connection](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/lib/db.js): `lib/db.js`
- [Domain models](https://github.com/utkarsh3904/chefnova---ai-recipe-platform/blob/main/lib/models.js): `lib/models.js`

### Other components

- **Home cook**
- **TheMealDB**
- **Google Gemini**
- **Clerk**

## Connections

- Home cook → Landing and pricing: visits (evidence: `app/page.jsx`)
- Landing and pricing → Plan checkout: renders (evidence: `app/page.jsx`)
- Home cook → Dashboard: opens
- Dashboard → MealDB browsing: loads meals (evidence: `app/(main)/dashboard/page.jsx`)
- MealDB browsing → TheMealDB: fetches meals (evidence: `README.md`)
- Category and cuisine → MealDB browsing: loads selections (evidence: `actions/mealdb.actions.js`)
- Category and cuisine → Recipe grid: renders (evidence: `app/(main)/recipes/category/[category]/page.jsx`)
- Recipe grid → MealDB browsing: fetches meals (evidence: `components/RecipeGrid.jsx`)
- Pantry manager → Add ingredients: opens (evidence: `components/AddToPantryModal.jsx`)
- Add ingredients → Pantry actions: submits items (evidence: `components/AddToPantryModal.jsx`)
- Pantry manager → Pantry actions: manages pantry (evidence: `app/(main)/pantry/page.jsx`)
- Pantry manager → Pantry suggestions: opens suggestions (evidence: `app/(main)/pantry/page.jsx`)
- Pantry suggestions → Recipe actions: requests suggestions (evidence: `app/(main)/pantry/recipes/page.jsx`)
- Pantry actions → User resolution: resolves user (evidence: `actions/pantry.actions.js`)
- Recipe actions → User resolution: resolves user (evidence: `actions/recipe.actions.js`)
- User resolution → Clerk: checks session (evidence: `lib/checkUser.js`)
- Route protection → Clerk: protects routes (evidence: `README.md`)
- User resolution → Mongo connection: connects (evidence: `lib/checkUser.js`)
- Mongo connection → Domain models: initializes (evidence: `lib/db.js`)
- Pantry actions → Mongo connection: reads and writes (evidence: `actions/pantry.actions.js`)
- Recipe actions → Mongo connection: reads and writes (evidence: `actions/recipe.actions.js`)
- Recipe actions → Google Gemini: generates recipes (evidence: `actions/recipe.actions.js`)
- Pantry actions → Google Gemini: scans ingredients (evidence: `README.md`)
- Saved collection → Recipe actions: loads collection (evidence: `app/(main)/recipes/page.jsx`)
- Recipe detail → Recipe actions: requests recipe (evidence: `app/(main)/recipe/page.jsx`)
- Recipe detail → PDF export: renders PDF (evidence: `app/(main)/recipe/page.jsx`)
- Home cook → Plan checkout: chooses plan (evidence: `README.md`)
- Plan checkout → Clerk: starts checkout (evidence: `README.md`)
