# sor-channorakpitou/medflow architecture

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

- Interactive diagram: https://gitdiagram.com/sor-channorakpitou/medflow
- Repository: https://github.com/sor-channorakpitou/medflow

## Overview

MedFlow coordinates a hospital visit from reception and appointment booking through triage, clinical consultation, medication fulfillment, billing, and completion. Staff use role-specific dashboards; the backend exposes the workflow through Express routes, controllers, and services, with Prisma-backed state and Socket.IO updates. The README documents additional pipeline and reporting capabilities beyond the sampled source, so those branches are represented at their documented subsystem paths; links are limited where implementation wiring was not sampled.

Main entry points: [`Backend/src/controllers`](https://github.com/sor-channorakpitou/medflow/tree/master/Backend/src/controllers) (Request controllers), [`Backend/src/lib/prisma.ts`](https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/lib/prisma.ts) (Prisma client), [`Frontend/medflow-web/src/App.jsx`](https://github.com/sor-channorakpitou/medflow/blob/master/Frontend/medflow-web/src/App.jsx) (Role-based app), [`Frontend/medflow-web/src/services`](https://github.com/sor-channorakpitou/medflow/tree/master/Frontend/medflow-web/src/services) (API services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Staff dashboards"]
  node_app["Role-based app<br/>[App.jsx]"]
  node_reception["Reception desk"]
  node_nurse["Nurse dashboard<br/>[NurseDash.jsx]"]
  node_doctor["Doctor dashboard<br/>[DoctorDash.jsx]"]
  node_pharmacist["Pharmacy dashboard<br/>[PharmacistDash.jsx]"]
  node_admin["Admin analytics<br/>[AdminDash.jsx]"]
  node_frontend_api["API services"]
end

subgraph group_api["Backend API"]
  node_http["HTTP API<br/>[app.ts]"]
  node_auth["Authentication<br/>[authService.ts]"]
  node_auth_routes["Auth endpoints<br/>[authRoute.ts]"]
  node_controllers["Request controllers"]
  node_prisma["Prisma client<br/>[prisma.ts]"]
end

subgraph group_clinical["Clinical workflow"]
  node_patient_appointment["Registration and appointments"]
  node_triage["Triage and urgency<br/>[triageService.ts]"]
  node_consult["Consultation and records"]
  node_queue["Queue workflow<br/>[queueService.ts]"]
end

subgraph group_operations["Fulfillment and administration"]
  node_prescription["Prescriptions"]
  node_medication["Medication inventory"]
  node_billing["Invoices and billing<br/>[billingService.ts]"]
  node_admin_service["Staff and reporting<br/>[adminService.ts]"]
end

subgraph group_realtime["Live updates"]
  node_socket_server["Socket.IO server<br/>[server.ts]"]
  node_socket_context["Socket context<br/>[SocketContext.jsx]"]
end

node_staff(("Hospital staff"))
node_database[("PostgreSQL")]
node_cloudinary{{"Cloudinary"}}

node_staff -->|"uses"| node_app
node_app -->|"routes to"| node_reception
node_app -->|"routes to"| node_nurse
node_app -->|"routes to"| node_doctor
node_app -->|"routes to"| node_pharmacist
node_app -->|"routes to"| node_admin
node_reception -->|"requests"| node_frontend_api
node_nurse -->|"requests"| node_frontend_api
node_doctor -->|"requests"| node_frontend_api
node_pharmacist -->|"requests"| node_frontend_api
node_admin -->|"requests"| node_frontend_api
node_frontend_api -->|"HTTP requests"| node_http
node_http -->|"mounts"| node_auth_routes
node_auth_routes -->|"dispatches"| node_auth
node_http -->|"dispatches"| node_controllers
node_controllers -->|"delegates"| node_patient_appointment
node_controllers -->|"delegates"| node_triage
node_controllers -->|"delegates"| node_consult
node_controllers -->|"delegates"| node_prescription
node_controllers -->|"delegates"| node_medication
node_controllers -->|"delegates"| node_billing
node_controllers -->|"delegates"| node_admin_service
node_controllers -->|"delegates"| node_queue
node_auth -->|"reads and writes"| node_prisma
node_consult -->|"persists records"| node_prisma
node_triage -->|"persists triage"| node_prisma
node_prescription -->|"updates prescriptions"| node_prisma
node_medication -->|"reads inventory"| node_prisma
node_billing -->|"persists invoices"| node_prisma
node_admin_service -->|"queries data"| node_prisma
node_queue -->|"updates queue"| node_prisma
node_prisma -->|"queries"| node_database
node_controllers -->|"emits events"| node_socket_server
node_socket_server -->|"broadcasts events"| node_socket_context
node_socket_context -->|"updates live"| node_reception
node_socket_context -->|"updates live"| node_nurse
node_socket_context -->|"updates live"| node_doctor
node_socket_context -->|"updates live"| node_pharmacist
node_controllers -.->|"uploads images"| node_cloudinary

click node_app "https://github.com/sor-channorakpitou/medflow/blob/master/Frontend/medflow-web/src/App.jsx"
click node_reception "https://github.com/sor-channorakpitou/medflow/blob/master/Frontend/medflow-web/src/pages/ReceptionistDash.jsx"
click node_nurse "https://github.com/sor-channorakpitou/medflow/blob/master/Frontend/medflow-web/src/pages/NurseDash.jsx"
click node_doctor "https://github.com/sor-channorakpitou/medflow/blob/master/Frontend/medflow-web/src/pages/DoctorDash.jsx"
click node_pharmacist "https://github.com/sor-channorakpitou/medflow/blob/master/Frontend/medflow-web/src/pages/PharmacistDash.jsx"
click node_admin "https://github.com/sor-channorakpitou/medflow/blob/master/Frontend/medflow-web/src/pages/AdminDash.jsx"
click node_frontend_api "https://github.com/sor-channorakpitou/medflow/tree/master/Frontend/medflow-web/src/services"
click node_http "https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/app.ts"
click node_auth "https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/authService.ts"
click node_auth_routes "https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/routes/authRoute.ts"
click node_patient_appointment "https://github.com/sor-channorakpitou/medflow/tree/master/Backend/src/services"
click node_triage "https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/triageService.ts"
click node_consult "https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/consultationService.ts"
click node_prescription "https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/prescriptionService.ts"
click node_medication "https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/medicationService.ts"
click node_billing "https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/billingService.ts"
click node_admin_service "https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/adminService.ts"
click node_queue "https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/queueService.ts"
click node_controllers "https://github.com/sor-channorakpitou/medflow/tree/master/Backend/src/controllers"
click node_prisma "https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/lib/prisma.ts"
click node_socket_server "https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/server.ts"
click node_socket_context "https://github.com/sor-channorakpitou/medflow/blob/master/Frontend/medflow-web/src/context/SocketContext.jsx"

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_reception,node_nurse,node_doctor,node_pharmacist,node_admin,node_frontend_api toneBlue
class node_http,node_auth,node_auth_routes,node_controllers,node_prisma,node_database toneAmber
class node_patient_appointment,node_triage,node_consult,node_queue toneMint
class node_prescription,node_medication,node_billing,node_admin_service toneRose
class node_socket_server,node_socket_context,node_staff,node_cloudinary toneIndigo
```

## Components

### Staff dashboards

- [Role-based app](https://github.com/sor-channorakpitou/medflow/blob/master/Frontend/medflow-web/src/App.jsx): `Frontend/medflow-web/src/App.jsx`
- [Reception desk](https://github.com/sor-channorakpitou/medflow/blob/master/Frontend/medflow-web/src/pages/ReceptionistDash.jsx): `Frontend/medflow-web/src/pages/ReceptionistDash.jsx`
- [Nurse dashboard](https://github.com/sor-channorakpitou/medflow/blob/master/Frontend/medflow-web/src/pages/NurseDash.jsx): `Frontend/medflow-web/src/pages/NurseDash.jsx`
- [Doctor dashboard](https://github.com/sor-channorakpitou/medflow/blob/master/Frontend/medflow-web/src/pages/DoctorDash.jsx): `Frontend/medflow-web/src/pages/DoctorDash.jsx`
- [Pharmacy dashboard](https://github.com/sor-channorakpitou/medflow/blob/master/Frontend/medflow-web/src/pages/PharmacistDash.jsx): `Frontend/medflow-web/src/pages/PharmacistDash.jsx`
- [Admin analytics](https://github.com/sor-channorakpitou/medflow/blob/master/Frontend/medflow-web/src/pages/AdminDash.jsx): `Frontend/medflow-web/src/pages/AdminDash.jsx`
- [API services](https://github.com/sor-channorakpitou/medflow/tree/master/Frontend/medflow-web/src/services): `Frontend/medflow-web/src/services`

### Backend API

- [HTTP API](https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/app.ts): `Backend/src/app.ts`
- [Authentication](https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/authService.ts): `Backend/src/services/authService.ts`
- [Auth endpoints](https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/routes/authRoute.ts): `Backend/src/routes/authRoute.ts`
- [Request controllers](https://github.com/sor-channorakpitou/medflow/tree/master/Backend/src/controllers): `Backend/src/controllers`
- [Prisma client](https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/lib/prisma.ts): `Backend/src/lib/prisma.ts`

### Clinical workflow

- [Registration and appointments](https://github.com/sor-channorakpitou/medflow/tree/master/Backend/src/services): `Backend/src/services`
- [Triage and urgency](https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/triageService.ts): `Backend/src/services/triageService.ts`
- [Consultation and records](https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/consultationService.ts): `Backend/src/services/consultationService.ts`
- [Queue workflow](https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/queueService.ts): `Backend/src/services/queueService.ts`

### Fulfillment and administration

- [Prescriptions](https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/prescriptionService.ts): `Backend/src/services/prescriptionService.ts`
- [Medication inventory](https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/medicationService.ts): `Backend/src/services/medicationService.ts`
- [Invoices and billing](https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/billingService.ts): `Backend/src/services/billingService.ts`
- [Staff and reporting](https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/services/adminService.ts): `Backend/src/services/adminService.ts`

### Live updates

- [Socket.IO server](https://github.com/sor-channorakpitou/medflow/blob/master/Backend/src/server.ts): `Backend/src/server.ts`
- [Socket context](https://github.com/sor-channorakpitou/medflow/blob/master/Frontend/medflow-web/src/context/SocketContext.jsx): `Frontend/medflow-web/src/context/SocketContext.jsx`

### Other components

- **Hospital staff**
- **PostgreSQL**
- **Cloudinary**

## Connections

- Hospital staff → Role-based app: uses
- Role-based app → Reception desk: routes to
- Role-based app → Nurse dashboard: routes to
- Role-based app → Doctor dashboard: routes to
- Role-based app → Pharmacy dashboard: routes to
- Role-based app → Admin analytics: routes to
- Reception desk → API services: requests
- Nurse dashboard → API services: requests
- Doctor dashboard → API services: requests
- Pharmacy dashboard → API services: requests
- Admin analytics → API services: requests
- API services → HTTP API: HTTP requests
- HTTP API → Auth endpoints: mounts
- Auth endpoints → Authentication: dispatches
- HTTP API → Request controllers: dispatches
- Request controllers → Registration and appointments: delegates
- Request controllers → Triage and urgency: delegates
- Request controllers → Consultation and records: delegates
- Request controllers → Prescriptions: delegates
- Request controllers → Medication inventory: delegates
- Request controllers → Invoices and billing: delegates
- Request controllers → Staff and reporting: delegates
- Request controllers → Queue workflow: delegates
- Authentication → Prisma client: reads and writes
- Consultation and records → Prisma client: persists records
- Triage and urgency → Prisma client: persists triage
- Prescriptions → Prisma client: updates prescriptions
- Medication inventory → Prisma client: reads inventory
- Invoices and billing → Prisma client: persists invoices
- Staff and reporting → Prisma client: queries data
- Queue workflow → Prisma client: updates queue
- Prisma client → PostgreSQL: queries
- Request controllers → Socket.IO server: emits events
- Socket.IO server → Socket context: broadcasts events
- Socket context → Reception desk: updates live
- Socket context → Nurse dashboard: updates live
- Socket context → Doctor dashboard: updates live
- Socket context → Pharmacy dashboard: updates live
- Request controllers → Cloudinary: uploads images
