# rat-sh/kds-pos architecture

> Architecture diagram of the GitHub repository rat-sh/kds-pos, 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/rat-sh/kds-pos
- Repository: https://github.com/rat-sh/kds-pos

## Overview

KitchenFlow is a role-driven QSR kitchen operations system: staff sign in, counter staff create and pay for orders, tickets route to kitchen stations for timed preparation and handoff, and managers/admins oversee operations and setup. The React screens call a Spring API backed by PostgreSQL; domain logic and client stores support ticket handling and live operational views. README documents the broader station, reporting, audit, and public-board capabilities. Some frontend and backend subsystems are represented by their exact tree paths but were not sampled; their links are included only where documented.

Main entry points: [`src/main/java/com/kitchenflow/kds/api/KitchenFlowController.java`](https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/api/KitchenFlowController.java) (HTTP controller), [`KitchenFlow_Operations_Screens/src/features/kitchen/components/StationBoard.tsx`](https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/features/kitchen/components/StationBoard.tsx) (Station board), [`KitchenFlow_Operations_Screens/src/features/board/components/ManagerBoard.tsx`](https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/features/board/components/ManagerBoard.tsx) (Manager board), [`src/main/java/com/kitchenflow/kds/order/service/OrderService.java`](https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/order/service/OrderService.java) (Order operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Operations client"]
  node_app["Application shell<br/>[AppRoot.tsx]"]
  node_authui["Sign-in<br/>[Login.tsx]"]
  node_pos["Counter POS<br/>[PosScreen.tsx]"]
  node_kitchen["Station board<br/>[StationBoard.tsx]"]
  node_manager["Manager board<br/>[ManagerBoard.tsx]"]
  node_public["Public board<br/>[StatusBoard.tsx]"]
  node_clientapi["API requests<br/>[request.ts]"]
  node_clientstate["Client state"]
end

subgraph group_domain["Operations domain"]
  node_ticketlogic["Ticket workflow"]
  node_queuesla["Queues and SLA"]
  node_pricing["Pricing rules"]
end

subgraph group_server["Spring API"]
  node_controller["HTTP controller"]
  node_auth["Authentication<br/>[AuthService.java]"]
  node_orders["Order operations<br/>[OrderService.java]"]
  node_payments["Payment handling"]
end

subgraph group_admin["Setup and oversight"]
  node_catalog["Catalog and stock"]
  node_reports["Reports<br/>[ReportService.java]"]
  node_audit["Audit log<br/>[Audit.tsx]"]
end

subgraph group_infra["Persistence and live updates"]
  node_database[("PostgreSQL")]
  node_stream["Public SSE stream<br/>[BoardStream.java]"]
end

node_staff(("Restaurant staff"))

node_staff -->|"uses"| node_app
node_app -.->|"routes"| node_authui
node_staff -->|"places orders"| node_pos
node_staff -->|"prepares tickets"| node_kitchen
node_staff -->|"oversees orders"| node_manager
node_staff -->|"views tokens"| node_public
node_manager -->|"sends actions"| node_clientapi
node_manager -->|"refreshes orders"| node_clientstate
node_clientapi -->|"HTTP requests"| node_controller
node_controller -->|"delegates login"| node_auth
node_controller -->|"delegates orders"| node_orders
node_controller -->|"records payment"| node_payments
node_controller -->|"delegates catalog"| node_catalog
node_controller -->|"serves reports"| node_reports
node_controller -->|"serves SSE"| node_stream
node_orders -->|"reads and writes"| node_database
node_payments -->|"reads and writes"| node_database
node_catalog -->|"reads and writes"| node_database
node_auth -->|"loads credentials"| node_database
node_orders -->|"uses payment service"| node_payments
node_kitchen -.->|"advances tickets"| node_ticketlogic
node_kitchen -->|"views timed queue"| node_queuesla
node_pos -->|"calculates totals"| node_pricing
node_catalog -.->|"supplies operations data"| node_reports
node_public -->|"subscribes"| node_stream
node_controller -->|"exposes audit entries"| node_audit

click node_app "https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/app/AppRoot.tsx"
click node_authui "https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/features/auth/components/Login.tsx"
click node_pos "https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/features/orders/components/PosScreen.tsx"
click node_kitchen "https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/features/kitchen/components/StationBoard.tsx"
click node_manager "https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/features/board/components/ManagerBoard.tsx"
click node_public "https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/features/board/components/StatusBoard.tsx"
click node_clientapi "https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/api/request.ts"
click node_clientstate "https://github.com/rat-sh/kds-pos/tree/main/KitchenFlow_Operations_Screens/src/store"
click node_ticketlogic "https://github.com/rat-sh/kds-pos/tree/main/KitchenFlow_Operations_Screens/src/domain/ticket-state"
click node_queuesla "https://github.com/rat-sh/kds-pos/tree/main/KitchenFlow_Operations_Screens/src/domain/queue"
click node_pricing "https://github.com/rat-sh/kds-pos/tree/main/KitchenFlow_Operations_Screens/src/domain/pricing"
click node_controller "https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/api/KitchenFlowController.java"
click node_auth "https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/auth/service/AuthService.java"
click node_orders "https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/order/service/OrderService.java"
click node_payments "https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/order/service/PaymentService.java"
click node_catalog "https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/menu/service/CatalogService.java"
click node_reports "https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/report/service/ReportService.java"
click node_audit "https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/features/audit/components/Audit.tsx"
click node_stream "https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/board/BoardStream.java"

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_app,node_authui,node_pos,node_kitchen,node_manager,node_public,node_clientapi,node_clientstate toneBlue
class node_ticketlogic,node_queuesla,node_pricing toneAmber
class node_controller,node_auth,node_orders,node_payments toneMint
class node_catalog,node_reports,node_audit toneRose
class node_database,node_stream,node_staff toneIndigo
```

## Components

### Operations client

- [Application shell](https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/app/AppRoot.tsx): `KitchenFlow_Operations_Screens/src/app/AppRoot.tsx`
- [Sign-in](https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/features/auth/components/Login.tsx): `KitchenFlow_Operations_Screens/src/features/auth/components/Login.tsx`
- [Counter POS](https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/features/orders/components/PosScreen.tsx): `KitchenFlow_Operations_Screens/src/features/orders/components/PosScreen.tsx`
- [Station board](https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/features/kitchen/components/StationBoard.tsx): `KitchenFlow_Operations_Screens/src/features/kitchen/components/StationBoard.tsx`
- [Manager board](https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/features/board/components/ManagerBoard.tsx): `KitchenFlow_Operations_Screens/src/features/board/components/ManagerBoard.tsx`
- [Public board](https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/features/board/components/StatusBoard.tsx): `KitchenFlow_Operations_Screens/src/features/board/components/StatusBoard.tsx`
- [API requests](https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/api/request.ts): `KitchenFlow_Operations_Screens/src/api/request.ts`
- [Client state](https://github.com/rat-sh/kds-pos/tree/main/KitchenFlow_Operations_Screens/src/store): `KitchenFlow_Operations_Screens/src/store`

### Operations domain

- [Ticket workflow](https://github.com/rat-sh/kds-pos/tree/main/KitchenFlow_Operations_Screens/src/domain/ticket-state): `KitchenFlow_Operations_Screens/src/domain/ticket-state`
- [Queues and SLA](https://github.com/rat-sh/kds-pos/tree/main/KitchenFlow_Operations_Screens/src/domain/queue): `KitchenFlow_Operations_Screens/src/domain/queue`
- [Pricing rules](https://github.com/rat-sh/kds-pos/tree/main/KitchenFlow_Operations_Screens/src/domain/pricing): `KitchenFlow_Operations_Screens/src/domain/pricing`

### Spring API

- [HTTP controller](https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/api/KitchenFlowController.java): `src/main/java/com/kitchenflow/kds/api/KitchenFlowController.java`
- [Authentication](https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/auth/service/AuthService.java): `src/main/java/com/kitchenflow/kds/auth/service/AuthService.java`
- [Order operations](https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/order/service/OrderService.java): `src/main/java/com/kitchenflow/kds/order/service/OrderService.java`
- [Payment handling](https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/order/service/PaymentService.java): `src/main/java/com/kitchenflow/kds/order/service/PaymentService.java`

### Setup and oversight

- [Catalog and stock](https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/menu/service/CatalogService.java): `src/main/java/com/kitchenflow/kds/menu/service/CatalogService.java`
- [Reports](https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/report/service/ReportService.java): `src/main/java/com/kitchenflow/kds/report/service/ReportService.java`
- [Audit log](https://github.com/rat-sh/kds-pos/blob/main/KitchenFlow_Operations_Screens/src/features/audit/components/Audit.tsx): `KitchenFlow_Operations_Screens/src/features/audit/components/Audit.tsx`

### Persistence and live updates

- **PostgreSQL**
- [Public SSE stream](https://github.com/rat-sh/kds-pos/blob/main/src/main/java/com/kitchenflow/kds/board/BoardStream.java): `src/main/java/com/kitchenflow/kds/board/BoardStream.java`

### Other components

- **Restaurant staff**

## Connections

- Restaurant staff → Application shell: uses (evidence: `README.md`)
- Application shell → Sign-in: routes
- Restaurant staff → Counter POS: places orders (evidence: `README.md`)
- Restaurant staff → Station board: prepares tickets (evidence: `README.md`)
- Restaurant staff → Manager board: oversees orders (evidence: `README.md`)
- Restaurant staff → Public board: views tokens (evidence: `README.md`)
- Manager board → API requests: sends actions (evidence: `KitchenFlow_Operations_Screens/src/features/board/components/ManagerBoard.tsx`)
- Manager board → Client state: refreshes orders (evidence: `KitchenFlow_Operations_Screens/src/features/board/components/ManagerBoard.tsx`)
- API requests → HTTP controller: HTTP requests (evidence: `README.md`)
- HTTP controller → Authentication: delegates login (evidence: `src/main/java/com/kitchenflow/kds/api/KitchenFlowController.java`)
- HTTP controller → Order operations: delegates orders (evidence: `src/main/java/com/kitchenflow/kds/api/KitchenFlowController.java`)
- HTTP controller → Payment handling: records payment (evidence: `src/main/java/com/kitchenflow/kds/api/KitchenFlowController.java`)
- HTTP controller → Catalog and stock: delegates catalog (evidence: `src/main/java/com/kitchenflow/kds/api/KitchenFlowController.java`)
- HTTP controller → Reports: serves reports (evidence: `src/main/java/com/kitchenflow/kds/api/KitchenFlowController.java`)
- HTTP controller → Public SSE stream: serves SSE (evidence: `src/main/java/com/kitchenflow/kds/api/KitchenFlowController.java`)
- Order operations → PostgreSQL: reads and writes (evidence: `src/main/java/com/kitchenflow/kds/order/service/OrderService.java`)
- Payment handling → PostgreSQL: reads and writes (evidence: `src/main/java/com/kitchenflow/kds/order/service/PaymentService.java`)
- Catalog and stock → PostgreSQL: reads and writes (evidence: `src/main/java/com/kitchenflow/kds/menu/service/CatalogService.java`)
- Authentication → PostgreSQL: loads credentials (evidence: `src/main/java/com/kitchenflow/kds/auth/service/AuthService.java`)
- Order operations → Payment handling: uses payment service (evidence: `src/main/java/com/kitchenflow/kds/order/service/OrderService.java`)
- Station board → Ticket workflow: advances tickets
- Station board → Queues and SLA: views timed queue (evidence: `README.md`)
- Counter POS → Pricing rules: calculates totals (evidence: `README.md`)
- Catalog and stock → Reports: supplies operations data
- Public board → Public SSE stream: subscribes (evidence: `README.md`)
- HTTP controller → Audit log: exposes audit entries (evidence: `src/main/java/com/kitchenflow/kds/api/KitchenFlowController.java`)
