# nawaz-builds/pantry-chef architecture

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

- Interactive diagram: https://gitdiagram.com/nawaz-builds/pantry-chef
- Repository: https://github.com/nawaz-builds/pantry-chef

## Overview

PantryChef lets a cook upload an ingredient photo, set dietary and cooking preferences, and receive AI-generated recipes; signed-in users can save and manage recipes. The frontend handles authentication and recipe workflows through HTTP helpers, while FastAPI owns the endpoints, calls the AI provider for ingredient detection and recipe generation, and persists accounts, sessions, and saved recipes through SQLAlchemy. The excerpts establish these major paths, but do not show the complete generation response handling or all backend helper details.

Main entry points: [`src/app/app.py`](https://github.com/nawaz-builds/pantry-chef/blob/main/src/app/app.py) (FastAPI endpoints), [`frontend/src/App.jsx`](https://github.com/nawaz-builds/pantry-chef/blob/main/frontend/src/App.jsx) (Recipe workspace), [`frontend/src/api.js`](https://github.com/nawaz-builds/pantry-chef/blob/main/frontend/src/api.js) (HTTP client), [`frontend/src/login.jsx`](https://github.com/nawaz-builds/pantry-chef/blob/main/frontend/src/login.jsx) (Login and signup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web["Recipe workspace<br/>[App.jsx]"]
  node_authview["Login and signup<br/>[login.jsx]"]
  node_http["HTTP client<br/>[api.js]"]
end

subgraph group_service["API service"]
  node_api["FastAPI endpoints<br/>[app.py]"]
  node_models["Recipe schemas<br/>[schemas.py]"]
  node_vision["Ingredient detection<br/>[app.py]"]
  node_recipegen["Recipe generation<br/>[app.py]"]
end

subgraph group_persistence["Persistence and auth"]
  node_security["Password hashing<br/>[security.py]"]
  node_dbaccess["Database session and models<br/>[database.py]"]
  node_store[("Relational database")]
end

node_cook(("Cook"))
node_ai{{"Groq AI service"}}

node_cook -->|"submits preferences"| node_web
node_web -->|"renders when signed out"| node_authview
node_authview -->|"requests authentication"| node_http
node_web -->|"requests recipes and saved items"| node_http
node_http -->|"sends HTTP requests"| node_api
node_api -->|"handles recipe upload"| node_vision
node_vision -->|"detects ingredients"| node_ai
node_api -->|"generates recipes"| node_recipegen
node_recipegen -->|"requests recipes"| node_ai
node_api -->|"uses response schemas"| node_models
node_api -->|"hashes and verifies passwords"| node_security
node_api -->|"queries accounts and recipes"| node_dbaccess
node_dbaccess -.->|"persists records"| node_store

click node_web "https://github.com/nawaz-builds/pantry-chef/blob/main/frontend/src/App.jsx"
click node_authview "https://github.com/nawaz-builds/pantry-chef/blob/main/frontend/src/login.jsx"
click node_http "https://github.com/nawaz-builds/pantry-chef/blob/main/frontend/src/api.js"
click node_api "https://github.com/nawaz-builds/pantry-chef/blob/main/src/app/app.py"
click node_models "https://github.com/nawaz-builds/pantry-chef/blob/main/src/app/schemas.py"
click node_vision "https://github.com/nawaz-builds/pantry-chef/blob/main/src/app/app.py"
click node_recipegen "https://github.com/nawaz-builds/pantry-chef/blob/main/src/app/app.py"
click node_security "https://github.com/nawaz-builds/pantry-chef/blob/main/src/app/security.py"
click node_dbaccess "https://github.com/nawaz-builds/pantry-chef/blob/main/src/app/database.py"

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_web,node_authview,node_http toneBlue
class node_api,node_models,node_vision,node_recipegen toneAmber
class node_security,node_dbaccess,node_store toneMint
class node_cook,node_ai toneIndigo
```

## Components

### Web client

- [Recipe workspace](https://github.com/nawaz-builds/pantry-chef/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login and signup](https://github.com/nawaz-builds/pantry-chef/blob/main/frontend/src/login.jsx): `frontend/src/login.jsx`
- [HTTP client](https://github.com/nawaz-builds/pantry-chef/blob/main/frontend/src/api.js): `frontend/src/api.js`

### API service

- [FastAPI endpoints](https://github.com/nawaz-builds/pantry-chef/blob/main/src/app/app.py): `src/app/app.py`
- [Recipe schemas](https://github.com/nawaz-builds/pantry-chef/blob/main/src/app/schemas.py): `src/app/schemas.py`
- [Ingredient detection](https://github.com/nawaz-builds/pantry-chef/blob/main/src/app/app.py): `src/app/app.py`
- [Recipe generation](https://github.com/nawaz-builds/pantry-chef/blob/main/src/app/app.py): `src/app/app.py`

### Persistence and auth

- [Password hashing](https://github.com/nawaz-builds/pantry-chef/blob/main/src/app/security.py): `src/app/security.py`
- [Database session and models](https://github.com/nawaz-builds/pantry-chef/blob/main/src/app/database.py): `src/app/database.py`
- **Relational database**

### Other components

- **Cook**
- **Groq AI service**

## Connections

- Cook → Recipe workspace: submits preferences (evidence: `frontend/src/App.jsx`)
- Recipe workspace → Login and signup: renders when signed out (evidence: `frontend/src/App.jsx`)
- Login and signup → HTTP client: requests authentication (evidence: `frontend/src/login.jsx`)
- Recipe workspace → HTTP client: requests recipes and saved items (evidence: `frontend/src/App.jsx`)
- HTTP client → FastAPI endpoints: sends HTTP requests (evidence: `frontend/src/api.js`)
- FastAPI endpoints → Ingredient detection: handles recipe upload (evidence: `src/app/app.py`)
- Ingredient detection → Groq AI service: detects ingredients (evidence: `src/app/app.py`)
- FastAPI endpoints → Recipe generation: generates recipes (evidence: `src/app/app.py`)
- Recipe generation → Groq AI service: requests recipes (evidence: `src/app/app.py`)
- FastAPI endpoints → Recipe schemas: uses response schemas (evidence: `src/app/app.py`)
- FastAPI endpoints → Password hashing: hashes and verifies passwords (evidence: `src/app/app.py`)
- FastAPI endpoints → Database session and models: queries accounts and recipes (evidence: `src/app/app.py`)
- Database session and models → Relational database: persists records
