# samer-koda/rapidticket architecture

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

- Interactive diagram: https://gitdiagram.com/samer-koda/rapidticket
- Repository: https://github.com/samer-koda/rapidticket

## Overview

RapidTicket is a LAN-only restaurant and bar POS. Staff configure a station, authenticate by PIN, manage tables and orders, send items through kitchen/bar workflows, and take payment; administrators maintain menu, stations, printers, and settings and review reports. Electron/React clients use REST and WebSocket connections to the NestJS server, backed by PostgreSQL. The README documents the client/server and printing capabilities; some server modules were not sampled, so their internal links are omitted or marked unverified.

Main entry points: [`client/src/api.ts`](https://github.com/samer-koda/rapidticket/blob/main/client/src/api.ts) (REST client), [`client/src/App.tsx`](https://github.com/samer-koda/rapidticket/blob/main/client/src/App.tsx) (App routing), [`server/src/database/entities`](https://github.com/samer-koda/rapidticket/tree/main/server/src/database/entities) (PostgreSQL data), [`server/src/orders/orders.controller.ts`](https://github.com/samer-koda/rapidticket/blob/main/server/src/orders/orders.controller.ts) (Order processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Station client"]
  node_station["Electron station<br/>[main.cjs]"]
  node_app["App routing<br/>[App.tsx]"]
  node_authui["Session context<br/>[AuthContext.tsx]"]
  node_api["REST client<br/>[api.ts]"]
  node_ws["WebSocket context<br/>[WsContext.tsx]"]
end

subgraph group_core["POS operations"]
  node_tables["Table view<br/>[TableView.tsx]"]
  node_orderui["Order entry<br/>[OrderScreen.tsx]"]
  node_kitchenui["Kitchen screen<br/>[KitchenScreen.tsx]"]
  node_barui["Bar screen<br/>[BarScreen.tsx]"]
  node_paymentui["Payment screen<br/>[PaymentScreen.tsx]"]
  node_localprint["Station printing<br/>[print.ts]"]
end

subgraph group_admin["Back office"]
  node_backoffice["Back office<br/>[BackOffice.tsx]"]
  node_setup["Station setup<br/>[Setup.tsx]"]
  node_firstrun["Admin bootstrap<br/>[FirstRun.tsx]"]
  node_login["PIN login<br/>[Login.tsx]"]
end

subgraph group_server["Server services"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_stations["Station management"]
  node_floorplans["Floor plans"]
  node_menu["Menu management<br/>[menu.controller.ts]"]
  node_orders["Order processing"]
  node_payments["Payment processing"]
  node_reports["Sales reports"]
  node_settings["Settings"]
  node_printers["Printer management"]
  node_printserver["Kitchen print routing<br/>[print.service.ts]"]
end

subgraph group_infra["Persistence and events"]
  node_eventbus["Domain event bus"]
  node_gateway["Realtime gateway<br/>[events.gateway.ts]"]
  node_db[("PostgreSQL data")]
end

node_staff(("Restaurant staff"))
node_lanprinter["Kitchen Ethernet printer"]

node_staff -->|"uses"| node_station
node_station -->|"hosts"| node_app
node_app -->|"provides session"| node_authui
node_app -->|"provides events"| node_ws
node_app -->|"renders"| node_tables
node_app -->|"renders"| node_orderui
node_app -->|"renders"| node_kitchenui
node_app -->|"renders"| node_barui
node_app -->|"renders"| node_paymentui
node_app -->|"renders"| node_backoffice
node_app -->|"renders"| node_setup
node_app -->|"renders"| node_firstrun
node_app -->|"renders"| node_login
node_authui -->|"requests login"| node_api
node_tables -->|"loads tables"| node_api
node_orderui -->|"manages orders"| node_api
node_paymentui -->|"submits payment"| node_api
node_paymentui -->|"prints receipt"| node_localprint
node_barui -->|"receives events"| node_ws
node_barui -->|"prints chit"| node_localprint
node_app -->|"prints bar chits"| node_localprint
node_backoffice -->|"manages operations"| node_api
node_setup -.->|"registers station"| node_api
node_firstrun -.->|"creates admin"| node_api
node_login -.->|"authenticates"| node_authui
node_api -->|"calls REST"| node_auth
node_api -->|"calls REST"| node_stations
node_api -->|"calls REST"| node_floorplans
node_api -->|"calls REST"| node_menu
node_api -->|"calls REST"| node_orders
node_api -->|"calls REST"| node_payments
node_api -->|"calls REST"| node_reports
node_api -->|"calls REST"| node_settings
node_api -->|"calls REST"| node_printers
node_auth -->|"reads users/settings"| node_db
node_stations -->|"resets lockout"| node_auth
node_stations -->|"persists stations"| node_db
node_floorplans -->|"reads/writes plans"| node_db
node_menu -->|"reads/writes menu"| node_db
node_orders -->|"reads/writes orders"| node_db
node_orders -->|"emits order events"| node_eventbus
node_payments -->|"reads/writes payments"| node_db
node_payments -->|"emits payment events"| node_eventbus
node_reports -->|"queries sales"| node_db
node_settings -.->|"manages settings"| node_db
node_printers -.->|"manages printers"| node_db
node_printserver -->|"reads printer config"| node_db
node_orders -.->|"routes kitchen items"| node_printserver

click node_station "https://github.com/samer-koda/rapidticket/blob/main/client/electron/main.cjs"
click node_app "https://github.com/samer-koda/rapidticket/blob/main/client/src/App.tsx"
click node_authui "https://github.com/samer-koda/rapidticket/blob/main/client/src/context/AuthContext.tsx"
click node_api "https://github.com/samer-koda/rapidticket/blob/main/client/src/api.ts"
click node_ws "https://github.com/samer-koda/rapidticket/blob/main/client/src/context/WsContext.tsx"
click node_tables "https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/TableView.tsx"
click node_orderui "https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/OrderScreen.tsx"
click node_kitchenui "https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/KitchenScreen.tsx"
click node_barui "https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/BarScreen.tsx"
click node_paymentui "https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/PaymentScreen.tsx"
click node_localprint "https://github.com/samer-koda/rapidticket/blob/main/client/src/print.ts"
click node_backoffice "https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/BackOffice.tsx"
click node_setup "https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/Setup.tsx"
click node_firstrun "https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/FirstRun.tsx"
click node_login "https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/Login.tsx"
click node_auth "https://github.com/samer-koda/rapidticket/blob/main/server/src/auth/auth.service.ts"
click node_stations "https://github.com/samer-koda/rapidticket/blob/main/server/src/stations/stations.controller.ts"
click node_floorplans "https://github.com/samer-koda/rapidticket/blob/main/server/src/floor-plans/floor-plans.controller.ts"
click node_menu "https://github.com/samer-koda/rapidticket/blob/main/server/src/menu/menu.controller.ts"
click node_orders "https://github.com/samer-koda/rapidticket/blob/main/server/src/orders/orders.controller.ts"
click node_payments "https://github.com/samer-koda/rapidticket/blob/main/server/src/payments/payments.controller.ts"
click node_reports "https://github.com/samer-koda/rapidticket/blob/main/server/src/reports/reports.controller.ts"
click node_settings "https://github.com/samer-koda/rapidticket/blob/main/server/src/settings/settings.controller.ts"
click node_printers "https://github.com/samer-koda/rapidticket/blob/main/server/src/printers/printers.controller.ts"
click node_printserver "https://github.com/samer-koda/rapidticket/blob/main/server/src/print/print.service.ts"
click node_eventbus "https://github.com/samer-koda/rapidticket/blob/main/server/src/common/event-bus.service.ts"
click node_gateway "https://github.com/samer-koda/rapidticket/blob/main/server/src/gateway/events.gateway.ts"
click node_db "https://github.com/samer-koda/rapidticket/tree/main/server/src/database/entities"

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_station,node_app,node_authui,node_api,node_ws toneBlue
class node_tables,node_orderui,node_kitchenui,node_barui,node_paymentui,node_localprint toneAmber
class node_backoffice,node_setup,node_firstrun,node_login toneMint
class node_auth,node_stations,node_floorplans,node_menu,node_orders,node_payments,node_reports,node_settings,node_printers,node_printserver toneRose
class node_eventbus,node_gateway,node_db,node_staff,node_lanprinter toneIndigo
```

## Components

### Station client

- [Electron station](https://github.com/samer-koda/rapidticket/blob/main/client/electron/main.cjs): `client/electron/main.cjs`
- [App routing](https://github.com/samer-koda/rapidticket/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Session context](https://github.com/samer-koda/rapidticket/blob/main/client/src/context/AuthContext.tsx): `client/src/context/AuthContext.tsx`
- [REST client](https://github.com/samer-koda/rapidticket/blob/main/client/src/api.ts): `client/src/api.ts`
- [WebSocket context](https://github.com/samer-koda/rapidticket/blob/main/client/src/context/WsContext.tsx): `client/src/context/WsContext.tsx`

### POS operations

- [Table view](https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/TableView.tsx): `client/src/screens/TableView.tsx`
- [Order entry](https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/OrderScreen.tsx): `client/src/screens/OrderScreen.tsx`
- [Kitchen screen](https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/KitchenScreen.tsx): `client/src/screens/KitchenScreen.tsx`
- [Bar screen](https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/BarScreen.tsx): `client/src/screens/BarScreen.tsx`
- [Payment screen](https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/PaymentScreen.tsx): `client/src/screens/PaymentScreen.tsx`
- [Station printing](https://github.com/samer-koda/rapidticket/blob/main/client/src/print.ts): `client/src/print.ts`

### Back office

- [Back office](https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/BackOffice.tsx): `client/src/screens/BackOffice.tsx`
- [Station setup](https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/Setup.tsx): `client/src/screens/Setup.tsx`
- [Admin bootstrap](https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/FirstRun.tsx): `client/src/screens/FirstRun.tsx`
- [PIN login](https://github.com/samer-koda/rapidticket/blob/main/client/src/screens/Login.tsx): `client/src/screens/Login.tsx`

### Server services

- [Authentication](https://github.com/samer-koda/rapidticket/blob/main/server/src/auth/auth.service.ts): `server/src/auth/auth.service.ts`
- [Station management](https://github.com/samer-koda/rapidticket/blob/main/server/src/stations/stations.controller.ts): `server/src/stations/stations.controller.ts`
- [Floor plans](https://github.com/samer-koda/rapidticket/blob/main/server/src/floor-plans/floor-plans.controller.ts): `server/src/floor-plans/floor-plans.controller.ts`
- [Menu management](https://github.com/samer-koda/rapidticket/blob/main/server/src/menu/menu.controller.ts): `server/src/menu/menu.controller.ts`
- [Order processing](https://github.com/samer-koda/rapidticket/blob/main/server/src/orders/orders.controller.ts): `server/src/orders/orders.controller.ts`
- [Payment processing](https://github.com/samer-koda/rapidticket/blob/main/server/src/payments/payments.controller.ts): `server/src/payments/payments.controller.ts`
- [Sales reports](https://github.com/samer-koda/rapidticket/blob/main/server/src/reports/reports.controller.ts): `server/src/reports/reports.controller.ts`
- [Settings](https://github.com/samer-koda/rapidticket/blob/main/server/src/settings/settings.controller.ts): `server/src/settings/settings.controller.ts`
- [Printer management](https://github.com/samer-koda/rapidticket/blob/main/server/src/printers/printers.controller.ts): `server/src/printers/printers.controller.ts`
- [Kitchen print routing](https://github.com/samer-koda/rapidticket/blob/main/server/src/print/print.service.ts): `server/src/print/print.service.ts`

### Persistence and events

- [Domain event bus](https://github.com/samer-koda/rapidticket/blob/main/server/src/common/event-bus.service.ts): `server/src/common/event-bus.service.ts`
- [Realtime gateway](https://github.com/samer-koda/rapidticket/blob/main/server/src/gateway/events.gateway.ts): `server/src/gateway/events.gateway.ts`
- [PostgreSQL data](https://github.com/samer-koda/rapidticket/tree/main/server/src/database/entities): `server/src/database/entities`

### Other components

- **Restaurant staff**
- **Kitchen Ethernet printer**

## Connections

- Restaurant staff → Electron station: uses (evidence: `README.md`)
- Electron station → App routing: hosts (evidence: `client/src/App.tsx`)
- App routing → Session context: provides session (evidence: `client/src/App.tsx`)
- App routing → WebSocket context: provides events (evidence: `client/src/App.tsx`)
- App routing → Table view: renders (evidence: `client/src/App.tsx`)
- App routing → Order entry: renders (evidence: `client/src/App.tsx`)
- App routing → Kitchen screen: renders (evidence: `client/src/App.tsx`)
- App routing → Bar screen: renders (evidence: `client/src/App.tsx`)
- App routing → Payment screen: renders (evidence: `client/src/App.tsx`)
- App routing → Back office: renders (evidence: `client/src/App.tsx`)
- App routing → Station setup: renders (evidence: `client/src/App.tsx`)
- App routing → Admin bootstrap: renders (evidence: `client/src/App.tsx`)
- App routing → PIN login: renders (evidence: `client/src/App.tsx`)
- Session context → REST client: requests login (evidence: `client/src/context/AuthContext.tsx`)
- Table view → REST client: loads tables
- Order entry → REST client: manages orders (evidence: `client/src/screens/OrderScreen.tsx`)
- Payment screen → REST client: submits payment (evidence: `client/src/screens/PaymentScreen.tsx`)
- Payment screen → Station printing: prints receipt (evidence: `client/src/screens/PaymentScreen.tsx`)
- Bar screen → WebSocket context: receives events (evidence: `client/src/screens/BarScreen.tsx`)
- Bar screen → Station printing: prints chit (evidence: `client/src/screens/BarScreen.tsx`)
- App routing → Station printing: prints bar chits (evidence: `client/src/App.tsx`)
- Back office → REST client: manages operations (evidence: `client/src/screens/BackOffice.tsx`)
- Station setup → REST client: registers station
- Admin bootstrap → REST client: creates admin
- PIN login → Session context: authenticates
- REST client → Authentication: calls REST (evidence: `README.md`)
- REST client → Station management: calls REST (evidence: `client/src/api.ts`)
- REST client → Floor plans: calls REST (evidence: `client/src/api.ts`)
- REST client → Menu management: calls REST (evidence: `client/src/api.ts`)
- REST client → Order processing: calls REST (evidence: `client/src/api.ts`)
- REST client → Payment processing: calls REST (evidence: `client/src/api.ts`)
- REST client → Sales reports: calls REST (evidence: `client/src/api.ts`)
- REST client → Settings: calls REST (evidence: `client/src/api.ts`)
- REST client → Printer management: calls REST (evidence: `client/src/api.ts`)
- Authentication → PostgreSQL data: reads users/settings (evidence: `server/src/auth/auth.service.ts`)
- Station management → Authentication: resets lockout (evidence: `server/src/stations/stations.controller.ts`)
- Station management → PostgreSQL data: persists stations
- Floor plans → PostgreSQL data: reads/writes plans
- Menu management → PostgreSQL data: reads/writes menu (evidence: `server/src/menu/menu.controller.ts`)
- Order processing → PostgreSQL data: reads/writes orders (evidence: `server/src/orders/orders.controller.ts`)
- Order processing → Domain event bus: emits order events
- Payment processing → PostgreSQL data: reads/writes payments
- Payment processing → Domain event bus: emits payment events
- Sales reports → PostgreSQL data: queries sales
- Settings → PostgreSQL data: manages settings
- Printer management → PostgreSQL data: manages printers
- Kitchen print routing → PostgreSQL data: reads printer config (evidence: `server/src/print/print.service.ts`)
- Order processing → Kitchen print routing: routes kitchen items
