# princeg0210/cafe-server architecture

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

- Interactive diagram: https://gitdiagram.com/princeg0210/cafe-server
- Repository: https://github.com/princeg0210/cafe-server

## Overview

Jaadoo Udaipur Cafe is a café operations platform spanning public table booking, staff POS, kitchen dispatch, reservations, and capacity-aware production. The principal workflow is a customer or staff member using the web app, with backend API routes handling the request and domain services managing reservations, orders, tables, and kitchen work. The source index documents service dependencies and core data models, but the README is empty and most route implementations were not sampled; frontend-to-API and route-to-service links are therefore shown as unverified where useful.

Main entry points: [`backend/app/services/order_service.py`](https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/order_service.py) (Order service), [`backend/app/api/v1`](https://github.com/princeg0210/cafe-server/tree/main/backend/app/api/v1) (Versioned routes), [`backend/app/services/reservation_service.py`](https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/reservation_service.py) (Reservation service), [`backend/app/services/pos_service.py`](https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/pos_service.py) (POS sessions and KOT)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experiences"]
  node_web_booking["Table booking<br/>[page.tsx]"]
  node_web_menu["Menu browsing<br/>[page.tsx]"]
  node_web_table["QR table ordering<br/>[page.tsx]"]
  node_web_pos["Staff POS<br/>[page.tsx]"]
end

subgraph group_api["API entrypoints"]
  node_api_app["API application<br/>[main.py]"]
  node_api_routes["Versioned routes"]
  node_api_ws["Live updates<br/>[websocket.py]"]
end

subgraph group_operations["Café operations"]
  node_reservations["Reservation service"]
  node_capacity["Production capacity"]
  node_tables["Table service<br/>[table_service.py]"]
  node_orders["Order service<br/>[order_service.py]"]
  node_pos_ops["POS sessions and KOT<br/>[pos_service.py]"]
  node_inventory["Inventory service"]
  node_billing["Billing service<br/>[billing_service.py]"]
  node_workers["Background tasks<br/>[celery_app.py]"]
end

subgraph group_data["Persistence and runtime"]
  node_models_res["Reservation records<br/>[reservation.py]"]
  node_models_table["Table and sessions<br/>[table.py]"]
  node_models_kitchen["Kitchen and print jobs<br/>[kitchen.py]"]
  node_database[("Relational database<br/>[database.py]")]
  node_config["Runtime configuration<br/>[config.py]"]
end

node_customer(("Customer"))
node_staff(("Café staff"))
node_printer["Kitchen printer"]

node_customer -->|"books tables"| node_web_booking
node_customer -->|"views menu"| node_web_menu
node_customer -.->|"orders at table"| node_web_table
node_staff -->|"operates POS"| node_web_pos
node_web_booking -.->|"submits booking"| node_api_routes
node_web_table -.->|"requests service"| node_api_routes
node_web_pos -.->|"manages service"| node_api_routes
node_api_app -->|"mounts routes"| node_api_routes
node_api_app -->|"registers socket"| node_api_ws
node_api_routes -.->|"handles reservations"| node_reservations
node_api_routes -.->|"handles orders"| node_orders
node_api_routes -.->|"handles POS"| node_pos_ops
node_reservations -->|"checks capacity"| node_capacity
node_reservations -->|"assigns tables"| node_tables
node_orders -->|"uses table service"| node_tables
node_orders -->|"checks capacity"| node_capacity
node_orders -->|"uses inventory"| node_inventory
node_orders -->|"creates kitchen work"| node_models_kitchen
node_orders -->|"publishes updates"| node_api_ws
node_orders -->|"dispatches tasks"| node_workers
node_pos_ops -->|"uses billing"| node_billing
node_pos_ops -->|"publishes updates"| node_api_ws
node_pos_ops -->|"dispatches tasks"| node_workers
node_workers -->|"sends print job"| node_printer
node_reservations -->|"reads and writes"| node_models_res
node_capacity -->|"reads reservations"| node_models_res
node_tables -->|"reads and writes"| node_models_table
node_models_res -->|"maps records"| node_database
node_models_table -->|"maps records"| node_database
node_models_kitchen -->|"maps records"| node_database
node_api_app -->|"loads settings"| node_config
node_database -->|"configures connection"| node_config

click node_web_booking "https://github.com/princeg0210/cafe-server/blob/main/frontend/src/app/book-table/page.tsx"
click node_web_menu "https://github.com/princeg0210/cafe-server/blob/main/frontend/src/app/menu/page.tsx"
click node_web_table "https://github.com/princeg0210/cafe-server/blob/main/frontend/src/app/table/%5Btoken%5D/page.tsx"
click node_web_pos "https://github.com/princeg0210/cafe-server/blob/main/frontend/src/app/pos/page.tsx"
click node_api_app "https://github.com/princeg0210/cafe-server/blob/main/backend/app/main.py"
click node_api_routes "https://github.com/princeg0210/cafe-server/tree/main/backend/app/api/v1"
click node_api_ws "https://github.com/princeg0210/cafe-server/blob/main/backend/app/api/websocket.py"
click node_reservations "https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/reservation_service.py"
click node_capacity "https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/capacity_service.py"
click node_tables "https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/table_service.py"
click node_orders "https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/order_service.py"
click node_pos_ops "https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/pos_service.py"
click node_inventory "https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/inventory_service.py"
click node_billing "https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/billing_service.py"
click node_workers "https://github.com/princeg0210/cafe-server/blob/main/backend/app/workers/celery_app.py"
click node_models_res "https://github.com/princeg0210/cafe-server/blob/main/backend/app/models/reservation.py"
click node_models_table "https://github.com/princeg0210/cafe-server/blob/main/backend/app/models/table.py"
click node_models_kitchen "https://github.com/princeg0210/cafe-server/blob/main/backend/app/models/kitchen.py"
click node_database "https://github.com/princeg0210/cafe-server/blob/main/backend/app/core/database.py"
click node_config "https://github.com/princeg0210/cafe-server/blob/main/backend/app/core/config.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_booking,node_web_menu,node_web_table,node_web_pos toneBlue
class node_api_app,node_api_routes,node_api_ws toneAmber
class node_reservations,node_capacity,node_tables,node_orders,node_pos_ops,node_inventory,node_billing,node_workers toneMint
class node_models_res,node_models_table,node_models_kitchen,node_database,node_config toneRose
class node_customer,node_staff,node_printer toneIndigo
```

## Components

### Web experiences

- [Table booking](https://github.com/princeg0210/cafe-server/blob/main/frontend/src/app/book-table/page.tsx): `frontend/src/app/book-table/page.tsx`
- [Menu browsing](https://github.com/princeg0210/cafe-server/blob/main/frontend/src/app/menu/page.tsx): `frontend/src/app/menu/page.tsx`
- [QR table ordering](https://github.com/princeg0210/cafe-server/blob/main/frontend/src/app/table/%5Btoken%5D/page.tsx): `frontend/src/app/table/[token]/page.tsx`
- [Staff POS](https://github.com/princeg0210/cafe-server/blob/main/frontend/src/app/pos/page.tsx): `frontend/src/app/pos/page.tsx`

### API entrypoints

- [API application](https://github.com/princeg0210/cafe-server/blob/main/backend/app/main.py): `backend/app/main.py`
- [Versioned routes](https://github.com/princeg0210/cafe-server/tree/main/backend/app/api/v1): `backend/app/api/v1`
- [Live updates](https://github.com/princeg0210/cafe-server/blob/main/backend/app/api/websocket.py): `backend/app/api/websocket.py`

### Café operations

- [Reservation service](https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/reservation_service.py): `backend/app/services/reservation_service.py`
- [Production capacity](https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/capacity_service.py): `backend/app/services/capacity_service.py`
- [Table service](https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/table_service.py): `backend/app/services/table_service.py`
- [Order service](https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/order_service.py): `backend/app/services/order_service.py`
- [POS sessions and KOT](https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/pos_service.py): `backend/app/services/pos_service.py`
- [Inventory service](https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/inventory_service.py): `backend/app/services/inventory_service.py`
- [Billing service](https://github.com/princeg0210/cafe-server/blob/main/backend/app/services/billing_service.py): `backend/app/services/billing_service.py`
- [Background tasks](https://github.com/princeg0210/cafe-server/blob/main/backend/app/workers/celery_app.py): `backend/app/workers/celery_app.py`

### Persistence and runtime

- [Reservation records](https://github.com/princeg0210/cafe-server/blob/main/backend/app/models/reservation.py): `backend/app/models/reservation.py`
- [Table and sessions](https://github.com/princeg0210/cafe-server/blob/main/backend/app/models/table.py): `backend/app/models/table.py`
- [Kitchen and print jobs](https://github.com/princeg0210/cafe-server/blob/main/backend/app/models/kitchen.py): `backend/app/models/kitchen.py`
- [Relational database](https://github.com/princeg0210/cafe-server/blob/main/backend/app/core/database.py): `backend/app/core/database.py`
- [Runtime configuration](https://github.com/princeg0210/cafe-server/blob/main/backend/app/core/config.py): `backend/app/core/config.py`

### Other components

- **Customer**
- **Café staff**
- **Kitchen printer**

## Connections

- Customer → Table booking: books tables (evidence: `frontend/src/app/book-table/page.tsx`)
- Customer → Menu browsing: views menu (evidence: `frontend/src/app/menu/page.tsx`)
- Customer → QR table ordering: orders at table
- Café staff → Staff POS: operates POS (evidence: `frontend/src/app/pos/page.tsx`)
- Table booking → Versioned routes: submits booking
- QR table ordering → Versioned routes: requests service
- Staff POS → Versioned routes: manages service
- API application → Versioned routes: mounts routes (evidence: `backend/app/main.py`)
- API application → Live updates: registers socket (evidence: `backend/app/main.py`)
- Versioned routes → Reservation service: handles reservations
- Versioned routes → Order service: handles orders
- Versioned routes → POS sessions and KOT: handles POS
- Reservation service → Production capacity: checks capacity (evidence: `backend/app/services/reservation_service.py`)
- Reservation service → Table service: assigns tables (evidence: `backend/app/services/reservation_service.py`)
- Order service → Table service: uses table service (evidence: `backend/app/services/order_service.py`)
- Order service → Production capacity: checks capacity (evidence: `backend/app/services/order_service.py`)
- Order service → Inventory service: uses inventory (evidence: `backend/app/services/order_service.py`)
- Order service → Kitchen and print jobs: creates kitchen work (evidence: `backend/app/services/order_service.py`)
- Order service → Live updates: publishes updates (evidence: `backend/app/services/order_service.py`)
- Order service → Background tasks: dispatches tasks (evidence: `backend/app/services/order_service.py`)
- POS sessions and KOT → Billing service: uses billing (evidence: `backend/app/services/pos_service.py`)
- POS sessions and KOT → Live updates: publishes updates (evidence: `backend/app/services/pos_service.py`)
- POS sessions and KOT → Background tasks: dispatches tasks (evidence: `backend/app/services/pos_service.py`)
- Background tasks → Kitchen printer: sends print job (evidence: `backend/app/workers/celery_app.py`)
- Reservation service → Reservation records: reads and writes (evidence: `backend/app/services/reservation_service.py`)
- Production capacity → Reservation records: reads reservations (evidence: `backend/app/services/capacity_service.py`)
- Table service → Table and sessions: reads and writes (evidence: `backend/app/services/table_service.py`)
- Reservation records → Relational database: maps records (evidence: `backend/app/models/reservation.py`)
- Table and sessions → Relational database: maps records (evidence: `backend/app/models/table.py`)
- Kitchen and print jobs → Relational database: maps records (evidence: `backend/app/models/kitchen.py`)
- API application → Runtime configuration: loads settings (evidence: `backend/app/main.py`)
- Relational database → Runtime configuration: configures connection (evidence: `backend/app/core/database.py`)
