# williamsjohnetanami/clinic-flow architecture

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

- Interactive diagram: https://gitdiagram.com/williamsjohnetanami/clinic-flow
- Repository: https://github.com/williamsjohnetanami/clinic-flow

## Overview

VitaFlow is a campus-clinic patient-flow system: patients and staff use role-specific web screens to authenticate, manage appointments and walk-ins, operate the queue, and view live status and analytics. The frontend’s API client is the HTTP boundary to an Express backend, whose API router dispatches server-side work. The route inventory and product capabilities are documented in the source index and landing-page excerpt; unsampled route and service internals limit confidence about their exact calls, so those links are omitted or marked unverified.

Main entry points: [`src/routeTree.gen.ts`](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routeTree.gen.ts) (Route registry), [`server/src/routes`](https://github.com/williamsjohnetanami/clinic-flow/tree/main/server/src/routes) (API router), [`server/src/queue/queue.service.ts`](https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/queue/queue.service.ts) (Queue service), [`src/lib/api/client.ts`](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/lib/api/client.ts) (HTTP API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_router["Web router<br/>[router.tsx]"]
  node_route_tree["Route registry<br/>[routeTree.gen.ts]"]
  node_landing["Clinic landing<br/>[index.tsx]"]
  node_auth_screen["Sign-in screen<br/>[auth.tsx]"]
  node_staff_screens["Staff workspaces<br/>[admin.tsx]"]
  node_appointments_screen["Appointments screen<br/>[appointments.tsx]"]
  node_patient_screen["Patient workspace<br/>[patient.tsx]"]
  node_doctor_screen["Doctor workspace<br/>[doctor.tsx]"]
  node_reception_screen["Reception workspace<br/>[reception.tsx]"]
  node_display_screen["Live queue board<br/>[display.tsx]"]
end

subgraph group_identity["Identity and API"]
  node_auth_context["Session handling<br/>[context.tsx]"]
  node_api_client["HTTP API client<br/>[client.ts]"]
end

subgraph group_clinic["Clinic operations"]
  node_queue_views["Queue controls"]
  node_queue_state["Queue state<br/>[store.ts]"]
  node_queue_analytics["Queue analytics<br/>[analytics.ts]"]
  node_appointment_state["Appointment state"]
end

subgraph group_server["Backend services"]
  node_api_router["API router"]
  node_auth_service["Authentication service<br/>[auth.service.ts]"]
  node_queue_controller["Queue controller"]
  node_queue_service["Queue service<br/>[queue.service.ts]"]
  node_queue_ordering["Priority ordering<br/>[queue-ordering.ts]"]
  node_token_counter["Token generation<br/>[token-counter.ts]"]
  node_appointment_service["Appointment service"]
  node_patient_service["Patient service<br/>[patient.service.ts]"]
  node_notification_service["Notifications"]
end

node_visitor(("Clinic users"))
node_database[("Application database")]
node_backend["VitaFlow API"]

node_visitor -->|"uses"| node_router
node_router -->|"loads routes"| node_route_tree
node_route_tree -->|"registers"| node_landing
node_route_tree -->|"registers"| node_auth_screen
node_route_tree -->|"registers"| node_staff_screens
node_route_tree -->|"registers"| node_appointments_screen
node_route_tree -->|"registers"| node_patient_screen
node_route_tree -->|"registers"| node_doctor_screen
node_route_tree -->|"registers"| node_reception_screen
node_route_tree -->|"registers"| node_display_screen
node_auth_screen -->|"uses"| node_auth_context
node_auth_context -->|"calls auth"| node_api_client
node_api_client -->|"sends HTTP requests"| node_backend
node_backend -.->|"dispatches API requests"| node_api_router
node_api_router -.->|"dispatches auth"| node_auth_service
node_api_router -.->|"dispatches queue"| node_queue_controller
node_queue_controller -.->|"delegates queue work"| node_queue_service
node_queue_service -->|"uses ordering"| node_queue_ordering
node_queue_service -->|"uses token counter"| node_token_counter
node_api_router -.->|"dispatches appointments"| node_appointment_service
node_api_router -.->|"dispatches patient work"| node_patient_service
node_api_router -.->|"dispatches notifications"| node_notification_service
node_queue_views -.->|"uses queue state"| node_queue_state
node_queue_analytics -.->|"analyzes queue state"| node_queue_state
node_appointment_state -.->|"requests appointment data"| node_api_client
node_queue_state -.->|"requests queue data"| node_api_client
node_queue_service -.->|"reads and writes"| node_database
node_appointment_service -.->|"reads and writes"| node_database

click node_router "https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/router.tsx"
click node_route_tree "https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routeTree.gen.ts"
click node_landing "https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/index.tsx"
click node_auth_screen "https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/auth.tsx"
click node_staff_screens "https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/admin.tsx"
click node_appointments_screen "https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/appointments.tsx"
click node_patient_screen "https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/patient.tsx"
click node_doctor_screen "https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/doctor.tsx"
click node_reception_screen "https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/reception.tsx"
click node_display_screen "https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/display.tsx"
click node_auth_context "https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/lib/auth/context.tsx"
click node_api_client "https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/lib/api/client.ts"
click node_queue_views "https://github.com/williamsjohnetanami/clinic-flow/tree/main/src/components/queue"
click node_queue_state "https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/lib/queue/store.ts"
click node_queue_analytics "https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/lib/queue/analytics.ts"
click node_appointment_state "https://github.com/williamsjohnetanami/clinic-flow/tree/main/src/lib/appointments"
click node_api_router "https://github.com/williamsjohnetanami/clinic-flow/tree/main/server/src/routes"
click node_auth_service "https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/services/auth.service.ts"
click node_queue_controller "https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/controllers/queue.controller.ts"
click node_queue_service "https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/queue/queue.service.ts"
click node_queue_ordering "https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/queue/queue-ordering.ts"
click node_token_counter "https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/queue/token-counter.ts"
click node_appointment_service "https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/services/appointment.service.ts"
click node_patient_service "https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/services/patient.service.ts"
click node_notification_service "https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/services/notification.service.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_router,node_route_tree,node_landing,node_auth_screen,node_staff_screens,node_appointments_screen,node_patient_screen,node_doctor_screen,node_reception_screen,node_display_screen,node_visitor toneBlue
class node_auth_context,node_api_client,node_database toneAmber
class node_queue_views,node_queue_state,node_queue_analytics,node_appointment_state,node_backend toneMint
class node_api_router,node_auth_service,node_queue_controller,node_queue_service,node_queue_ordering,node_token_counter,node_appointment_service,node_patient_service,node_notification_service toneRose
```

## Components

### Web experience

- [Web router](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/router.tsx): `src/router.tsx`
- [Route registry](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routeTree.gen.ts): `src/routeTree.gen.ts`
- [Clinic landing](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Sign-in screen](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/auth.tsx): `src/routes/auth.tsx`
- [Staff workspaces](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/admin.tsx): `src/routes/admin.tsx`
- [Appointments screen](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/appointments.tsx): `src/routes/appointments.tsx`
- [Patient workspace](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/patient.tsx): `src/routes/patient.tsx`
- [Doctor workspace](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/doctor.tsx): `src/routes/doctor.tsx`
- [Reception workspace](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/reception.tsx): `src/routes/reception.tsx`
- [Live queue board](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/routes/display.tsx): `src/routes/display.tsx`

### Identity and API

- [Session handling](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/lib/auth/context.tsx): `src/lib/auth/context.tsx`
- [HTTP API client](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/lib/api/client.ts): `src/lib/api/client.ts`

### Clinic operations

- [Queue controls](https://github.com/williamsjohnetanami/clinic-flow/tree/main/src/components/queue): `src/components/queue`
- [Queue state](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/lib/queue/store.ts): `src/lib/queue/store.ts`
- [Queue analytics](https://github.com/williamsjohnetanami/clinic-flow/blob/main/src/lib/queue/analytics.ts): `src/lib/queue/analytics.ts`
- [Appointment state](https://github.com/williamsjohnetanami/clinic-flow/tree/main/src/lib/appointments): `src/lib/appointments`

### Backend services

- [API router](https://github.com/williamsjohnetanami/clinic-flow/tree/main/server/src/routes): `server/src/routes`
- [Authentication service](https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/services/auth.service.ts): `server/src/services/auth.service.ts`
- [Queue controller](https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/controllers/queue.controller.ts): `server/src/controllers/queue.controller.ts`
- [Queue service](https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/queue/queue.service.ts): `server/src/queue/queue.service.ts`
- [Priority ordering](https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/queue/queue-ordering.ts): `server/src/queue/queue-ordering.ts`
- [Token generation](https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/queue/token-counter.ts): `server/src/queue/token-counter.ts`
- [Appointment service](https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/services/appointment.service.ts): `server/src/services/appointment.service.ts`
- [Patient service](https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/services/patient.service.ts): `server/src/services/patient.service.ts`
- [Notifications](https://github.com/williamsjohnetanami/clinic-flow/blob/main/server/src/services/notification.service.ts): `server/src/services/notification.service.ts`

### Other components

- **Clinic users**
- **Application database**
- **VitaFlow API**

## Connections

- Clinic users → Web router: uses (evidence: `src/router.tsx`)
- Web router → Route registry: loads routes (evidence: `src/router.tsx`)
- Route registry → Clinic landing: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Sign-in screen: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Staff workspaces: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Appointments screen: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Patient workspace: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Doctor workspace: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Reception workspace: registers (evidence: `src/routeTree.gen.ts`)
- Route registry → Live queue board: registers (evidence: `src/routeTree.gen.ts`)
- Sign-in screen → Session handling: uses (evidence: `src/routes/auth.tsx`)
- Session handling → HTTP API client: calls auth (evidence: `src/lib/auth/context.tsx`)
- HTTP API client → VitaFlow API: sends HTTP requests (evidence: `src/lib/api/client.ts`)
- VitaFlow API → API router: dispatches API requests
- API router → Authentication service: dispatches auth
- API router → Queue controller: dispatches queue
- Queue controller → Queue service: delegates queue work
- Queue service → Priority ordering: uses ordering (evidence: `server/src/queue/queue.service.ts`)
- Queue service → Token generation: uses token counter (evidence: `server/src/queue/queue.service.ts`)
- API router → Appointment service: dispatches appointments
- API router → Patient service: dispatches patient work
- API router → Notifications: dispatches notifications
- Queue controls → Queue state: uses queue state
- Queue analytics → Queue state: analyzes queue state
- Appointment state → HTTP API client: requests appointment data
- Queue state → HTTP API client: requests queue data
- Queue service → Application database: reads and writes
- Appointment service → Application database: reads and writes
