# zylioth/scanlu architecture

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

- Interactive diagram: https://gitdiagram.com/zylioth/scanlu
- Repository: https://github.com/zylioth/scanlu

## Overview

ScanLu is a QR-based drink-ordering app for guests and a host-operated admin interface. Guests browse the menu, configure drinks, submit an order, then follow its ticket through readiness and collection; the host manages the live queue, menu, stock, settings, and event QR card. Shared hooks and a backend adapter serve both local demo storage and optional Supabase. The README documents these capabilities; unsampled page internals are represented by their exact paths, with relationships included only where documented or referenced in the supplied excerpts.

Main entry points: [`src/App.tsx`](https://github.com/zylioth/scanlu/blob/main/src/App.tsx) (Routes and shell), [`src/lib/backend.ts`](https://github.com/zylioth/scanlu/blob/main/src/lib/backend.ts) (Backend selector), [`src/pages/TicketPage.tsx`](https://github.com/zylioth/scanlu/blob/main/src/pages/TicketPage.tsx) (Order ticket), [`src/pages/admin/AdminMenu.tsx`](https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminMenu.tsx) (Menu management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_guest["Guest ordering"]
  node_menu["Browse menu<br/>[MenuPage.tsx]"]
  node_item_sheet["Configure drink<br/>[ItemSheet.tsx]"]
  node_cart["Review and order<br/>[CartPage.tsx]"]
  node_ticket["Order ticket<br/>[TicketPage.tsx]"]
  node_ticket_view["Ticket display<br/>[Ticket.tsx]"]
  node_ready_alert["Ready and collect<br/>[ReadyAlert.tsx]"]
end

subgraph group_host["Host operations"]
  node_admin_shell["Admin access<br/>[AdminShell.tsx]"]
  node_admin_board["Live order board<br/>[AdminBoard.tsx]"]
  node_admin_menu["Menu management<br/>[AdminMenu.tsx]"]
  node_ingredients["Ingredient stock"]
  node_modifiers["Modifier setup<br/>[AdminModifiers.tsx]"]
  node_new_order["Walk-in orders<br/>[AdminNewOrder.tsx]"]
  node_admin_qr["QR and print card<br/>[AdminQR.tsx]"]
  node_settings["Event settings<br/>[AdminSettings.tsx]"]
  node_stats["Order statistics<br/>[AdminStats.tsx]"]
end

subgraph group_shared["Shared application"]
  node_app["Routes and shell<br/>[App.tsx]"]
  node_hooks["Data and live hooks<br/>[hooks.ts]"]
  node_store["Cart state<br/>[store.ts]"]
  node_audio["Sound alerts<br/>[audio.ts]"]
  node_toast["Toast feedback<br/>[Toast.tsx]"]
  node_ui["Shared controls<br/>[ui.tsx]"]
  node_format["Order formatting<br/>[format.ts]"]
  node_image["Menu image processing<br/>[image.ts]"]
end

subgraph group_data["Backend and data"]
  node_backend["Backend selector<br/>[backend.ts]"]
  node_local_backend["Local demo backend<br/>[localBackend.ts]"]
  node_supabase_backend["Supabase backend<br/>[supabaseBackend.ts]"]
end

node_guest_actor(("Guest"))
node_host_actor(("Host"))
node_browser_store[("Browser storage")]
node_supabase_db[("Supabase database")]

node_guest_actor -->|"opens app"| node_app
node_host_actor -->|"opens admin"| node_app
node_app -->|"routes to"| node_menu
node_app -->|"routes to"| node_cart
node_app -->|"routes to"| node_ticket
node_app -->|"guards admin"| node_admin_shell
node_app -->|"routes to"| node_admin_board
node_app -->|"routes to"| node_admin_menu
node_app -->|"routes to"| node_admin_qr
node_app -->|"routes to"| node_settings
node_app -->|"routes to"| node_modifiers
node_app -->|"routes to"| node_ingredients
node_app -->|"routes to"| node_stats
node_app -->|"routes to"| node_new_order
node_menu -->|"opens sheet"| node_item_sheet
node_menu -->|"reads menu"| node_hooks
node_cart -->|"reads cart"| node_store
node_cart -->|"submits order"| node_backend
node_ticket -->|"reads order"| node_hooks
node_ticket -->|"updates order"| node_backend
node_ticket -->|"renders ticket"| node_ticket_view
node_ticket -->|"shows readiness"| node_ready_alert
node_ready_alert -->|"plays alert"| node_audio
node_admin_shell -->|"checks access"| node_backend
node_admin_board -->|"manages orders"| node_backend
node_admin_board -->|"plays chime"| node_audio
node_admin_menu -->|"saves menu"| node_backend
node_admin_menu -->|"processes photos"| node_image
node_ingredients -->|"manages stock"| node_backend
node_modifiers -->|"saves modifiers"| node_backend
node_new_order -->|"places order"| node_backend
node_admin_qr -->|"reads settings"| node_backend
node_settings -->|"saves settings"| node_backend
node_stats -->|"reads metrics"| node_hooks
node_admin_board -->|"reads queue"| node_hooks
node_hooks -->|"loads data"| node_backend
node_backend -->|"selects demo"| node_local_backend
node_backend -->|"selects live"| node_supabase_backend
node_local_backend -->|"persists locally"| node_browser_store
node_supabase_backend -->|"reads and writes"| node_supabase_db
node_cart -->|"reports errors"| node_toast
node_admin_menu -->|"reports outcomes"| node_toast
node_menu -->|"formats prices"| node_format
node_item_sheet -->|"uses controls"| node_ui
node_ticket_view -->|"formats ticket"| node_format
node_admin_menu -->|"reuses editor"| node_item_sheet

click node_app "https://github.com/zylioth/scanlu/blob/main/src/App.tsx"
click node_menu "https://github.com/zylioth/scanlu/blob/main/src/pages/MenuPage.tsx"
click node_item_sheet "https://github.com/zylioth/scanlu/blob/main/src/components/ItemSheet.tsx"
click node_cart "https://github.com/zylioth/scanlu/blob/main/src/pages/CartPage.tsx"
click node_ticket "https://github.com/zylioth/scanlu/blob/main/src/pages/TicketPage.tsx"
click node_ticket_view "https://github.com/zylioth/scanlu/blob/main/src/components/Ticket.tsx"
click node_ready_alert "https://github.com/zylioth/scanlu/blob/main/src/components/ReadyAlert.tsx"
click node_admin_shell "https://github.com/zylioth/scanlu/blob/main/src/components/AdminShell.tsx"
click node_admin_board "https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminBoard.tsx"
click node_admin_menu "https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminMenu.tsx"
click node_ingredients "https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminIngredients.tsx"
click node_modifiers "https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminModifiers.tsx"
click node_new_order "https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminNewOrder.tsx"
click node_admin_qr "https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminQR.tsx"
click node_settings "https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminSettings.tsx"
click node_stats "https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminStats.tsx"
click node_hooks "https://github.com/zylioth/scanlu/blob/main/src/lib/hooks.ts"
click node_store "https://github.com/zylioth/scanlu/blob/main/src/lib/store.ts"
click node_audio "https://github.com/zylioth/scanlu/blob/main/src/lib/audio.ts"
click node_toast "https://github.com/zylioth/scanlu/blob/main/src/components/Toast.tsx"
click node_ui "https://github.com/zylioth/scanlu/blob/main/src/components/ui.tsx"
click node_format "https://github.com/zylioth/scanlu/blob/main/src/lib/format.ts"
click node_image "https://github.com/zylioth/scanlu/blob/main/src/lib/image.ts"
click node_backend "https://github.com/zylioth/scanlu/blob/main/src/lib/backend.ts"
click node_local_backend "https://github.com/zylioth/scanlu/blob/main/src/lib/localBackend.ts"
click node_supabase_backend "https://github.com/zylioth/scanlu/blob/main/src/lib/supabaseBackend.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_menu,node_item_sheet,node_cart,node_ticket,node_ticket_view,node_ready_alert toneBlue
class node_admin_shell,node_admin_board,node_admin_menu,node_ingredients,node_modifiers,node_new_order,node_admin_qr,node_settings,node_stats,node_browser_store,node_supabase_db toneAmber
class node_app,node_hooks,node_store,node_audio,node_toast,node_ui,node_format,node_image toneMint
class node_backend,node_local_backend,node_supabase_backend toneRose
class node_guest_actor,node_host_actor toneIndigo
```

## Components

### Guest ordering

- [Browse menu](https://github.com/zylioth/scanlu/blob/main/src/pages/MenuPage.tsx): `src/pages/MenuPage.tsx`
- [Configure drink](https://github.com/zylioth/scanlu/blob/main/src/components/ItemSheet.tsx): `src/components/ItemSheet.tsx`
- [Review and order](https://github.com/zylioth/scanlu/blob/main/src/pages/CartPage.tsx): `src/pages/CartPage.tsx`
- [Order ticket](https://github.com/zylioth/scanlu/blob/main/src/pages/TicketPage.tsx): `src/pages/TicketPage.tsx`
- [Ticket display](https://github.com/zylioth/scanlu/blob/main/src/components/Ticket.tsx): `src/components/Ticket.tsx`
- [Ready and collect](https://github.com/zylioth/scanlu/blob/main/src/components/ReadyAlert.tsx): `src/components/ReadyAlert.tsx`

### Host operations

- [Admin access](https://github.com/zylioth/scanlu/blob/main/src/components/AdminShell.tsx): `src/components/AdminShell.tsx`
- [Live order board](https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminBoard.tsx): `src/pages/admin/AdminBoard.tsx`
- [Menu management](https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminMenu.tsx): `src/pages/admin/AdminMenu.tsx`
- [Ingredient stock](https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminIngredients.tsx): `src/pages/admin/AdminIngredients.tsx`
- [Modifier setup](https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminModifiers.tsx): `src/pages/admin/AdminModifiers.tsx`
- [Walk-in orders](https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminNewOrder.tsx): `src/pages/admin/AdminNewOrder.tsx`
- [QR and print card](https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminQR.tsx): `src/pages/admin/AdminQR.tsx`
- [Event settings](https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminSettings.tsx): `src/pages/admin/AdminSettings.tsx`
- [Order statistics](https://github.com/zylioth/scanlu/blob/main/src/pages/admin/AdminStats.tsx): `src/pages/admin/AdminStats.tsx`

### Shared application

- [Routes and shell](https://github.com/zylioth/scanlu/blob/main/src/App.tsx): `src/App.tsx`
- [Data and live hooks](https://github.com/zylioth/scanlu/blob/main/src/lib/hooks.ts): `src/lib/hooks.ts`
- [Cart state](https://github.com/zylioth/scanlu/blob/main/src/lib/store.ts): `src/lib/store.ts`
- [Sound alerts](https://github.com/zylioth/scanlu/blob/main/src/lib/audio.ts): `src/lib/audio.ts`
- [Toast feedback](https://github.com/zylioth/scanlu/blob/main/src/components/Toast.tsx): `src/components/Toast.tsx`
- [Shared controls](https://github.com/zylioth/scanlu/blob/main/src/components/ui.tsx): `src/components/ui.tsx`
- [Order formatting](https://github.com/zylioth/scanlu/blob/main/src/lib/format.ts): `src/lib/format.ts`
- [Menu image processing](https://github.com/zylioth/scanlu/blob/main/src/lib/image.ts): `src/lib/image.ts`

### Backend and data

- [Backend selector](https://github.com/zylioth/scanlu/blob/main/src/lib/backend.ts): `src/lib/backend.ts`
- [Local demo backend](https://github.com/zylioth/scanlu/blob/main/src/lib/localBackend.ts): `src/lib/localBackend.ts`
- [Supabase backend](https://github.com/zylioth/scanlu/blob/main/src/lib/supabaseBackend.ts): `src/lib/supabaseBackend.ts`

### Other components

- **Guest**
- **Host**
- **Browser storage**
- **Supabase database**

## Connections

- Guest → Routes and shell: opens app (evidence: `README.md`)
- Host → Routes and shell: opens admin (evidence: `README.md`)
- Routes and shell → Browse menu: routes to (evidence: `src/App.tsx`)
- Routes and shell → Review and order: routes to (evidence: `src/App.tsx`)
- Routes and shell → Order ticket: routes to (evidence: `src/App.tsx`)
- Routes and shell → Admin access: guards admin (evidence: `src/App.tsx`)
- Routes and shell → Live order board: routes to (evidence: `src/App.tsx`)
- Routes and shell → Menu management: routes to (evidence: `src/App.tsx`)
- Routes and shell → QR and print card: routes to (evidence: `src/App.tsx`)
- Routes and shell → Event settings: routes to (evidence: `src/App.tsx`)
- Routes and shell → Modifier setup: routes to (evidence: `src/App.tsx`)
- Routes and shell → Ingredient stock: routes to (evidence: `src/App.tsx`)
- Routes and shell → Order statistics: routes to (evidence: `src/App.tsx`)
- Routes and shell → Walk-in orders: routes to (evidence: `src/App.tsx`)
- Browse menu → Configure drink: opens sheet (evidence: `src/pages/MenuPage.tsx`)
- Browse menu → Data and live hooks: reads menu (evidence: `src/pages/MenuPage.tsx`)
- Review and order → Cart state: reads cart (evidence: `src/pages/CartPage.tsx`)
- Review and order → Backend selector: submits order (evidence: `src/pages/CartPage.tsx`)
- Order ticket → Data and live hooks: reads order (evidence: `src/pages/TicketPage.tsx`)
- Order ticket → Backend selector: updates order (evidence: `src/pages/TicketPage.tsx`)
- Order ticket → Ticket display: renders ticket (evidence: `src/pages/TicketPage.tsx`)
- Order ticket → Ready and collect: shows readiness (evidence: `src/pages/TicketPage.tsx`)
- Ready and collect → Sound alerts: plays alert (evidence: `src/components/ReadyAlert.tsx`)
- Admin access → Backend selector: checks access (evidence: `src/components/AdminShell.tsx`)
- Live order board → Backend selector: manages orders (evidence: `src/pages/admin/AdminBoard.tsx`)
- Live order board → Sound alerts: plays chime (evidence: `src/pages/admin/AdminBoard.tsx`)
- Menu management → Backend selector: saves menu (evidence: `src/pages/admin/AdminMenu.tsx`)
- Menu management → Menu image processing: processes photos (evidence: `src/pages/admin/AdminMenu.tsx`)
- Ingredient stock → Backend selector: manages stock (evidence: `src/pages/admin/AdminIngredients.tsx`)
- Modifier setup → Backend selector: saves modifiers (evidence: `src/pages/admin/AdminModifiers.tsx`)
- Walk-in orders → Backend selector: places order (evidence: `src/pages/admin/AdminNewOrder.tsx`)
- QR and print card → Backend selector: reads settings (evidence: `src/pages/admin/AdminQR.tsx`)
- Event settings → Backend selector: saves settings (evidence: `src/pages/admin/AdminSettings.tsx`)
- Order statistics → Data and live hooks: reads metrics (evidence: `src/pages/admin/AdminStats.tsx`)
- Live order board → Data and live hooks: reads queue (evidence: `src/pages/admin/AdminBoard.tsx`)
- Data and live hooks → Backend selector: loads data (evidence: `src/lib/hooks.ts`)
- Backend selector → Local demo backend: selects demo (evidence: `src/lib/backend.ts`)
- Backend selector → Supabase backend: selects live (evidence: `src/lib/backend.ts`)
- Local demo backend → Browser storage: persists locally (evidence: `README.md`)
- Supabase backend → Supabase database: reads and writes (evidence: `README.md`)
- Review and order → Toast feedback: reports errors (evidence: `src/pages/CartPage.tsx`)
- Menu management → Toast feedback: reports outcomes (evidence: `src/pages/admin/AdminMenu.tsx`)
- Browse menu → Order formatting: formats prices (evidence: `src/pages/MenuPage.tsx`)
- Configure drink → Shared controls: uses controls (evidence: `src/components/ItemSheet.tsx`)
- Ticket display → Order formatting: formats ticket (evidence: `src/components/Ticket.tsx`)
- Menu management → Configure drink: reuses editor (evidence: `src/pages/admin/AdminMenu.tsx`)
