# gmelan2002/clinic-os architecture

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

- Interactive diagram: https://gitdiagram.com/gmelan2002/clinic-os
- Repository: https://github.com/gmelan2002/clinic-os

## Overview

ClinicOS is a static, multi-tenant clinic-management web app backed by Firebase. Clinic staff use the clinic login and then manage separate operational areas; platform administrators use the HQ login and console to provision and control clinic workspaces. The README documents the key feature flows, but no source excerpts were provided, so the graph omits unverified page-to-page navigation and internal call details.

Main entry points: [`inventory.html`](https://github.com/gmelan2002/clinic-os/blob/main/inventory.html) (Inventory), [`login.html`](https://github.com/gmelan2002/clinic-os/blob/main/login.html) (Clinic login), [`hq_login.html`](https://github.com/gmelan2002/clinic-os/blob/main/hq_login.html) (HQ login), [`index.html`](https://github.com/gmelan2002/clinic-os/blob/main/index.html) (Landing and plans)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and access"]
  node_landing["Landing and plans<br/>[index.html]"]
  node_clinic_login["Clinic login<br/>[login.html]"]
  node_hq_login["HQ login<br/>[hq_login.html]"]
end

subgraph group_clinic["Clinic operations"]
  node_dashboard["Clinic dashboard"]
  node_patients["Patient records<br/>[patients.html]"]
  node_appointments["Appointments<br/>[calendar.html]"]
  node_treatments["Clinical records<br/>[treatments.html]"]
  node_lab_orders["Lab orders<br/>[lab_orders.html]"]
  node_billing["Billing<br/>[billing.html]"]
  node_inventory["Inventory<br/>[inventory.html]"]
  node_expenses["Expense tracking<br/>[inventory.html]"]
  node_settings["Clinic and staff settings<br/>[settings.html]"]
  node_payment["Plan upgrade<br/>[payment.html]"]
end

subgraph group_platform["Platform administration"]
  node_hq_console["HQ console<br/>[superadmin_hq.html]"]
  node_clinic_inspector["Clinic inspector"]
end

subgraph group_services["Backend and integrations"]
  node_firebase_auth["Firebase Authentication"]
  node_firestore[("Cloud Firestore")]
  node_whatsapp["WhatsApp"]
end

node_clinic_staff(("Clinic staff"))
node_platform_admin(("Platform admin"))

node_clinic_staff -->|"signs in"| node_clinic_login
node_platform_admin -->|"signs in"| node_hq_login
node_clinic_login -->|"authenticates with"| node_firebase_auth
node_hq_login -->|"authenticates with"| node_firebase_auth
node_dashboard -->|"reads clinic data"| node_firestore
node_patients -->|"stores patient records"| node_firestore
node_appointments -->|"stores appointments"| node_firestore
node_treatments -->|"stores treatments"| node_firestore
node_lab_orders -->|"stores lab orders"| node_firestore
node_billing -->|"stores billings"| node_firestore
node_inventory -->|"stores inventory"| node_firestore
node_inventory -->|"logs usage cost"| node_expenses
node_settings -->|"stores clinic users"| node_firestore
node_hq_console -->|"manages workspaces"| node_firestore
node_clinic_inspector -->|"inspects clinics"| node_firestore
node_payment -->|"starts upgrade"| node_whatsapp
node_landing -->|"presents plans"| node_clinic_staff

click node_landing "https://github.com/gmelan2002/clinic-os/blob/main/index.html"
click node_clinic_login "https://github.com/gmelan2002/clinic-os/blob/main/login.html"
click node_hq_login "https://github.com/gmelan2002/clinic-os/blob/main/hq_login.html"
click node_dashboard "https://github.com/gmelan2002/clinic-os/blob/main/clinicos_dashboard.html"
click node_patients "https://github.com/gmelan2002/clinic-os/blob/main/patients.html"
click node_appointments "https://github.com/gmelan2002/clinic-os/blob/main/calendar.html"
click node_treatments "https://github.com/gmelan2002/clinic-os/blob/main/treatments.html"
click node_lab_orders "https://github.com/gmelan2002/clinic-os/blob/main/lab_orders.html"
click node_billing "https://github.com/gmelan2002/clinic-os/blob/main/billing.html"
click node_inventory "https://github.com/gmelan2002/clinic-os/blob/main/inventory.html"
click node_expenses "https://github.com/gmelan2002/clinic-os/blob/main/inventory.html"
click node_settings "https://github.com/gmelan2002/clinic-os/blob/main/settings.html"
click node_payment "https://github.com/gmelan2002/clinic-os/blob/main/payment.html"
click node_hq_console "https://github.com/gmelan2002/clinic-os/blob/main/superadmin_hq.html"
click node_clinic_inspector "https://github.com/gmelan2002/clinic-os/blob/main/clinic_details.html"

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_landing,node_clinic_login,node_hq_login toneBlue
class node_dashboard,node_patients,node_appointments,node_treatments,node_lab_orders,node_billing,node_inventory,node_expenses,node_settings,node_payment toneAmber
class node_hq_console,node_clinic_inspector toneMint
class node_firebase_auth,node_firestore,node_whatsapp toneRose
class node_clinic_staff,node_platform_admin toneIndigo
```

## Components

### Entry and access

- [Landing and plans](https://github.com/gmelan2002/clinic-os/blob/main/index.html): `index.html`
- [Clinic login](https://github.com/gmelan2002/clinic-os/blob/main/login.html): `login.html`
- [HQ login](https://github.com/gmelan2002/clinic-os/blob/main/hq_login.html): `hq_login.html`

### Clinic operations

- [Clinic dashboard](https://github.com/gmelan2002/clinic-os/blob/main/clinicos_dashboard.html): `clinicos_dashboard.html`
- [Patient records](https://github.com/gmelan2002/clinic-os/blob/main/patients.html): `patients.html`
- [Appointments](https://github.com/gmelan2002/clinic-os/blob/main/calendar.html): `calendar.html`
- [Clinical records](https://github.com/gmelan2002/clinic-os/blob/main/treatments.html): `treatments.html`
- [Lab orders](https://github.com/gmelan2002/clinic-os/blob/main/lab_orders.html): `lab_orders.html`
- [Billing](https://github.com/gmelan2002/clinic-os/blob/main/billing.html): `billing.html`
- [Inventory](https://github.com/gmelan2002/clinic-os/blob/main/inventory.html): `inventory.html`
- [Expense tracking](https://github.com/gmelan2002/clinic-os/blob/main/inventory.html): `inventory.html`
- [Clinic and staff settings](https://github.com/gmelan2002/clinic-os/blob/main/settings.html): `settings.html`
- [Plan upgrade](https://github.com/gmelan2002/clinic-os/blob/main/payment.html): `payment.html`

### Platform administration

- [HQ console](https://github.com/gmelan2002/clinic-os/blob/main/superadmin_hq.html): `superadmin_hq.html`
- [Clinic inspector](https://github.com/gmelan2002/clinic-os/blob/main/clinic_details.html): `clinic_details.html`

### Backend and integrations

- **Firebase Authentication**
- **Cloud Firestore**
- **WhatsApp**

### Other components

- **Clinic staff**
- **Platform admin**

## Connections

- Clinic staff → Clinic login: signs in (evidence: `README.md`)
- Platform admin → HQ login: signs in (evidence: `README.md`)
- Clinic login → Firebase Authentication: authenticates with (evidence: `README.md`)
- HQ login → Firebase Authentication: authenticates with (evidence: `README.md`)
- Clinic dashboard → Cloud Firestore: reads clinic data (evidence: `README.md`)
- Patient records → Cloud Firestore: stores patient records (evidence: `README.md`)
- Appointments → Cloud Firestore: stores appointments (evidence: `README.md`)
- Clinical records → Cloud Firestore: stores treatments (evidence: `README.md`)
- Lab orders → Cloud Firestore: stores lab orders (evidence: `README.md`)
- Billing → Cloud Firestore: stores billings (evidence: `README.md`)
- Inventory → Cloud Firestore: stores inventory (evidence: `README.md`)
- Inventory → Expense tracking: logs usage cost (evidence: `README.md`)
- Clinic and staff settings → Cloud Firestore: stores clinic users (evidence: `README.md`)
- HQ console → Cloud Firestore: manages workspaces (evidence: `README.md`)
- Clinic inspector → Cloud Firestore: inspects clinics (evidence: `README.md`)
- Plan upgrade → WhatsApp: starts upgrade (evidence: `README.md`)
- Landing and plans → Clinic staff: presents plans (evidence: `README.md`)
