# wantedfelconer/clinic-os architecture

> Architecture diagram of the GitHub repository wantedfelconer/clinic-os, 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/wantedfelconer/clinic-os
- Repository: https://github.com/wantedfelconer/clinic-os

## Overview

ClinicOS is a multi-tenant clinic-management SaaS for patients, clinic staff, doctors, and platform administrators. The principal workflow spans clinic and patient management, appointment booking, clinical records and prescriptions, and billing; communications and reviews provide related patient-facing capabilities, while subscriptions and administration govern the platform. The React client uses feature modules and API wrappers to reach an Express server organized into domain modules, with MySQL persistence. Sampled controllers show cross-domain calls for appointments, payments, patient records, prescriptions, and reviews. Other client-to-server wiring is inferred only at the documented REST boundary; unsampled module internals are not detailed.

Main entry points: [`server/src/index.js`](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/index.js) (Express API), [`server/src/modules/patients/controllers/patientController.js`](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/patients/controllers/patientController.js) (Patient registry), [`server/src/core/config/database.js`](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/core/config/database.js) (MySQL database), [`server/src/modules/appointments/controllers/appointmentController.js`](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/appointments/controllers/appointmentController.js) (Appointments)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_webapp["ClinicOS app<br/>[ClinicOSApp.tsx]"]
  node_patientui["Patient portal<br/>[PatientPortal.tsx]"]
  node_doctorui["Doctor dashboard"]
  node_adminui["Admin panel<br/>[AdminPanel.tsx]"]
  node_clientapi["API wrappers<br/>[index.ts]"]
end

subgraph group_clinical["Clinic workflows"]
  node_clinics["Clinics and staff"]
  node_patients["Patient registry"]
  node_appointments["Appointments"]
  node_emr["Medical records"]
  node_reports["Medical reports"]
  node_prescriptions["Prescriptions"]
  node_billing["Payments and receipts"]
  node_reviews["Reviews"]
end

subgraph group_platform["Platform services"]
  node_auth["Authentication<br/>[authController.js]"]
  node_communications["Messages and notices"]
  node_subscriptions["Subscriptions"]
  node_admin["Platform administration<br/>[adminController.js]"]
end

subgraph group_server["API and persistence"]
  node_serverentry["Express API<br/>[index.js]"]
  node_database[("MySQL database<br/>[database.js]")]
end

node_people(("Clinic users"))
node_email["Email delivery"]

node_people -->|"use"| node_webapp
node_webapp -->|"offers portal"| node_patientui
node_webapp -->|"offers dashboard"| node_doctorui
node_webapp -->|"offers admin"| node_adminui
node_patientui -->|"request data"| node_clientapi
node_doctorui -->|"request data"| node_clientapi
node_adminui -->|"request data"| node_clientapi
node_clientapi -->|"REST requests"| node_serverentry
node_serverentry -->|"dispatches"| node_auth
node_serverentry -->|"dispatches"| node_clinics
node_serverentry -->|"dispatches"| node_patients
node_serverentry -->|"dispatches"| node_appointments
node_serverentry -->|"dispatches"| node_emr
node_serverentry -->|"dispatches"| node_reports
node_serverentry -->|"dispatches"| node_prescriptions
node_serverentry -->|"dispatches"| node_billing
node_serverentry -->|"dispatches"| node_communications
node_serverentry -->|"dispatches"| node_reviews
node_serverentry -->|"dispatches"| node_subscriptions
node_serverentry -->|"dispatches"| node_admin
node_auth -->|"reads and writes"| node_database
node_clinics -->|"reads and writes"| node_database
node_patients -->|"reads and writes"| node_database
node_appointments -->|"reads and writes"| node_database
node_emr -->|"reads and writes"| node_database
node_reports -->|"reads and writes"| node_database
node_prescriptions -->|"reads and writes"| node_database
node_billing -->|"reads and writes"| node_database
node_communications -->|"reads and writes"| node_database
node_reviews -->|"reads and writes"| node_database
node_subscriptions -->|"reads and writes"| node_database
node_admin -->|"reads and writes"| node_database
node_appointments -->|"checks clinic services"| node_clinics
node_appointments -->|"validates patient"| node_patients
node_appointments -->|"creates notices"| node_communications
node_billing -->|"validates patient"| node_patients
node_billing -->|"checks appointment"| node_appointments
node_billing -->|"notifies patient"| node_communications
node_patients -->|"loads records"| node_emr
node_patients -->|"loads reports"| node_reports
node_patients -->|"loads appointments"| node_appointments
node_patients -->|"loads prescriptions"| node_prescriptions
node_patients -->|"loads payments"| node_billing
node_prescriptions -->|"checks ownership"| node_patients
node_prescriptions -->|"checks appointment"| node_appointments
node_prescriptions -->|"notifies patient"| node_communications
node_reviews -->|"resolves identity"| node_patients
node_reviews -->|"verifies appointment"| node_appointments

click node_webapp "https://github.com/wantedfelconer/clinic-os/blob/master/client/src/modules/application/ClinicOSApp.tsx"
click node_patientui "https://github.com/wantedfelconer/clinic-os/blob/master/client/src/modules/patient/PatientPortal.tsx"
click node_doctorui "https://github.com/wantedfelconer/clinic-os/blob/master/client/src/modules/dashboard/DoctorDashboard.tsx"
click node_adminui "https://github.com/wantedfelconer/clinic-os/blob/master/client/src/modules/admin/AdminPanel.tsx"
click node_clientapi "https://github.com/wantedfelconer/clinic-os/blob/master/client/src/app/api/index.ts"
click node_auth "https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/auth/controllers/authController.js"
click node_clinics "https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/clinics/controllers/clinicController.js"
click node_patients "https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/patients/controllers/patientController.js"
click node_appointments "https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/appointments/controllers/appointmentController.js"
click node_emr "https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/emr/controllers/medicalRecordController.js"
click node_reports "https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/emr/controllers/medicalReportController.js"
click node_prescriptions "https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/prescriptions/controllers/prescriptionController.js"
click node_billing "https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/billing/controllers/paymentController.js"
click node_communications "https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/communications/controllers/messageController.js"
click node_reviews "https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/reviews/controllers/reviewController.js"
click node_subscriptions "https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/subscriptions/controllers/subscriptionController.js"
click node_admin "https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/admin/controllers/adminController.js"
click node_serverentry "https://github.com/wantedfelconer/clinic-os/blob/master/server/src/index.js"
click node_database "https://github.com/wantedfelconer/clinic-os/blob/master/server/src/core/config/database.js"

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_webapp,node_patientui,node_doctorui,node_adminui,node_clientapi,node_people toneBlue
class node_clinics,node_patients,node_appointments,node_emr,node_reports,node_prescriptions,node_billing,node_reviews toneAmber
class node_auth,node_communications,node_subscriptions,node_admin toneMint
class node_serverentry,node_database toneRose
class node_email toneIndigo
```

## Components

### Web application

- [ClinicOS app](https://github.com/wantedfelconer/clinic-os/blob/master/client/src/modules/application/ClinicOSApp.tsx): `client/src/modules/application/ClinicOSApp.tsx`
- [Patient portal](https://github.com/wantedfelconer/clinic-os/blob/master/client/src/modules/patient/PatientPortal.tsx): `client/src/modules/patient/PatientPortal.tsx`
- [Doctor dashboard](https://github.com/wantedfelconer/clinic-os/blob/master/client/src/modules/dashboard/DoctorDashboard.tsx): `client/src/modules/dashboard/DoctorDashboard.tsx`
- [Admin panel](https://github.com/wantedfelconer/clinic-os/blob/master/client/src/modules/admin/AdminPanel.tsx): `client/src/modules/admin/AdminPanel.tsx`
- [API wrappers](https://github.com/wantedfelconer/clinic-os/blob/master/client/src/app/api/index.ts): `client/src/app/api/index.ts`

### Clinic workflows

- [Clinics and staff](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/clinics/controllers/clinicController.js): `server/src/modules/clinics/controllers/clinicController.js`
- [Patient registry](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/patients/controllers/patientController.js): `server/src/modules/patients/controllers/patientController.js`
- [Appointments](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/appointments/controllers/appointmentController.js): `server/src/modules/appointments/controllers/appointmentController.js`
- [Medical records](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/emr/controllers/medicalRecordController.js): `server/src/modules/emr/controllers/medicalRecordController.js`
- [Medical reports](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/emr/controllers/medicalReportController.js): `server/src/modules/emr/controllers/medicalReportController.js`
- [Prescriptions](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/prescriptions/controllers/prescriptionController.js): `server/src/modules/prescriptions/controllers/prescriptionController.js`
- [Payments and receipts](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/billing/controllers/paymentController.js): `server/src/modules/billing/controllers/paymentController.js`
- [Reviews](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/reviews/controllers/reviewController.js): `server/src/modules/reviews/controllers/reviewController.js`

### Platform services

- [Authentication](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/auth/controllers/authController.js): `server/src/modules/auth/controllers/authController.js`
- [Messages and notices](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/communications/controllers/messageController.js): `server/src/modules/communications/controllers/messageController.js`
- [Subscriptions](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/subscriptions/controllers/subscriptionController.js): `server/src/modules/subscriptions/controllers/subscriptionController.js`
- [Platform administration](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/modules/admin/controllers/adminController.js): `server/src/modules/admin/controllers/adminController.js`

### API and persistence

- [Express API](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/index.js): `server/src/index.js`
- [MySQL database](https://github.com/wantedfelconer/clinic-os/blob/master/server/src/core/config/database.js): `server/src/core/config/database.js`

### Other components

- **Clinic users**
- **Email delivery**

## Connections

- Clinic users → ClinicOS app: use
- ClinicOS app → Patient portal: offers portal
- ClinicOS app → Doctor dashboard: offers dashboard
- ClinicOS app → Admin panel: offers admin
- Patient portal → API wrappers: request data
- Doctor dashboard → API wrappers: request data
- Admin panel → API wrappers: request data
- API wrappers → Express API: REST requests
- Express API → Authentication: dispatches
- Express API → Clinics and staff: dispatches
- Express API → Patient registry: dispatches
- Express API → Appointments: dispatches
- Express API → Medical records: dispatches
- Express API → Medical reports: dispatches
- Express API → Prescriptions: dispatches
- Express API → Payments and receipts: dispatches
- Express API → Messages and notices: dispatches
- Express API → Reviews: dispatches
- Express API → Subscriptions: dispatches
- Express API → Platform administration: dispatches
- Authentication → MySQL database: reads and writes
- Clinics and staff → MySQL database: reads and writes
- Patient registry → MySQL database: reads and writes
- Appointments → MySQL database: reads and writes
- Medical records → MySQL database: reads and writes
- Medical reports → MySQL database: reads and writes
- Prescriptions → MySQL database: reads and writes
- Payments and receipts → MySQL database: reads and writes
- Messages and notices → MySQL database: reads and writes
- Reviews → MySQL database: reads and writes
- Subscriptions → MySQL database: reads and writes
- Platform administration → MySQL database: reads and writes
- Appointments → Clinics and staff: checks clinic services
- Appointments → Patient registry: validates patient
- Appointments → Messages and notices: creates notices
- Payments and receipts → Patient registry: validates patient
- Payments and receipts → Appointments: checks appointment
- Payments and receipts → Messages and notices: notifies patient
- Patient registry → Medical records: loads records
- Patient registry → Medical reports: loads reports
- Patient registry → Appointments: loads appointments
- Patient registry → Prescriptions: loads prescriptions
- Patient registry → Payments and receipts: loads payments
- Prescriptions → Patient registry: checks ownership
- Prescriptions → Appointments: checks appointment
- Prescriptions → Messages and notices: notifies patient
- Reviews → Patient registry: resolves identity
- Reviews → Appointments: verifies appointment
