# haha7000/promise-cafe-kiosk architecture

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

- Interactive diagram: https://gitdiagram.com/haha7000/promise-cafe-kiosk
- Repository: https://github.com/haha7000/promise-cafe-kiosk

## Overview

P.M CAFE is a church-café kiosk system supporting personal QR and shared-cell point payments, barista order handling, and administration of menus, cells, settlements, and sales statistics. The principal workflow moves from payment-mode selection and (for cell payments) cell authentication through menu/options and cart selection to order creation and customer completion; baristas then manage order status. The React client calls a FastAPI backend backed by PostgreSQL. Frontend routing and kiosk order submission are excerpted; several backend router capabilities are documented or indexed but their internals were not sampled, so those links are omitted or marked unverified.

Main entry points: [`PmCafeFrontend/shared/api/client.ts`](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/shared/api/client.ts) (API client), [`PmCafeFrontend/pages/KioskPage.tsx`](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/pages/KioskPage.tsx) (Kiosk flow), [`PmCafeFrontend/pages/admin`](https://github.com/haha7000/promise-cafe-kiosk/tree/main/PmCafeFrontend/pages/admin) (Admin pages), [`PmCafeBackend/app/main.py`](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeBackend/app/main.py) (FastAPI application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_kiosk["Kiosk ordering"]
  node_kiosk_page["Kiosk flow<br/>[KioskPage.tsx]"]
  node_kiosk_views["Menu and payment views<br/>[MenuViews.tsx]"]
  node_option_modal["Option selection<br/>[OptionModal.tsx]"]
  node_order_context["Order state<br/>[OrderContext.tsx]"]
end

subgraph group_operations["Cafe operations"]
  node_barista["Barista order board<br/>[BaristaView.tsx]"]
end

subgraph group_admin["Administration"]
  node_admin_routes["Admin pages"]
  node_cell_admin["Cell and points<br/>[AdminCellsPage.tsx]"]
  node_menu_admin["Menu management<br/>[AdminMenusPage.tsx]"]
  node_settlement_admin["Settlement management"]
  node_statistics_admin["Sales statistics"]
end

subgraph group_backend["Backend API"]
  node_api_client["API client<br/>[client.ts]"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_business_routes["Cafe API routes"]
  node_order_service["Order business logic<br/>[order_service.py]"]
end

subgraph group_security["Identity and storage"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_auth_dependency["JWT authorization<br/>[auth.py]"]
  node_auth_utils["Token utilities<br/>[auth.py]"]
  node_database[("PostgreSQL session<br/>[database.py]")]
  node_models["Cafe data models"]
end

node_customer(("Cafe customer"))
node_barista_actor(("Barista"))
node_admin_actor(("Administrator"))

node_customer -->|"places order"| node_kiosk_page
node_kiosk_page -->|"renders"| node_kiosk_views
node_kiosk_page -->|"opens options"| node_option_modal
node_kiosk_page -->|"creates order"| node_api_client
node_kiosk_page -->|"adds order"| node_order_context
node_order_context -->|"loads and updates"| node_api_client
node_barista_actor -.->|"manages orders"| node_barista
node_admin_actor -->|"manages cafe"| node_admin_routes
node_admin_routes -->|"routes to"| node_cell_admin
node_admin_routes -->|"routes to"| node_menu_admin
node_admin_routes -->|"routes to"| node_settlement_admin
node_admin_routes -->|"routes to"| node_statistics_admin
node_cell_admin -.->|"uses API"| node_api_client
node_menu_admin -.->|"uses API"| node_api_client
node_settlement_admin -.->|"uses API"| node_api_client
node_statistics_admin -.->|"uses API"| node_api_client
node_api_client -.->|"sends requests"| node_api_app
node_api_app -->|"registers"| node_auth_routes
node_api_app -->|"registers"| node_business_routes
node_auth_routes -->|"verifies token"| node_auth_dependency
node_auth_dependency -->|"decodes token"| node_auth_utils
node_auth_routes -->|"queries session"| node_database
node_auth_dependency -->|"loads user"| node_database
node_order_service -->|"uses order and payment models"| node_models
node_business_routes -.->|"dispatches orders"| node_order_service
node_order_service -.->|"reads and writes"| node_database

click node_kiosk_page "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/pages/KioskPage.tsx"
click node_kiosk_views "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/components/MenuViews.tsx"
click node_option_modal "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/components/OptionModal.tsx"
click node_order_context "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/shared/contexts/OrderContext.tsx"
click node_api_client "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/shared/api/client.ts"
click node_barista "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/components/BaristaView.tsx"
click node_admin_routes "https://github.com/haha7000/promise-cafe-kiosk/tree/main/PmCafeFrontend/pages/admin"
click node_cell_admin "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/pages/admin/AdminCellsPage.tsx"
click node_menu_admin "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/pages/admin/AdminMenusPage.tsx"
click node_settlement_admin "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/pages/admin/AdminSettlementsPage.tsx"
click node_statistics_admin "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/pages/admin/AdminStatisticsPage.tsx"
click node_api_app "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeBackend/app/main.py"
click node_auth_routes "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeBackend/app/routers/auth.py"
click node_auth_dependency "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeBackend/app/dependencies/auth.py"
click node_auth_utils "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeBackend/app/utils/auth.py"
click node_business_routes "https://github.com/haha7000/promise-cafe-kiosk/tree/main/PmCafeBackend/app/routers"
click node_order_service "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeBackend/app/services/order_service.py"
click node_database "https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeBackend/app/database.py"
click node_models "https://github.com/haha7000/promise-cafe-kiosk/tree/main/PmCafeBackend/app/models"

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_kiosk_page,node_kiosk_views,node_option_modal,node_order_context toneBlue
class node_barista toneAmber
class node_admin_routes,node_cell_admin,node_menu_admin,node_settlement_admin,node_statistics_admin toneMint
class node_api_client,node_api_app,node_business_routes,node_order_service toneRose
class node_auth_routes,node_auth_dependency,node_auth_utils,node_database,node_models,node_customer,node_barista_actor,node_admin_actor toneIndigo
```

## Components

### Kiosk ordering

- [Kiosk flow](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/pages/KioskPage.tsx): `PmCafeFrontend/pages/KioskPage.tsx`
- [Menu and payment views](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/components/MenuViews.tsx): `PmCafeFrontend/components/MenuViews.tsx`
- [Option selection](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/components/OptionModal.tsx): `PmCafeFrontend/components/OptionModal.tsx`
- [Order state](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/shared/contexts/OrderContext.tsx): `PmCafeFrontend/shared/contexts/OrderContext.tsx`

### Cafe operations

- [Barista order board](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/components/BaristaView.tsx): `PmCafeFrontend/components/BaristaView.tsx`

### Administration

- [Admin pages](https://github.com/haha7000/promise-cafe-kiosk/tree/main/PmCafeFrontend/pages/admin): `PmCafeFrontend/pages/admin`
- [Cell and points](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/pages/admin/AdminCellsPage.tsx): `PmCafeFrontend/pages/admin/AdminCellsPage.tsx`
- [Menu management](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/pages/admin/AdminMenusPage.tsx): `PmCafeFrontend/pages/admin/AdminMenusPage.tsx`
- [Settlement management](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/pages/admin/AdminSettlementsPage.tsx): `PmCafeFrontend/pages/admin/AdminSettlementsPage.tsx`
- [Sales statistics](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/pages/admin/AdminStatisticsPage.tsx): `PmCafeFrontend/pages/admin/AdminStatisticsPage.tsx`

### Backend API

- [API client](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeFrontend/shared/api/client.ts): `PmCafeFrontend/shared/api/client.ts`
- [FastAPI application](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeBackend/app/main.py): `PmCafeBackend/app/main.py`
- [Cafe API routes](https://github.com/haha7000/promise-cafe-kiosk/tree/main/PmCafeBackend/app/routers): `PmCafeBackend/app/routers`
- [Order business logic](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeBackend/app/services/order_service.py): `PmCafeBackend/app/services/order_service.py`

### Identity and storage

- [Authentication routes](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeBackend/app/routers/auth.py): `PmCafeBackend/app/routers/auth.py`
- [JWT authorization](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeBackend/app/dependencies/auth.py): `PmCafeBackend/app/dependencies/auth.py`
- [Token utilities](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeBackend/app/utils/auth.py): `PmCafeBackend/app/utils/auth.py`
- [PostgreSQL session](https://github.com/haha7000/promise-cafe-kiosk/blob/main/PmCafeBackend/app/database.py): `PmCafeBackend/app/database.py`
- [Cafe data models](https://github.com/haha7000/promise-cafe-kiosk/tree/main/PmCafeBackend/app/models): `PmCafeBackend/app/models`

### Other components

- **Cafe customer**
- **Barista**
- **Administrator**

## Connections

- Cafe customer → Kiosk flow: places order
- Kiosk flow → Menu and payment views: renders (evidence: `PmCafeFrontend/pages/KioskPage.tsx`)
- Kiosk flow → Option selection: opens options (evidence: `PmCafeFrontend/pages/KioskPage.tsx`)
- Kiosk flow → API client: creates order (evidence: `PmCafeFrontend/pages/KioskPage.tsx`)
- Kiosk flow → Order state: adds order (evidence: `PmCafeFrontend/pages/KioskPage.tsx`)
- Order state → API client: loads and updates (evidence: `PmCafeFrontend/shared/contexts/OrderContext.tsx`)
- Barista → Barista order board: manages orders
- Administrator → Admin pages: manages cafe
- Admin pages → Cell and points: routes to (evidence: `PmCafeFrontend/App.tsx`)
- Admin pages → Menu management: routes to (evidence: `PmCafeFrontend/App.tsx`)
- Admin pages → Settlement management: routes to (evidence: `PmCafeFrontend/App.tsx`)
- Admin pages → Sales statistics: routes to (evidence: `PmCafeFrontend/App.tsx`)
- Cell and points → API client: uses API
- Menu management → API client: uses API
- Settlement management → API client: uses API
- Sales statistics → API client: uses API
- API client → FastAPI application: sends requests
- FastAPI application → Authentication routes: registers (evidence: `PmCafeBackend/app/main.py`)
- FastAPI application → Cafe API routes: registers (evidence: `PmCafeBackend/app/main.py`)
- Authentication routes → JWT authorization: verifies token (evidence: `PmCafeBackend/app/routers/auth.py`)
- JWT authorization → Token utilities: decodes token (evidence: `PmCafeBackend/app/dependencies/auth.py`)
- Authentication routes → PostgreSQL session: queries session (evidence: `PmCafeBackend/app/routers/auth.py`)
- JWT authorization → PostgreSQL session: loads user (evidence: `PmCafeBackend/app/dependencies/auth.py`)
- Order business logic → Cafe data models: uses order and payment models (evidence: `PmCafeBackend/app/services/order_service.py`)
- Cafe API routes → Order business logic: dispatches orders
- Order business logic → PostgreSQL session: reads and writes
