# getwaitwise/waitwise architecture

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

- Interactive diagram: https://gitdiagram.com/getwaitwise/waitwise
- Repository: https://github.com/getwaitwise/waitwise

## Overview

WaitWise is a hospital queue and appointment platform: patients find a service, book or claim a token, pay when required, then track queue progress; staff and administrators manage counters, doctors, services, and payments. The mobile and web apps provide patient and operational interfaces, backed by a FastAPI API and Supabase. The API also supports prediction, AI-assisted help, queue notifications, and daily summaries. Sampled code confirms API startup wiring, payment processing, and several admin database interactions; other links reflect documented route and feature structure in the tree.

Main entry points: [`apps/api/app/main.py`](https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/main.py) (FastAPI app), [`apps/mobile/src/app/(app)`](https://github.com/getwaitwise/waitwise/tree/main/apps/mobile/src/app/(app)) (Mobile app), [`apps/api/app/payments/routes.py`](https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/payments/routes.py) (Payment routes), [`apps/web/src/app/admin`](https://github.com/getwaitwise/waitwise/tree/main/apps/web/src/app/admin) (Admin console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Patient apps"]
  node_mobile["Mobile app"]
  node_publicweb["Public web"]
  node_booking["Token booking<br/>[take-token.tsx]"]
  node_checkout["Payment checkout<br/>[&#91;holdId&#93;.tsx]"]
  node_tokenstatus["Token status"]
  node_help["Help and FAQ"]
end

subgraph group_operations["Queue operations"]
  node_staff["Staff tools"]
  node_doctor["Doctor desk"]
  node_display["Queue display"]
  node_admin["Admin console"]
  node_adminstaff["Staff management API<br/>[route.ts]"]
end

subgraph group_backend["API services"]
  node_api["FastAPI app<br/>[main.py]"]
  node_apiroutes["API routes"]
  node_payments["Payment routes<br/>[routes.py]"]
  node_prediction["Wait prediction<br/>[predict.py]"]
  node_aihelp["AI help<br/>[ai_ask.py]"]
  node_notifications["Queue notifications<br/>[notifications.py]"]
  node_summary["Daily summaries<br/>[summary.py]"]
  node_ml["ML runtime<br/>[ml_runtime.py]"]
end

subgraph group_integrations["External services"]
  node_supabase[("Supabase")]
  node_razorpay["Razorpay"]
  node_deepseek["DeepSeek"]
end

node_patient(("Patient"))

node_patient -->|"uses"| node_mobile
node_patient -->|"uses"| node_publicweb
node_mobile -->|"books token"| node_booking
node_booking -.->|"continues payment"| node_checkout
node_patient -->|"checks status"| node_tokenstatus
node_mobile -->|"opens help"| node_help
node_api -->|"dispatches"| node_apiroutes
node_api -->|"mounts routes"| node_payments
node_api -->|"loads model"| node_ml
node_api -->|"starts tasks"| node_notifications
node_api -->|"starts loop"| node_summary
node_payments -->|"reads and writes"| node_supabase
node_payments -.->|"handles payments"| node_razorpay
node_admin -->|"manages records"| node_supabase
node_admin -->|"requests staff changes"| node_adminstaff
node_adminstaff -->|"manages accounts"| node_supabase
node_staff -.->|"operates queue"| node_supabase
node_doctor -.->|"manages visits"| node_supabase
node_display -.->|"reads queue"| node_supabase
node_prediction -.->|"uses model"| node_ml
node_aihelp -.->|"asks model"| node_deepseek
node_notifications -->|"listens and polls"| node_supabase
node_summary -->|"reads queue data"| node_supabase

click node_mobile "https://github.com/getwaitwise/waitwise/tree/main/apps/mobile/src/app/(app)"
click node_publicweb "https://github.com/getwaitwise/waitwise/tree/main/apps/web/src/app"
click node_booking "https://github.com/getwaitwise/waitwise/blob/main/apps/mobile/src/app/(app)/take-token.tsx"
click node_checkout "https://github.com/getwaitwise/waitwise/blob/main/apps/mobile/src/app/(app)/checkout/%5BholdId%5D.tsx"
click node_tokenstatus "https://github.com/getwaitwise/waitwise/tree/main/apps/web/src/app/t/%5Bid%5D"
click node_help "https://github.com/getwaitwise/waitwise/tree/main/apps/mobile/src/app/(app)/help"
click node_staff "https://github.com/getwaitwise/waitwise/tree/main/apps/web/src/app/counter"
click node_doctor "https://github.com/getwaitwise/waitwise/tree/main/apps/web/src/app/doctor"
click node_display "https://github.com/getwaitwise/waitwise/tree/main/apps/web/src/app/display/%5Bservice%5D"
click node_admin "https://github.com/getwaitwise/waitwise/tree/main/apps/web/src/app/admin"
click node_adminstaff "https://github.com/getwaitwise/waitwise/blob/main/apps/web/src/app/api/admin/staff/route.ts"
click node_api "https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/main.py"
click node_apiroutes "https://github.com/getwaitwise/waitwise/tree/main/apps/api/app/routes"
click node_payments "https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/payments/routes.py"
click node_prediction "https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/routes/predict.py"
click node_aihelp "https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/ai_ask.py"
click node_notifications "https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/notifications.py"
click node_summary "https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/summary.py"
click node_ml "https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/ml_runtime.py"

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_mobile,node_publicweb,node_booking,node_checkout,node_tokenstatus,node_help toneBlue
class node_staff,node_doctor,node_display,node_admin,node_adminstaff toneAmber
class node_api,node_apiroutes,node_payments,node_prediction,node_aihelp,node_notifications,node_summary,node_ml toneMint
class node_supabase,node_razorpay,node_deepseek toneRose
class node_patient toneIndigo
```

## Components

### Patient apps

- [Mobile app](https://github.com/getwaitwise/waitwise/tree/main/apps/mobile/src/app/(app)): `apps/mobile/src/app/(app)`
- [Public web](https://github.com/getwaitwise/waitwise/tree/main/apps/web/src/app): `apps/web/src/app`
- [Token booking](https://github.com/getwaitwise/waitwise/blob/main/apps/mobile/src/app/(app)/take-token.tsx): `apps/mobile/src/app/(app)/take-token.tsx`
- [Payment checkout](https://github.com/getwaitwise/waitwise/blob/main/apps/mobile/src/app/(app)/checkout/%5BholdId%5D.tsx): `apps/mobile/src/app/(app)/checkout/[holdId].tsx`
- [Token status](https://github.com/getwaitwise/waitwise/tree/main/apps/web/src/app/t/%5Bid%5D): `apps/web/src/app/t/[id]`
- [Help and FAQ](https://github.com/getwaitwise/waitwise/tree/main/apps/mobile/src/app/(app)/help): `apps/mobile/src/app/(app)/help`

### Queue operations

- [Staff tools](https://github.com/getwaitwise/waitwise/tree/main/apps/web/src/app/counter): `apps/web/src/app/counter`
- [Doctor desk](https://github.com/getwaitwise/waitwise/tree/main/apps/web/src/app/doctor): `apps/web/src/app/doctor`
- [Queue display](https://github.com/getwaitwise/waitwise/tree/main/apps/web/src/app/display/%5Bservice%5D): `apps/web/src/app/display/[service]`
- [Admin console](https://github.com/getwaitwise/waitwise/tree/main/apps/web/src/app/admin): `apps/web/src/app/admin`
- [Staff management API](https://github.com/getwaitwise/waitwise/blob/main/apps/web/src/app/api/admin/staff/route.ts): `apps/web/src/app/api/admin/staff/route.ts`

### API services

- [FastAPI app](https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/main.py): `apps/api/app/main.py`
- [API routes](https://github.com/getwaitwise/waitwise/tree/main/apps/api/app/routes): `apps/api/app/routes`
- [Payment routes](https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/payments/routes.py): `apps/api/app/payments/routes.py`
- [Wait prediction](https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/routes/predict.py): `apps/api/app/routes/predict.py`
- [AI help](https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/ai_ask.py): `apps/api/app/ai_ask.py`
- [Queue notifications](https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/notifications.py): `apps/api/app/notifications.py`
- [Daily summaries](https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/summary.py): `apps/api/app/summary.py`
- [ML runtime](https://github.com/getwaitwise/waitwise/blob/main/apps/api/app/ml_runtime.py): `apps/api/app/ml_runtime.py`

### External services

- **Supabase**
- **Razorpay**
- **DeepSeek**

### Other components

- **Patient**

## Connections

- Patient → Mobile app: uses
- Patient → Public web: uses
- Mobile app → Token booking: books token
- Token booking → Payment checkout: continues payment
- Patient → Token status: checks status
- Mobile app → Help and FAQ: opens help
- FastAPI app → API routes: dispatches
- FastAPI app → Payment routes: mounts routes
- FastAPI app → ML runtime: loads model
- FastAPI app → Queue notifications: starts tasks
- FastAPI app → Daily summaries: starts loop
- Payment routes → Supabase: reads and writes
- Payment routes → Razorpay: handles payments
- Admin console → Supabase: manages records
- Admin console → Staff management API: requests staff changes
- Staff management API → Supabase: manages accounts
- Staff tools → Supabase: operates queue
- Doctor desk → Supabase: manages visits
- Queue display → Supabase: reads queue
- Wait prediction → ML runtime: uses model
- AI help → DeepSeek: asks model
- Queue notifications → Supabase: listens and polls
- Daily summaries → Supabase: reads queue data
