# sharipovakhror/chicken-fit-cafe architecture

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

- Interactive diagram: https://gitdiagram.com/sharipovakhror/chicken-fit-cafe
- Repository: https://github.com/sharipovakhror/chicken-fit-cafe

## Overview

Chicken Fit is an offline-capable café POS with a guest-facing QR menu. The main workflow is cashier → PIN-authenticated POS → order and payment → local persistence and queued synchronization with Supabase; kitchen and shift/reporting screens support operations. Guests browse a separately served menu, while device backup and legacy-data rescue provide recovery paths. Several operational views are represented because the README documents them and the POS entry point references them; their internal behavior was not sampled, so those connections are cited at the entry point rather than expanded.

Main entry points: [`features/pos/PosApp.tsx`](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/PosApp.tsx) (POS app), [`data/local-db.ts`](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/data/local-db.ts) (Device database), [`features/app/runtime.tsx`](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/app/runtime.tsx) (Client runtime), [`data/sync.ts`](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/data/sync.ts) (Sync engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pos["POS operations"]
  node_pos_app["POS app<br/>[PosApp.tsx]"]
  node_orders["Orders and checkout<br/>[OrderView.tsx]"]
  node_order_actions["Order actions<br/>[actions.ts]"]
  node_kitchen["Kitchen display<br/>[KitchenView.tsx]"]
  node_tables["Table service<br/>[TablesView.tsx]"]
  node_shifts["Shifts and reports<br/>[ShiftView.tsx]"]
  node_sales_reports["Sales reports<br/>[ReportsView.tsx]"]
  node_menu_admin["Menu administration<br/>[MenuAdminView.tsx]"]
end

subgraph group_runtime["Local data and sync"]
  node_local_db[("Device database<br/>[local-db.ts]")]
  node_data_hooks["POS data queries<br/>[useData.ts]"]
  node_runtime_provider["Client runtime<br/>[runtime.tsx]"]
  node_sync_engine["Sync engine<br/>[sync.ts]"]
  node_outbox["Mutation outbox<br/>[outbox.ts]"]
  node_supabase_api["Supabase RPC API<br/>[api.ts]"]
end

subgraph group_guest["Guest menu"]
  node_menu_page["Guest menu page<br/>[menu-page.tsx]"]
  node_menu_board["Menu board<br/>[menu-board.tsx]"]
  node_live_menu["Live menu loader<br/>[menu.ts]"]
end

subgraph group_recovery["Backup and rescue"]
  node_backup_page["Device backup<br/>[page.tsx]"]
  node_rescue_import["Legacy rescue import<br/>[useRescueImport.ts]"]
  node_rescue_service["Rescue processing<br/>[rescue.ts]"]
  node_legacy_parser["Legacy parser<br/>[parse.ts]"]
end

node_cashier(("Cashier"))
node_kitchen_staff(("Kitchen staff"))
node_guest_user(("Guest"))

node_cashier -->|"uses POS"| node_pos_app
node_kitchen_staff -->|"views orders"| node_kitchen
node_pos_app -->|"renders checkout"| node_orders
node_pos_app -->|"renders kitchen"| node_kitchen
node_pos_app -->|"renders tables"| node_tables
node_pos_app -->|"renders shifts"| node_shifts
node_pos_app -->|"renders reports"| node_sales_reports
node_pos_app -->|"renders admin"| node_menu_admin
node_orders -->|"invokes actions"| node_order_actions
node_orders -->|"reads POS data"| node_data_hooks
node_order_actions -->|"writes orders"| node_local_db
node_order_actions -->|"queues mutations"| node_outbox
node_data_hooks -->|"gets runtime"| node_runtime_provider
node_data_hooks -->|"queries tables"| node_local_db
node_runtime_provider -->|"loads session"| node_local_db
node_runtime_provider -->|"authenticates"| node_supabase_api
node_runtime_provider -->|"starts sync"| node_sync_engine
node_sync_engine -->|"sends pending"| node_outbox
node_sync_engine -->|"updates local data"| node_local_db
node_sync_engine -->|"pulls and applies"| node_supabase_api
node_guest_user -->|"browses menu"| node_menu_page
node_menu_page -->|"loads live menu"| node_live_menu
node_menu_page -->|"renders menu"| node_menu_board
node_backup_page -->|"reads device data"| node_local_db
node_backup_page -.->|"offers recovery"| node_rescue_import
node_rescue_import -->|"uses runtime"| node_runtime_provider
node_rescue_import -->|"imports legacy data"| node_rescue_service
node_rescue_service -->|"parses snapshots"| node_legacy_parser
node_rescue_service -->|"stores rescue state"| node_local_db
node_rescue_service -->|"uploads and verifies"| node_supabase_api

click node_pos_app "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/PosApp.tsx"
click node_orders "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/OrderView.tsx"
click node_order_actions "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/actions.ts"
click node_kitchen "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/kitchen/KitchenView.tsx"
click node_tables "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/TablesView.tsx"
click node_shifts "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/ShiftView.tsx"
click node_sales_reports "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/ReportsView.tsx"
click node_menu_admin "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/MenuAdminView.tsx"
click node_local_db "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/data/local-db.ts"
click node_data_hooks "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/useData.ts"
click node_runtime_provider "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/app/runtime.tsx"
click node_sync_engine "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/data/sync.ts"
click node_outbox "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/data/outbox.ts"
click node_supabase_api "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/data/api.ts"
click node_menu_page "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/components/menu/menu-page.tsx"
click node_menu_board "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/components/menu/menu-board.tsx"
click node_live_menu "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/lib/menu.ts"
click node_backup_page "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/app/backup/page.tsx"
click node_rescue_import "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/rescue/useRescueImport.ts"
click node_rescue_service "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/rescue/rescue.ts"
click node_legacy_parser "https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/rescue/parse.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_pos_app,node_orders,node_order_actions,node_kitchen,node_tables,node_shifts,node_sales_reports,node_menu_admin toneBlue
class node_local_db,node_data_hooks,node_runtime_provider,node_sync_engine,node_outbox,node_supabase_api toneAmber
class node_menu_page,node_menu_board,node_live_menu toneMint
class node_backup_page,node_rescue_import,node_rescue_service,node_legacy_parser toneRose
class node_cashier,node_kitchen_staff,node_guest_user toneIndigo
```

## Components

### POS operations

- [POS app](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/PosApp.tsx): `features/pos/PosApp.tsx`
- [Orders and checkout](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/OrderView.tsx): `features/pos/OrderView.tsx`
- [Order actions](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/actions.ts): `features/pos/actions.ts`
- [Kitchen display](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/kitchen/KitchenView.tsx): `features/kitchen/KitchenView.tsx`
- [Table service](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/TablesView.tsx): `features/pos/TablesView.tsx`
- [Shifts and reports](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/ShiftView.tsx): `features/pos/ShiftView.tsx`
- [Sales reports](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/ReportsView.tsx): `features/pos/ReportsView.tsx`
- [Menu administration](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/MenuAdminView.tsx): `features/pos/MenuAdminView.tsx`

### Local data and sync

- [Device database](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/data/local-db.ts): `data/local-db.ts`
- [POS data queries](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/pos/useData.ts): `features/pos/useData.ts`
- [Client runtime](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/app/runtime.tsx): `features/app/runtime.tsx`
- [Sync engine](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/data/sync.ts): `data/sync.ts`
- [Mutation outbox](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/data/outbox.ts): `data/outbox.ts`
- [Supabase RPC API](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/data/api.ts): `data/api.ts`

### Guest menu

- [Guest menu page](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/components/menu/menu-page.tsx): `components/menu/menu-page.tsx`
- [Menu board](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/components/menu/menu-board.tsx): `components/menu/menu-board.tsx`
- [Live menu loader](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/lib/menu.ts): `lib/menu.ts`

### Backup and rescue

- [Device backup](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/app/backup/page.tsx): `app/backup/page.tsx`
- [Legacy rescue import](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/rescue/useRescueImport.ts): `features/rescue/useRescueImport.ts`
- [Rescue processing](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/rescue/rescue.ts): `features/rescue/rescue.ts`
- [Legacy parser](https://github.com/sharipovakhror/chicken-fit-cafe/blob/main/features/rescue/parse.ts): `features/rescue/parse.ts`

### Other components

- **Cashier**
- **Kitchen staff**
- **Guest**

## Connections

- Cashier → POS app: uses POS (evidence: `README.md`)
- Kitchen staff → Kitchen display: views orders (evidence: `README.md`)
- POS app → Orders and checkout: renders checkout (evidence: `features/pos/PosApp.tsx`)
- POS app → Kitchen display: renders kitchen (evidence: `features/pos/PosApp.tsx`)
- POS app → Table service: renders tables (evidence: `features/pos/PosApp.tsx`)
- POS app → Shifts and reports: renders shifts (evidence: `features/pos/PosApp.tsx`)
- POS app → Sales reports: renders reports (evidence: `features/pos/PosApp.tsx`)
- POS app → Menu administration: renders admin (evidence: `features/pos/PosApp.tsx`)
- Orders and checkout → Order actions: invokes actions (evidence: `features/pos/OrderView.tsx`)
- Orders and checkout → POS data queries: reads POS data (evidence: `features/pos/OrderView.tsx`)
- Order actions → Device database: writes orders (evidence: `features/pos/actions.ts`)
- Order actions → Mutation outbox: queues mutations (evidence: `features/pos/actions.ts`)
- POS data queries → Client runtime: gets runtime (evidence: `features/pos/useData.ts`)
- POS data queries → Device database: queries tables (evidence: `features/pos/useData.ts`)
- Client runtime → Device database: loads session (evidence: `features/app/runtime.tsx`)
- Client runtime → Supabase RPC API: authenticates (evidence: `features/app/runtime.tsx`)
- Client runtime → Sync engine: starts sync (evidence: `features/app/runtime.tsx`)
- Sync engine → Mutation outbox: sends pending (evidence: `data/sync.ts`)
- Sync engine → Device database: updates local data (evidence: `data/sync.ts`)
- Sync engine → Supabase RPC API: pulls and applies (evidence: `data/sync.ts`)
- Guest → Guest menu page: browses menu (evidence: `README.md`)
- Guest menu page → Live menu loader: loads live menu (evidence: `components/menu/menu-page.tsx`)
- Guest menu page → Menu board: renders menu (evidence: `components/menu/menu-page.tsx`)
- Device backup → Device database: reads device data (evidence: `app/backup/page.tsx`)
- Device backup → Legacy rescue import: offers recovery
- Legacy rescue import → Client runtime: uses runtime (evidence: `features/rescue/useRescueImport.ts`)
- Legacy rescue import → Rescue processing: imports legacy data (evidence: `features/rescue/useRescueImport.ts`)
- Rescue processing → Legacy parser: parses snapshots (evidence: `features/rescue/rescue.ts`)
- Rescue processing → Device database: stores rescue state (evidence: `features/rescue/rescue.ts`)
- Rescue processing → Supabase RPC API: uploads and verifies (evidence: `features/rescue/rescue.ts`)
