# adefilippo83/fooddesk architecture

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

- Interactive diagram: https://gitdiagram.com/adefilippo83/fooddesk
- Repository: https://github.com/adefilippo83/fooddesk

## Overview

FoodDesk is a venue-local ordering and service system. Staff or guests create orders; the server records them, handles payment where applicable, and exposes order progress to the kitchen and customer. Staff can manage the menu and users, while managers review reports and configure documents. The README documents printing, live updates, online payments, and reporting; several route implementations were not sampled, so those capability links rely on the README rather than inspected route code.

Main entry points: [`server/src/app.ts`](https://github.com/adefilippo83/fooddesk/blob/main/server/src/app.ts) (API server), [`server/src/db/schema.ts`](https://github.com/adefilippo83/fooddesk/blob/main/server/src/db/schema.ts) (SQLite database), [`web/src/App.tsx`](https://github.com/adefilippo83/fooddesk/blob/main/web/src/App.tsx) (Web app), [`server/src/payments/lifecycle.ts`](https://github.com/adefilippo83/fooddesk/blob/main/server/src/payments/lifecycle.ts) (Payment lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_web_app["Web app<br/>[App.tsx]"]
  node_new_order["Staff ordering<br/>[NewOrder.tsx]"]
  node_guest_order["Guest ordering<br/>[CustomerOrder.tsx]"]
  node_customer_status["Order status<br/>[CustomerStatus.tsx]"]
  node_kitchen_view["Kitchen display<br/>[Kitchen.tsx]"]
  node_orders_view["Order management<br/>[Orders.tsx]"]
  node_admin_menu["Menu management<br/>[AdminMenu.tsx]"]
  node_reports_view["Reports UI<br/>[Reports.tsx]"]
  node_settings_view["Settings UI<br/>[Settings.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_orders["Ordering and service"]
  node_order_routes["Order handling<br/>[orders.ts]"]
  node_public_routes["Public ordering<br/>[public.ts]"]
  node_order_placement["Order placement<br/>[placeOrder.ts]"]
  node_payment_lifecycle["Payment lifecycle<br/>[lifecycle.ts]"]
  node_providers["Payment providers<br/>[provider.ts]"]
  node_kitchen_routes["Kitchen operations<br/>[kitchen.ts]"]
  node_event_stream["Live order events<br/>[sse.ts]"]
  node_service_day["Service-day rules<br/>[serviceDay.ts]"]
end

subgraph group_operations["Venue operations"]
  node_report_routes["Reporting<br/>[reports.ts]"]
  node_menu_routes["Menu service<br/>[menu.ts]"]
  node_user_routes["Staff management<br/>[users.ts]"]
  node_settings_routes["Venue settings<br/>[settings.ts]"]
  node_print_service["Ticket printing<br/>[service.ts]"]
  node_pdf["PDF rendering<br/>[pdf.ts]"]
end

subgraph group_foundation["Server foundation"]
  node_app_server["API server<br/>[app.ts]"]
  node_auth_routes["Authentication<br/>[auth.ts]"]
  node_database[("SQLite database<br/>[schema.ts]")]
end

node_waiter(("Waiter"))
node_guest(("Guest"))
node_manager(("Manager"))
node_kitchen_staff(("Kitchen staff"))
node_printer["CUPS printer"]

node_waiter -->|"places orders"| node_new_order
node_guest -->|"self-orders"| node_guest_order
node_manager -->|"manages venue"| node_web_app
node_kitchen_staff -->|"prepares dishes"| node_kitchen_view
node_web_app -->|"routes to"| node_new_order
node_web_app -->|"routes to"| node_guest_order
node_web_app -->|"routes to"| node_customer_status
node_web_app -->|"routes to"| node_kitchen_view
node_new_order -->|"requests API"| node_api_client
node_orders_view -->|"requests API"| node_api_client
node_admin_menu -->|"requests API"| node_api_client
node_settings_view -->|"requests API"| node_api_client
node_api_client -.->|"calls API"| node_app_server
node_app_server -->|"registers"| node_auth_routes
node_app_server -->|"registers"| node_order_routes
node_app_server -->|"registers"| node_public_routes
node_app_server -->|"registers"| node_kitchen_routes
node_app_server -->|"registers"| node_menu_routes
node_app_server -->|"registers"| node_report_routes
node_app_server -->|"registers"| node_settings_routes
node_app_server -->|"registers"| node_user_routes
node_auth_routes -->|"reads/writes"| node_database
node_order_routes -->|"uses"| node_order_placement
node_order_routes -->|"uses"| node_payment_lifecycle
node_public_routes -->|"uses"| node_order_placement
node_public_routes -->|"uses"| node_payment_lifecycle
node_payment_lifecycle -->|"verifies/refunds"| node_providers
node_payment_lifecycle -->|"prints ticket"| node_print_service
node_payment_lifecycle -->|"updates orders"| node_database
node_order_routes -->|"uses day rules"| node_service_day
node_app_server -->|"opens stream"| node_event_stream
node_print_service -->|"renders ticket"| node_pdf
node_print_service -->|"sends ticket"| node_printer
node_print_service -->|"records print state"| node_database
node_report_routes -.->|"reads report data"| node_database
node_menu_routes -.->|"manages menu"| node_database
node_user_routes -.->|"manages staff"| node_database
node_settings_routes -.->|"stores settings"| node_database
node_guest -->|"tracks order"| node_customer_status
node_kitchen_view -.->|"receives live updates"| node_event_stream
node_manager -->|"reviews totals"| node_reports_view
node_manager -->|"edits menu"| node_admin_menu
node_manager -->|"configures venue"| node_settings_view

click node_web_app "https://github.com/adefilippo83/fooddesk/blob/main/web/src/App.tsx"
click node_new_order "https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/NewOrder.tsx"
click node_guest_order "https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/CustomerOrder.tsx"
click node_customer_status "https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/CustomerStatus.tsx"
click node_kitchen_view "https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/Kitchen.tsx"
click node_orders_view "https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/Orders.tsx"
click node_admin_menu "https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/AdminMenu.tsx"
click node_reports_view "https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/Reports.tsx"
click node_settings_view "https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/Settings.tsx"
click node_api_client "https://github.com/adefilippo83/fooddesk/blob/main/web/src/api.ts"
click node_app_server "https://github.com/adefilippo83/fooddesk/blob/main/server/src/app.ts"
click node_auth_routes "https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/auth.ts"
click node_order_routes "https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/orders.ts"
click node_public_routes "https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/public.ts"
click node_order_placement "https://github.com/adefilippo83/fooddesk/blob/main/server/src/lib/placeOrder.ts"
click node_payment_lifecycle "https://github.com/adefilippo83/fooddesk/blob/main/server/src/payments/lifecycle.ts"
click node_providers "https://github.com/adefilippo83/fooddesk/blob/main/server/src/payments/provider.ts"
click node_kitchen_routes "https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/kitchen.ts"
click node_event_stream "https://github.com/adefilippo83/fooddesk/blob/main/server/src/lib/sse.ts"
click node_report_routes "https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/reports.ts"
click node_menu_routes "https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/menu.ts"
click node_user_routes "https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/users.ts"
click node_settings_routes "https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/settings.ts"
click node_print_service "https://github.com/adefilippo83/fooddesk/blob/main/server/src/print/service.ts"
click node_pdf "https://github.com/adefilippo83/fooddesk/blob/main/server/src/print/pdf.ts"
click node_database "https://github.com/adefilippo83/fooddesk/blob/main/server/src/db/schema.ts"
click node_service_day "https://github.com/adefilippo83/fooddesk/blob/main/server/src/lib/serviceDay.ts"

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_app,node_new_order,node_guest_order,node_customer_status,node_kitchen_view,node_orders_view,node_admin_menu,node_reports_view,node_settings_view,node_api_client toneBlue
class node_order_routes,node_public_routes,node_order_placement,node_payment_lifecycle,node_providers,node_kitchen_routes,node_event_stream,node_service_day toneAmber
class node_report_routes,node_menu_routes,node_user_routes,node_settings_routes,node_print_service,node_pdf toneMint
class node_app_server,node_auth_routes,node_database toneRose
class node_waiter,node_guest,node_manager,node_kitchen_staff,node_printer toneIndigo
```

## Components

### Web experience

- [Web app](https://github.com/adefilippo83/fooddesk/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Staff ordering](https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/NewOrder.tsx): `web/src/pages/NewOrder.tsx`
- [Guest ordering](https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/CustomerOrder.tsx): `web/src/pages/CustomerOrder.tsx`
- [Order status](https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/CustomerStatus.tsx): `web/src/pages/CustomerStatus.tsx`
- [Kitchen display](https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/Kitchen.tsx): `web/src/pages/Kitchen.tsx`
- [Order management](https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/Orders.tsx): `web/src/pages/Orders.tsx`
- [Menu management](https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/AdminMenu.tsx): `web/src/pages/AdminMenu.tsx`
- [Reports UI](https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/Reports.tsx): `web/src/pages/Reports.tsx`
- [Settings UI](https://github.com/adefilippo83/fooddesk/blob/main/web/src/pages/Settings.tsx): `web/src/pages/Settings.tsx`
- [API client](https://github.com/adefilippo83/fooddesk/blob/main/web/src/api.ts): `web/src/api.ts`

### Ordering and service

- [Order handling](https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/orders.ts): `server/src/routes/orders.ts`
- [Public ordering](https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/public.ts): `server/src/routes/public.ts`
- [Order placement](https://github.com/adefilippo83/fooddesk/blob/main/server/src/lib/placeOrder.ts): `server/src/lib/placeOrder.ts`
- [Payment lifecycle](https://github.com/adefilippo83/fooddesk/blob/main/server/src/payments/lifecycle.ts): `server/src/payments/lifecycle.ts`
- [Payment providers](https://github.com/adefilippo83/fooddesk/blob/main/server/src/payments/provider.ts): `server/src/payments/provider.ts`
- [Kitchen operations](https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/kitchen.ts): `server/src/routes/kitchen.ts`
- [Live order events](https://github.com/adefilippo83/fooddesk/blob/main/server/src/lib/sse.ts): `server/src/lib/sse.ts`
- [Service-day rules](https://github.com/adefilippo83/fooddesk/blob/main/server/src/lib/serviceDay.ts): `server/src/lib/serviceDay.ts`

### Venue operations

- [Reporting](https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/reports.ts): `server/src/routes/reports.ts`
- [Menu service](https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/menu.ts): `server/src/routes/menu.ts`
- [Staff management](https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/users.ts): `server/src/routes/users.ts`
- [Venue settings](https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/settings.ts): `server/src/routes/settings.ts`
- [Ticket printing](https://github.com/adefilippo83/fooddesk/blob/main/server/src/print/service.ts): `server/src/print/service.ts`
- [PDF rendering](https://github.com/adefilippo83/fooddesk/blob/main/server/src/print/pdf.ts): `server/src/print/pdf.ts`

### Server foundation

- [API server](https://github.com/adefilippo83/fooddesk/blob/main/server/src/app.ts): `server/src/app.ts`
- [Authentication](https://github.com/adefilippo83/fooddesk/blob/main/server/src/routes/auth.ts): `server/src/routes/auth.ts`
- [SQLite database](https://github.com/adefilippo83/fooddesk/blob/main/server/src/db/schema.ts): `server/src/db/schema.ts`

### Other components

- **Waiter**
- **Guest**
- **Manager**
- **Kitchen staff**
- **CUPS printer**

## Connections

- Waiter → Staff ordering: places orders (evidence: `README.md`)
- Guest → Guest ordering: self-orders (evidence: `README.md`)
- Manager → Web app: manages venue (evidence: `README.md`)
- Kitchen staff → Kitchen display: prepares dishes (evidence: `README.md`)
- Web app → Staff ordering: routes to (evidence: `web/src/App.tsx`)
- Web app → Guest ordering: routes to (evidence: `web/src/App.tsx`)
- Web app → Order status: routes to (evidence: `web/src/App.tsx`)
- Web app → Kitchen display: routes to (evidence: `web/src/App.tsx`)
- Staff ordering → API client: requests API (evidence: `web/src/pages/NewOrder.tsx`)
- Order management → API client: requests API (evidence: `web/src/pages/Orders.tsx`)
- Menu management → API client: requests API (evidence: `web/src/pages/AdminMenu.tsx`)
- Settings UI → API client: requests API (evidence: `web/src/pages/Settings.tsx`)
- API client → API server: calls API
- API server → Authentication: registers (evidence: `server/src/app.ts`)
- API server → Order handling: registers (evidence: `server/src/app.ts`)
- API server → Public ordering: registers (evidence: `server/src/app.ts`)
- API server → Kitchen operations: registers (evidence: `server/src/app.ts`)
- API server → Menu service: registers (evidence: `server/src/app.ts`)
- API server → Reporting: registers (evidence: `server/src/app.ts`)
- API server → Venue settings: registers (evidence: `server/src/app.ts`)
- API server → Staff management: registers (evidence: `server/src/app.ts`)
- Authentication → SQLite database: reads/writes (evidence: `server/src/routes/auth.ts`)
- Order handling → Order placement: uses (evidence: `server/src/routes/orders.ts`)
- Order handling → Payment lifecycle: uses (evidence: `server/src/routes/orders.ts`)
- Public ordering → Order placement: uses (evidence: `server/src/routes/public.ts`)
- Public ordering → Payment lifecycle: uses (evidence: `server/src/routes/public.ts`)
- Payment lifecycle → Payment providers: verifies/refunds (evidence: `server/src/payments/lifecycle.ts`)
- Payment lifecycle → Ticket printing: prints ticket (evidence: `server/src/payments/lifecycle.ts`)
- Payment lifecycle → SQLite database: updates orders (evidence: `server/src/payments/lifecycle.ts`)
- Order handling → Service-day rules: uses day rules (evidence: `server/src/routes/orders.ts`)
- API server → Live order events: opens stream (evidence: `server/src/app.ts`)
- Ticket printing → PDF rendering: renders ticket (evidence: `server/src/print/service.ts`)
- Ticket printing → CUPS printer: sends ticket (evidence: `server/src/print/service.ts`)
- Ticket printing → SQLite database: records print state (evidence: `server/src/print/service.ts`)
- Reporting → SQLite database: reads report data
- Menu service → SQLite database: manages menu
- Staff management → SQLite database: manages staff
- Venue settings → SQLite database: stores settings
- Guest → Order status: tracks order (evidence: `README.md`)
- Kitchen display → Live order events: receives live updates
- Manager → Reports UI: reviews totals (evidence: `README.md`)
- Manager → Menu management: edits menu (evidence: `README.md`)
- Manager → Settings UI: configures venue (evidence: `README.md`)
