# gmelan2002/mcare architecture

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

## Overview

MCARE is a clinic-management web app. The documented workflow runs from patient registration and appointment booking through clinical notes, prescriptions, billing, and reporting; inventory, expenses, staff, doctors, treatments, and settings support clinic operations. The README documents browser-to-REST access, route-to-controller handling, and controller-to-Supabase storage. Sampled files confirm several of those links; other feature-specific frontend and controller behavior is represented from the README and file tree, not inferred beyond documented capabilities.

Main entry points: [`server/routes`](https://github.com/gmelan2002/mcare/tree/main/server/routes) (API routes), [`server/config/supabase.js`](https://github.com/gmelan2002/mcare/blob/main/server/config/supabase.js) (Supabase PostgreSQL), [`public/index.html`](https://github.com/gmelan2002/mcare/blob/main/public/index.html) (Clinic web app), [`server/index.js`](https://github.com/gmelan2002/mcare/blob/main/server/index.js) (Express server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Clinic experience"]
  node_web["Clinic web app<br/>[index.html]"]
  node_scripts["Browser scripts"]
  node_authui["Login interface<br/>[auth.js]"]
end

subgraph group_clinical["Clinical workflow"]
  node_patients["Patient records"]
  node_appointments["Appointments"]
  node_notes["Clinical notes"]
  node_prescriptions["Prescriptions"]
end

subgraph group_operations["Clinic operations"]
  node_billing["Billing"]
  node_reports["Reports"]
  node_summary["Daily summaries"]
  node_inventory["Inventory"]
  node_expenses["Expenses"]
  node_staff["Staff and doctors"]
  node_doctors["Doctor directory"]
  node_treatments["Treatments"]
  node_settings["Clinic settings"]
  node_contact["Contact requests"]
end

subgraph group_platform["API and data"]
  node_auth["Account and tokens<br/>[auth.controller.js]"]
  node_middleware["JWT verification<br/>[auth.middleware.js]"]
  node_routes["API routes"]
  node_server["Express server<br/>[index.js]"]
  node_database[("Supabase PostgreSQL<br/>[supabase.js]")]
end

node_browser(("Clinic user"))

node_browser -->|"uses"| node_web
node_web -.->|"loads scripts"| node_scripts
node_web -->|"requests REST API"| node_server
node_browser -->|"signs in"| node_authui
node_authui -.->|"requests authentication"| node_server
node_server -->|"mounts routes"| node_routes
node_routes -->|"dispatches"| node_auth
node_routes -->|"dispatches"| node_patients
node_routes -->|"dispatches"| node_appointments
node_routes -->|"dispatches"| node_notes
node_routes -->|"dispatches"| node_prescriptions
node_routes -->|"dispatches"| node_billing
node_routes -->|"dispatches"| node_reports
node_routes -->|"dispatches"| node_summary
node_routes -->|"dispatches"| node_inventory
node_routes -->|"dispatches"| node_expenses
node_routes -->|"dispatches"| node_staff
node_routes -->|"dispatches"| node_doctors
node_routes -->|"dispatches"| node_treatments
node_routes -->|"dispatches"| node_settings
node_routes -->|"dispatches"| node_contact
node_routes -->|"protects routes"| node_middleware
node_auth -->|"reads and writes"| node_database
node_patients -->|"reads and writes"| node_database
node_appointments -->|"reads and writes"| node_database
node_notes -->|"uses storage"| node_database
node_prescriptions -->|"uses storage"| node_database
node_billing -->|"uses storage"| node_database
node_reports -->|"reads totals"| node_database
node_summary -->|"uses storage"| node_database
node_inventory -->|"uses storage"| node_database
node_expenses -->|"uses storage"| node_database
node_staff -->|"uses storage"| node_database
node_doctors -->|"uses storage"| node_database
node_treatments -->|"uses storage"| node_database
node_settings -->|"uses storage"| node_database
node_contact -->|"uses storage"| node_database

click node_web "https://github.com/gmelan2002/mcare/blob/main/public/index.html"
click node_scripts "https://github.com/gmelan2002/mcare/tree/main/public/assets/js"
click node_authui "https://github.com/gmelan2002/mcare/blob/main/public/assets/js/auth.js"
click node_patients "https://github.com/gmelan2002/mcare/blob/main/server/controllers/patients.controller.js"
click node_appointments "https://github.com/gmelan2002/mcare/blob/main/server/controllers/appointments.controller.js"
click node_notes "https://github.com/gmelan2002/mcare/blob/main/server/controllers/clinicalNotes.controller.js"
click node_prescriptions "https://github.com/gmelan2002/mcare/blob/main/server/controllers/prescriptions.controller.js"
click node_billing "https://github.com/gmelan2002/mcare/blob/main/server/controllers/billing.controller.js"
click node_reports "https://github.com/gmelan2002/mcare/blob/main/server/controllers/reports.controller.js"
click node_summary "https://github.com/gmelan2002/mcare/blob/main/server/controllers/dailySummary.controller.js"
click node_inventory "https://github.com/gmelan2002/mcare/blob/main/server/controllers/inventory.controller.js"
click node_expenses "https://github.com/gmelan2002/mcare/blob/main/server/controllers/expenses.controller.js"
click node_staff "https://github.com/gmelan2002/mcare/blob/main/server/controllers/staff.controller.js"
click node_doctors "https://github.com/gmelan2002/mcare/blob/main/server/controllers/doctors.controller.js"
click node_treatments "https://github.com/gmelan2002/mcare/blob/main/server/controllers/treatments.controller.js"
click node_settings "https://github.com/gmelan2002/mcare/blob/main/server/controllers/settings.controller.js"
click node_contact "https://github.com/gmelan2002/mcare/blob/main/server/controllers/contact.controller.js"
click node_auth "https://github.com/gmelan2002/mcare/blob/main/server/controllers/auth.controller.js"
click node_middleware "https://github.com/gmelan2002/mcare/blob/main/server/middleware/auth.middleware.js"
click node_routes "https://github.com/gmelan2002/mcare/tree/main/server/routes"
click node_server "https://github.com/gmelan2002/mcare/blob/main/server/index.js"
click node_database "https://github.com/gmelan2002/mcare/blob/main/server/config/supabase.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_web,node_scripts,node_authui,node_browser toneBlue
class node_patients,node_appointments,node_notes,node_prescriptions toneAmber
class node_billing,node_reports,node_summary,node_inventory,node_expenses,node_staff,node_doctors,node_treatments,node_settings,node_contact toneMint
class node_auth,node_middleware,node_routes,node_server,node_database toneRose
```

## Components

### Clinic experience

- [Clinic web app](https://github.com/gmelan2002/mcare/blob/main/public/index.html): `public/index.html`
- [Browser scripts](https://github.com/gmelan2002/mcare/tree/main/public/assets/js): `public/assets/js`
- [Login interface](https://github.com/gmelan2002/mcare/blob/main/public/assets/js/auth.js): `public/assets/js/auth.js`

### Clinical workflow

- [Patient records](https://github.com/gmelan2002/mcare/blob/main/server/controllers/patients.controller.js): `server/controllers/patients.controller.js`
- [Appointments](https://github.com/gmelan2002/mcare/blob/main/server/controllers/appointments.controller.js): `server/controllers/appointments.controller.js`
- [Clinical notes](https://github.com/gmelan2002/mcare/blob/main/server/controllers/clinicalNotes.controller.js): `server/controllers/clinicalNotes.controller.js`
- [Prescriptions](https://github.com/gmelan2002/mcare/blob/main/server/controllers/prescriptions.controller.js): `server/controllers/prescriptions.controller.js`

### Clinic operations

- [Billing](https://github.com/gmelan2002/mcare/blob/main/server/controllers/billing.controller.js): `server/controllers/billing.controller.js`
- [Reports](https://github.com/gmelan2002/mcare/blob/main/server/controllers/reports.controller.js): `server/controllers/reports.controller.js`
- [Daily summaries](https://github.com/gmelan2002/mcare/blob/main/server/controllers/dailySummary.controller.js): `server/controllers/dailySummary.controller.js`
- [Inventory](https://github.com/gmelan2002/mcare/blob/main/server/controllers/inventory.controller.js): `server/controllers/inventory.controller.js`
- [Expenses](https://github.com/gmelan2002/mcare/blob/main/server/controllers/expenses.controller.js): `server/controllers/expenses.controller.js`
- [Staff and doctors](https://github.com/gmelan2002/mcare/blob/main/server/controllers/staff.controller.js): `server/controllers/staff.controller.js`
- [Doctor directory](https://github.com/gmelan2002/mcare/blob/main/server/controllers/doctors.controller.js): `server/controllers/doctors.controller.js`
- [Treatments](https://github.com/gmelan2002/mcare/blob/main/server/controllers/treatments.controller.js): `server/controllers/treatments.controller.js`
- [Clinic settings](https://github.com/gmelan2002/mcare/blob/main/server/controllers/settings.controller.js): `server/controllers/settings.controller.js`
- [Contact requests](https://github.com/gmelan2002/mcare/blob/main/server/controllers/contact.controller.js): `server/controllers/contact.controller.js`

### API and data

- [Account and tokens](https://github.com/gmelan2002/mcare/blob/main/server/controllers/auth.controller.js): `server/controllers/auth.controller.js`
- [JWT verification](https://github.com/gmelan2002/mcare/blob/main/server/middleware/auth.middleware.js): `server/middleware/auth.middleware.js`
- [API routes](https://github.com/gmelan2002/mcare/tree/main/server/routes): `server/routes`
- [Express server](https://github.com/gmelan2002/mcare/blob/main/server/index.js): `server/index.js`
- [Supabase PostgreSQL](https://github.com/gmelan2002/mcare/blob/main/server/config/supabase.js): `server/config/supabase.js`

### Other components

- **Clinic user**

## Connections

- Clinic user → Clinic web app: uses (evidence: `README.md`)
- Clinic web app → Browser scripts: loads scripts
- Clinic web app → Express server: requests REST API (evidence: `README.md`)
- Clinic user → Login interface: signs in (evidence: `README.md`)
- Login interface → Express server: requests authentication
- Express server → API routes: mounts routes (evidence: `server/index.js`)
- API routes → Account and tokens: dispatches (evidence: `server/routes/auth.routes.js`)
- API routes → Patient records: dispatches (evidence: `server/routes/patients.routes.js`)
- API routes → Appointments: dispatches (evidence: `server/routes/appointments.routes.js`)
- API routes → Clinical notes: dispatches (evidence: `README.md`)
- API routes → Prescriptions: dispatches (evidence: `README.md`)
- API routes → Billing: dispatches (evidence: `README.md`)
- API routes → Reports: dispatches (evidence: `README.md`)
- API routes → Daily summaries: dispatches (evidence: `README.md`)
- API routes → Inventory: dispatches (evidence: `server/routes/inventory.routes.js`)
- API routes → Expenses: dispatches (evidence: `README.md`)
- API routes → Staff and doctors: dispatches (evidence: `README.md`)
- API routes → Doctor directory: dispatches (evidence: `README.md`)
- API routes → Treatments: dispatches (evidence: `server/routes/treatments.routes.js`)
- API routes → Clinic settings: dispatches (evidence: `README.md`)
- API routes → Contact requests: dispatches (evidence: `README.md`)
- API routes → JWT verification: protects routes (evidence: `server/routes/appointments.routes.js`)
- Account and tokens → Supabase PostgreSQL: reads and writes (evidence: `server/controllers/auth.controller.js`)
- Patient records → Supabase PostgreSQL: reads and writes (evidence: `server/controllers/patients.controller.js`)
- Appointments → Supabase PostgreSQL: reads and writes (evidence: `server/controllers/appointments.controller.js`)
- Clinical notes → Supabase PostgreSQL: uses storage (evidence: `server/controllers/clinicalNotes.controller.js`)
- Prescriptions → Supabase PostgreSQL: uses storage (evidence: `server/controllers/prescriptions.controller.js`)
- Billing → Supabase PostgreSQL: uses storage (evidence: `server/controllers/billing.controller.js`)
- Reports → Supabase PostgreSQL: reads totals (evidence: `server/controllers/reports.controller.js`)
- Daily summaries → Supabase PostgreSQL: uses storage (evidence: `server/controllers/dailySummary.controller.js`)
- Inventory → Supabase PostgreSQL: uses storage (evidence: `server/controllers/inventory.controller.js`)
- Expenses → Supabase PostgreSQL: uses storage (evidence: `server/controllers/expenses.controller.js`)
- Staff and doctors → Supabase PostgreSQL: uses storage (evidence: `server/controllers/staff.controller.js`)
- Doctor directory → Supabase PostgreSQL: uses storage (evidence: `server/controllers/doctors.controller.js`)
- Treatments → Supabase PostgreSQL: uses storage (evidence: `server/controllers/treatments.controller.js`)
- Clinic settings → Supabase PostgreSQL: uses storage (evidence: `server/controllers/settings.controller.js`)
- Contact requests → Supabase PostgreSQL: uses storage (evidence: `server/controllers/contact.controller.js`)
