# nicolas-gls/recipe-website architecture

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

- Interactive diagram: https://gitdiagram.com/nicolas-gls/recipe-website
- Repository: https://github.com/nicolas-gls/recipe-website

## Overview

Recipe Hub serves a browser UI and JSON API for browsing/searching recipes, viewing serving-scaled details, and combining selected recipes into a priced shopping list. FastAPI routes delegate to catalog and shopping services, which read the SQLite recipe, ingredient, and supermarket-product data. Startup initializes the schema and seeds an empty database from JSON/CSV inputs. The README documents browser-local selection storage and uploaded recipe images. The graph follows shown route calls and database access; templates and local-storage behavior are included at the documented level, without inferring template internals.

Main entry points: [`app/main.py`](https://github.com/nicolas-gls/recipe-website/blob/main/app/main.py) (FastAPI web app), [`app/seed.py`](https://github.com/nicolas-gls/recipe-website/blob/main/app/seed.py) (Database seeding), [`app/database.py`](https://github.com/nicolas-gls/recipe-website/blob/main/app/database.py) (SQLite access and schema), [`app/catalog/services.py`](https://github.com/nicolas-gls/recipe-website/blob/main/app/catalog/services.py) (Recipe search and details)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_app_entry["Server launcher<br/>[app.py]"]
  node_web_app["FastAPI web app<br/>[main.py]"]
  node_web_pages["Rendered pages"]
end

subgraph group_catalog["Recipe catalog"]
  node_catalog_routes["Catalog API routes<br/>[routes.py]"]
  node_catalog_models["Catalog schemas<br/>[models.py]"]
  node_catalog_service["Recipe search and details<br/>[services.py]"]
end

subgraph group_shopping["Shopping calculation"]
  node_shopping_routes["Shopping API route<br/>[routes.py]"]
  node_shopping_models["Shopping schemas<br/>[models.py]"]
  node_shopping_service["Aggregation and pricing<br/>[services.py]"]
end

subgraph group_data["Persistence and setup"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_database[("SQLite access and schema<br/>[database.py]")]
  node_seed["Database seeding<br/>[seed.py]"]
  node_recipe_source["Recipe source data<br/>[recipes.json]"]
  node_product_source["Product and price data"]
end

node_visitor(("Browser user"))

node_visitor -->|"starts app"| node_app_entry
node_app_entry -->|"runs server"| node_web_app
node_visitor -->|"uses web/API"| node_web_app
node_web_app -->|"mounts router"| node_catalog_routes
node_web_app -->|"mounts router"| node_shopping_routes
node_web_app -->|"calls services"| node_catalog_service
node_web_app -->|"calls service"| node_shopping_service
node_web_app -->|"renders pages"| node_web_pages
node_web_app -->|"checks database"| node_database
node_web_app -->|"seeds if empty"| node_seed
node_catalog_routes -->|"delegates"| node_catalog_service
node_catalog_routes -->|"validates as"| node_catalog_models
node_catalog_service -->|"builds responses"| node_catalog_models
node_catalog_service -->|"queries recipes"| node_database
node_shopping_routes -->|"delegates"| node_shopping_service
node_shopping_routes -->|"accepts and returns"| node_shopping_models
node_shopping_service -->|"builds results"| node_shopping_models
node_shopping_service -->|"queries ingredients and products"| node_database
node_database -->|"uses database path"| node_config
node_seed -->|"resets and populates"| node_database
node_seed -->|"reads source paths"| node_config
node_seed -->|"loads recipes"| node_recipe_source
node_seed -->|"loads products"| node_product_source

click node_app_entry "https://github.com/nicolas-gls/recipe-website/blob/main/app.py"
click node_web_app "https://github.com/nicolas-gls/recipe-website/blob/main/app/main.py"
click node_web_pages "https://github.com/nicolas-gls/recipe-website/tree/main/app/templates"
click node_config "https://github.com/nicolas-gls/recipe-website/blob/main/app/config.py"
click node_catalog_routes "https://github.com/nicolas-gls/recipe-website/blob/main/app/catalog/routes.py"
click node_catalog_models "https://github.com/nicolas-gls/recipe-website/blob/main/app/catalog/models.py"
click node_catalog_service "https://github.com/nicolas-gls/recipe-website/blob/main/app/catalog/services.py"
click node_shopping_routes "https://github.com/nicolas-gls/recipe-website/blob/main/app/shopping/routes.py"
click node_shopping_models "https://github.com/nicolas-gls/recipe-website/blob/main/app/shopping/models.py"
click node_shopping_service "https://github.com/nicolas-gls/recipe-website/blob/main/app/shopping/services.py"
click node_database "https://github.com/nicolas-gls/recipe-website/blob/main/app/database.py"
click node_seed "https://github.com/nicolas-gls/recipe-website/blob/main/app/seed.py"
click node_recipe_source "https://github.com/nicolas-gls/recipe-website/blob/main/data/recipes.json"
click node_product_source "https://github.com/nicolas-gls/recipe-website/blob/main/data/supermarket_products.csv"

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_entry,node_web_app,node_web_pages,node_visitor toneBlue
class node_catalog_routes,node_catalog_models,node_catalog_service toneAmber
class node_shopping_routes,node_shopping_models,node_shopping_service toneMint
class node_config,node_database,node_seed,node_recipe_source,node_product_source toneRose
```

## Components

### Web interface

- [Server launcher](https://github.com/nicolas-gls/recipe-website/blob/main/app.py): `app.py`
- [FastAPI web app](https://github.com/nicolas-gls/recipe-website/blob/main/app/main.py): `app/main.py`
- [Rendered pages](https://github.com/nicolas-gls/recipe-website/tree/main/app/templates): `app/templates`

### Recipe catalog

- [Catalog API routes](https://github.com/nicolas-gls/recipe-website/blob/main/app/catalog/routes.py): `app/catalog/routes.py`
- [Catalog schemas](https://github.com/nicolas-gls/recipe-website/blob/main/app/catalog/models.py): `app/catalog/models.py`
- [Recipe search and details](https://github.com/nicolas-gls/recipe-website/blob/main/app/catalog/services.py): `app/catalog/services.py`

### Shopping calculation

- [Shopping API route](https://github.com/nicolas-gls/recipe-website/blob/main/app/shopping/routes.py): `app/shopping/routes.py`
- [Shopping schemas](https://github.com/nicolas-gls/recipe-website/blob/main/app/shopping/models.py): `app/shopping/models.py`
- [Aggregation and pricing](https://github.com/nicolas-gls/recipe-website/blob/main/app/shopping/services.py): `app/shopping/services.py`

### Persistence and setup

- [Runtime configuration](https://github.com/nicolas-gls/recipe-website/blob/main/app/config.py): `app/config.py`
- [SQLite access and schema](https://github.com/nicolas-gls/recipe-website/blob/main/app/database.py): `app/database.py`
- [Database seeding](https://github.com/nicolas-gls/recipe-website/blob/main/app/seed.py): `app/seed.py`
- [Recipe source data](https://github.com/nicolas-gls/recipe-website/blob/main/data/recipes.json): `data/recipes.json`
- [Product and price data](https://github.com/nicolas-gls/recipe-website/blob/main/data/supermarket_products.csv): `data/supermarket_products.csv`

### Other components

- **Browser user**

## Connections

- Browser user → Server launcher: starts app (evidence: `README.md`)
- Server launcher → FastAPI web app: runs server (evidence: `app.py`)
- Browser user → FastAPI web app: uses web/API (evidence: `README.md`)
- FastAPI web app → Catalog API routes: mounts router (evidence: `app/main.py`)
- FastAPI web app → Shopping API route: mounts router (evidence: `app/main.py`)
- FastAPI web app → Recipe search and details: calls services (evidence: `app/main.py`)
- FastAPI web app → Aggregation and pricing: calls service (evidence: `app/main.py`)
- FastAPI web app → Rendered pages: renders pages (evidence: `app/main.py`)
- FastAPI web app → SQLite access and schema: checks database (evidence: `app/main.py`)
- FastAPI web app → Database seeding: seeds if empty (evidence: `app/main.py`)
- Catalog API routes → Recipe search and details: delegates (evidence: `app/catalog/routes.py`)
- Catalog API routes → Catalog schemas: validates as (evidence: `app/catalog/routes.py`)
- Recipe search and details → Catalog schemas: builds responses (evidence: `app/catalog/services.py`)
- Recipe search and details → SQLite access and schema: queries recipes (evidence: `app/catalog/services.py`)
- Shopping API route → Aggregation and pricing: delegates (evidence: `app/shopping/routes.py`)
- Shopping API route → Shopping schemas: accepts and returns (evidence: `app/shopping/routes.py`)
- Aggregation and pricing → Shopping schemas: builds results (evidence: `app/shopping/services.py`)
- Aggregation and pricing → SQLite access and schema: queries ingredients and products (evidence: `app/shopping/services.py`)
- SQLite access and schema → Runtime configuration: uses database path (evidence: `app/database.py`)
- Database seeding → SQLite access and schema: resets and populates (evidence: `app/seed.py`)
- Database seeding → Runtime configuration: reads source paths (evidence: `app/seed.py`)
- Database seeding → Recipe source data: loads recipes (evidence: `app/seed.py`)
- Database seeding → Product and price data: loads products (evidence: `app/seed.py`)
