# muzammilalam231/bella-tavola architecture

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

- Interactive diagram: https://gitdiagram.com/muzammilalam231/bella-tavola
- Repository: https://github.com/muzammilalam231/bella-tavola

## Overview

Bella Tavola is a restaurant website backed by a FastAPI service. Visitors can browse menu information, submit reservations, and ask a restaurant-focused chat assistant; staff have menu and reservation management endpoints behind admin authentication. The service initializes its database and seeds the menu at startup, then serves the frontend and API. The excerpts show backend calls and routing, but not frontend request wiring, so frontend-to-API links are omitted.

Main entry points: [`app/main.py`](https://github.com/muzammilalam231/bella-tavola/blob/main/app/main.py) (FastAPI application), [`app/routers/reservations.py`](https://github.com/muzammilalam231/bella-tavola/blob/main/app/routers/reservations.py) (Reservation endpoints), [`app/routers/menu.py`](https://github.com/muzammilalam231/bella-tavola/blob/main/app/routers/menu.py) (Menu endpoints), [`app/routers/chat.py`](https://github.com/muzammilalam231/bella-tavola/blob/main/app/routers/chat.py) (Chat endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application and site"]
  node_service["FastAPI application<br/>[main.py]"]
  node_site["Restaurant website<br/>[index.html]"]
  node_admin_ui["Admin interface<br/>[admin.html]"]
  node_settings["Application settings<br/>[config.py]"]
  node_admin_api["Admin authentication endpoint<br/>[admin.py]"]
  node_security["Admin authentication<br/>[security.py]"]
  node_database[("Database sessions<br/>[database.py]")]
end

subgraph group_menu["Menu management"]
  node_menu_ui["Menu browser<br/>[app.js]"]
  node_menu_api["Menu endpoints<br/>[menu.py]"]
  node_menu_types["Menu validation<br/>[schemas.py]"]
  node_menu_records["Menu records<br/>[models.py]"]
  node_menu_seed["Starter menu data<br/>[data.py]"]
  node_seed_runner["Menu seeding<br/>[seed.py]"]
end

subgraph group_booking["Reservations"]
  node_reservations_ui["Reservation form<br/>[reservation.js]"]
  node_reservation_api["Reservation endpoints<br/>[reservations.py]"]
  node_reservation_types["Booking validation<br/>[schemas.py]"]
  node_booking_rules["Booking rules<br/>[rules.py]"]
  node_reservation_records["Reservation records<br/>[models.py]"]
end

subgraph group_assistant["Guest assistant"]
  node_chat_ui["Chat interface<br/>[chat.js]"]
  node_chat_api["Chat endpoint<br/>[chat.py]"]
  node_restaurant_facts["Restaurant facts<br/>[data.py]"]
  node_llm_client["Chat completion client<br/>[llm_p.py]"]
end

node_visitor(("Guest or staff"))
node_openrouter{{"OpenRouter"}}

node_service -->|"serves static files"| node_site
node_service -->|"mounts routes"| node_menu_api
node_service -->|"mounts routes"| node_reservation_api
node_service -->|"mounts routes"| node_chat_api
node_service -->|"mounts routes"| node_admin_api
node_service -->|"creates tables"| node_database
node_service -->|"runs at startup"| node_seed_runner
node_database -->|"reads configuration"| node_settings
node_menu_api -->|"validates payloads"| node_menu_types
node_menu_api -->|"queries and updates"| node_menu_records
node_menu_api -->|"uses sessions"| node_database
node_seed_runner -->|"loads seed data"| node_menu_seed
node_seed_runner -->|"creates records"| node_menu_records
node_reservation_api -->|"validates payloads"| node_reservation_types
node_reservation_types -->|"checks time rules"| node_booking_rules
node_reservation_api -->|"checks slot capacity"| node_booking_rules
node_reservation_api -->|"queries and updates"| node_reservation_records
node_reservation_api -->|"uses sessions"| node_database
node_chat_api -->|"builds prompt from"| node_restaurant_facts
node_chat_api -->|"reads available menu"| node_menu_records
node_chat_api -->|"requests completion"| node_llm_client
node_llm_client -->|"sends chat request"| node_openrouter
node_admin_api -->|"requires authentication"| node_security

click node_service "https://github.com/muzammilalam231/bella-tavola/blob/main/app/main.py"
click node_site "https://github.com/muzammilalam231/bella-tavola/blob/main/frontend/index.html"
click node_admin_ui "https://github.com/muzammilalam231/bella-tavola/blob/main/frontend/admin.html"
click node_settings "https://github.com/muzammilalam231/bella-tavola/blob/main/app/config.py"
click node_menu_ui "https://github.com/muzammilalam231/bella-tavola/blob/main/frontend/js/app.js"
click node_menu_api "https://github.com/muzammilalam231/bella-tavola/blob/main/app/routers/menu.py"
click node_menu_types "https://github.com/muzammilalam231/bella-tavola/blob/main/app/schemas.py"
click node_menu_records "https://github.com/muzammilalam231/bella-tavola/blob/main/app/models.py"
click node_menu_seed "https://github.com/muzammilalam231/bella-tavola/blob/main/app/data.py"
click node_seed_runner "https://github.com/muzammilalam231/bella-tavola/blob/main/app/seed.py"
click node_reservations_ui "https://github.com/muzammilalam231/bella-tavola/blob/main/frontend/js/reservation.js"
click node_reservation_api "https://github.com/muzammilalam231/bella-tavola/blob/main/app/routers/reservations.py"
click node_reservation_types "https://github.com/muzammilalam231/bella-tavola/blob/main/app/schemas.py"
click node_booking_rules "https://github.com/muzammilalam231/bella-tavola/blob/main/app/rules.py"
click node_reservation_records "https://github.com/muzammilalam231/bella-tavola/blob/main/app/models.py"
click node_chat_ui "https://github.com/muzammilalam231/bella-tavola/blob/main/frontend/js/chat.js"
click node_chat_api "https://github.com/muzammilalam231/bella-tavola/blob/main/app/routers/chat.py"
click node_restaurant_facts "https://github.com/muzammilalam231/bella-tavola/blob/main/app/data.py"
click node_llm_client "https://github.com/muzammilalam231/bella-tavola/blob/main/app/llm_p.py"
click node_admin_api "https://github.com/muzammilalam231/bella-tavola/blob/main/app/routers/admin.py"
click node_security "https://github.com/muzammilalam231/bella-tavola/blob/main/app/security.py"
click node_database "https://github.com/muzammilalam231/bella-tavola/blob/main/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_service,node_site,node_admin_ui,node_settings,node_admin_api,node_security,node_database toneBlue
class node_menu_ui,node_menu_api,node_menu_types,node_menu_records,node_menu_seed,node_seed_runner toneAmber
class node_reservations_ui,node_reservation_api,node_reservation_types,node_booking_rules,node_reservation_records,node_openrouter toneMint
class node_chat_ui,node_chat_api,node_restaurant_facts,node_llm_client toneRose
class node_visitor toneIndigo
```

## Components

### Application and site

- [FastAPI application](https://github.com/muzammilalam231/bella-tavola/blob/main/app/main.py): `app/main.py`
- [Restaurant website](https://github.com/muzammilalam231/bella-tavola/blob/main/frontend/index.html): `frontend/index.html`
- [Admin interface](https://github.com/muzammilalam231/bella-tavola/blob/main/frontend/admin.html): `frontend/admin.html`
- [Application settings](https://github.com/muzammilalam231/bella-tavola/blob/main/app/config.py): `app/config.py`
- [Admin authentication endpoint](https://github.com/muzammilalam231/bella-tavola/blob/main/app/routers/admin.py): `app/routers/admin.py`
- [Admin authentication](https://github.com/muzammilalam231/bella-tavola/blob/main/app/security.py): `app/security.py`
- [Database sessions](https://github.com/muzammilalam231/bella-tavola/blob/main/app/database.py): `app/database.py`

### Menu management

- [Menu browser](https://github.com/muzammilalam231/bella-tavola/blob/main/frontend/js/app.js): `frontend/js/app.js`
- [Menu endpoints](https://github.com/muzammilalam231/bella-tavola/blob/main/app/routers/menu.py): `app/routers/menu.py`
- [Menu validation](https://github.com/muzammilalam231/bella-tavola/blob/main/app/schemas.py): `app/schemas.py`
- [Menu records](https://github.com/muzammilalam231/bella-tavola/blob/main/app/models.py): `app/models.py`
- [Starter menu data](https://github.com/muzammilalam231/bella-tavola/blob/main/app/data.py): `app/data.py`
- [Menu seeding](https://github.com/muzammilalam231/bella-tavola/blob/main/app/seed.py): `app/seed.py`

### Reservations

- [Reservation form](https://github.com/muzammilalam231/bella-tavola/blob/main/frontend/js/reservation.js): `frontend/js/reservation.js`
- [Reservation endpoints](https://github.com/muzammilalam231/bella-tavola/blob/main/app/routers/reservations.py): `app/routers/reservations.py`
- [Booking validation](https://github.com/muzammilalam231/bella-tavola/blob/main/app/schemas.py): `app/schemas.py`
- [Booking rules](https://github.com/muzammilalam231/bella-tavola/blob/main/app/rules.py): `app/rules.py`
- [Reservation records](https://github.com/muzammilalam231/bella-tavola/blob/main/app/models.py): `app/models.py`

### Guest assistant

- [Chat interface](https://github.com/muzammilalam231/bella-tavola/blob/main/frontend/js/chat.js): `frontend/js/chat.js`
- [Chat endpoint](https://github.com/muzammilalam231/bella-tavola/blob/main/app/routers/chat.py): `app/routers/chat.py`
- [Restaurant facts](https://github.com/muzammilalam231/bella-tavola/blob/main/app/data.py): `app/data.py`
- [Chat completion client](https://github.com/muzammilalam231/bella-tavola/blob/main/app/llm_p.py): `app/llm_p.py`

### Other components

- **Guest or staff**
- **OpenRouter**

## Connections

- FastAPI application → Restaurant website: serves static files (evidence: `app/main.py`)
- FastAPI application → Menu endpoints: mounts routes (evidence: `app/main.py`)
- FastAPI application → Reservation endpoints: mounts routes (evidence: `app/main.py`)
- FastAPI application → Chat endpoint: mounts routes (evidence: `app/main.py`)
- FastAPI application → Admin authentication endpoint: mounts routes (evidence: `app/main.py`)
- FastAPI application → Database sessions: creates tables (evidence: `app/main.py`)
- FastAPI application → Menu seeding: runs at startup (evidence: `app/main.py`)
- Database sessions → Application settings: reads configuration (evidence: `app/database.py`)
- Menu endpoints → Menu validation: validates payloads (evidence: `app/routers/menu.py`)
- Menu endpoints → Menu records: queries and updates (evidence: `app/routers/menu.py`)
- Menu endpoints → Database sessions: uses sessions (evidence: `app/routers/menu.py`)
- Menu seeding → Starter menu data: loads seed data (evidence: `app/seed.py`)
- Menu seeding → Menu records: creates records (evidence: `app/seed.py`)
- Reservation endpoints → Booking validation: validates payloads (evidence: `app/routers/reservations.py`)
- Booking validation → Booking rules: checks time rules (evidence: `app/schemas.py`)
- Reservation endpoints → Booking rules: checks slot capacity (evidence: `app/routers/reservations.py`)
- Reservation endpoints → Reservation records: queries and updates (evidence: `app/routers/reservations.py`)
- Reservation endpoints → Database sessions: uses sessions (evidence: `app/routers/reservations.py`)
- Chat endpoint → Restaurant facts: builds prompt from (evidence: `app/routers/chat.py`)
- Chat endpoint → Menu records: reads available menu (evidence: `app/routers/chat.py`)
- Chat endpoint → Chat completion client: requests completion (evidence: `app/routers/chat.py`)
- Chat completion client → OpenRouter: sends chat request (evidence: `app/llm_p.py`)
- Admin authentication endpoint → Admin authentication: requires authentication (evidence: `app/routers/admin.py`)
