# hrs001/doctor-appointment-system architecture

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

- Interactive diagram: https://gitdiagram.com/hrs001/doctor-appointment-system
- Repository: https://github.com/hrs001/doctor-appointment-system

## Overview

This is a browser-based hospital management system with a Node/Express backend. Users sign up or log in, then role-based dashboards support administrator doctor/billing tasks, patient appointment booking, and doctor appointment tracking. The sampled backend shows authentication, role checks, and appointment persistence in MongoDB. The README only names the product, and the server excerpt does not show doctor or billing route implementations, so those client capabilities are shown without inferred backend internals.

Main entry points: [`server.js`](https://github.com/hrs001/doctor-appointment-system/blob/main/server.js) (Appointment routes), [`app.js`](https://github.com/hrs001/doctor-appointment-system/blob/main/app.js) (Role dashboard router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser application"]
  node_auth_ui["Login and signup<br/>[app.js]"]
  node_role_router["Role dashboard router<br/>[app.js]"]
end

subgraph group_access["Identity and access"]
  node_auth_api["Authentication routes<br/>[server.js]"]
  node_security["JWT and role gates<br/>[server.js]"]
end

subgraph group_clinical["Clinical workflow"]
  node_patient_portal["Patient dashboard<br/>[app.js]"]
  node_doctor_portal["Doctor dashboard<br/>[app.js]"]
  node_appointment_actions["Appointment status updates<br/>[app.js]"]
  node_appointment_api["Appointment routes<br/>[server.js]"]
  node_hospital_data[("User and appointment records<br/>[server.js]")]
end

subgraph group_operations["Hospital operations"]
  node_admin_portal["Admin dashboard<br/>[app.js]"]
  node_doctor_management["Doctor management<br/>[app.js]"]
  node_billing["Billing and invoices<br/>[app.js]"]
end

node_user(("Hospital user"))
node_hospital_api{{"Hospital HTTP API"}}

node_user -->|"signs in"| node_auth_ui
node_auth_ui -->|"requests auth"| node_auth_api
node_auth_api -->|"reads and writes"| node_hospital_data
node_auth_ui -->|"routes by role"| node_role_router
node_role_router -->|"opens"| node_admin_portal
node_role_router -->|"opens"| node_patient_portal
node_role_router -->|"opens"| node_doctor_portal
node_admin_portal -->|"manages doctors"| node_doctor_management
node_admin_portal -->|"manages billing"| node_billing
node_admin_portal -->|"requests data"| node_hospital_api
node_doctor_management -->|"requests doctors"| node_hospital_api
node_billing -->|"requests billing"| node_hospital_api
node_patient_portal -->|"loads doctors"| node_hospital_api
node_patient_portal -->|"books appointment"| node_appointment_api
node_doctor_portal -->|"loads appointments"| node_appointment_api
node_appointment_actions -->|"updates status"| node_appointment_api
node_appointment_api -->|"checks access"| node_security
node_appointment_api -->|"reads and writes"| node_hospital_data

click node_auth_ui "https://github.com/hrs001/doctor-appointment-system/blob/main/app.js"
click node_role_router "https://github.com/hrs001/doctor-appointment-system/blob/main/app.js"
click node_admin_portal "https://github.com/hrs001/doctor-appointment-system/blob/main/app.js"
click node_doctor_management "https://github.com/hrs001/doctor-appointment-system/blob/main/app.js"
click node_billing "https://github.com/hrs001/doctor-appointment-system/blob/main/app.js"
click node_patient_portal "https://github.com/hrs001/doctor-appointment-system/blob/main/app.js"
click node_doctor_portal "https://github.com/hrs001/doctor-appointment-system/blob/main/app.js"
click node_appointment_actions "https://github.com/hrs001/doctor-appointment-system/blob/main/app.js"
click node_auth_api "https://github.com/hrs001/doctor-appointment-system/blob/main/server.js"
click node_security "https://github.com/hrs001/doctor-appointment-system/blob/main/server.js"
click node_appointment_api "https://github.com/hrs001/doctor-appointment-system/blob/main/server.js"
click node_hospital_data "https://github.com/hrs001/doctor-appointment-system/blob/main/server.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_auth_ui,node_role_router,node_user toneBlue
class node_auth_api,node_security toneAmber
class node_patient_portal,node_doctor_portal,node_appointment_actions,node_appointment_api,node_hospital_data,node_hospital_api toneMint
class node_admin_portal,node_doctor_management,node_billing toneRose
```

## Components

### Browser application

- [Login and signup](https://github.com/hrs001/doctor-appointment-system/blob/main/app.js): `app.js`
- [Role dashboard router](https://github.com/hrs001/doctor-appointment-system/blob/main/app.js): `app.js`

### Identity and access

- [Authentication routes](https://github.com/hrs001/doctor-appointment-system/blob/main/server.js): `server.js`
- [JWT and role gates](https://github.com/hrs001/doctor-appointment-system/blob/main/server.js): `server.js`

### Clinical workflow

- [Patient dashboard](https://github.com/hrs001/doctor-appointment-system/blob/main/app.js): `app.js`
- [Doctor dashboard](https://github.com/hrs001/doctor-appointment-system/blob/main/app.js): `app.js`
- [Appointment status updates](https://github.com/hrs001/doctor-appointment-system/blob/main/app.js): `app.js`
- [Appointment routes](https://github.com/hrs001/doctor-appointment-system/blob/main/server.js): `server.js`
- [User and appointment records](https://github.com/hrs001/doctor-appointment-system/blob/main/server.js): `server.js`

### Hospital operations

- [Admin dashboard](https://github.com/hrs001/doctor-appointment-system/blob/main/app.js): `app.js`
- [Doctor management](https://github.com/hrs001/doctor-appointment-system/blob/main/app.js): `app.js`
- [Billing and invoices](https://github.com/hrs001/doctor-appointment-system/blob/main/app.js): `app.js`

### Other components

- **Hospital user**
- **Hospital HTTP API**

## Connections

- Hospital user → Login and signup: signs in (evidence: `app.js`)
- Login and signup → Authentication routes: requests auth (evidence: `app.js`)
- Authentication routes → User and appointment records: reads and writes (evidence: `server.js`)
- Login and signup → Role dashboard router: routes by role (evidence: `app.js`)
- Role dashboard router → Admin dashboard: opens (evidence: `app.js`)
- Role dashboard router → Patient dashboard: opens (evidence: `app.js`)
- Role dashboard router → Doctor dashboard: opens (evidence: `app.js`)
- Admin dashboard → Doctor management: manages doctors (evidence: `app.js`)
- Admin dashboard → Billing and invoices: manages billing (evidence: `app.js`)
- Admin dashboard → Hospital HTTP API: requests data (evidence: `app.js`)
- Doctor management → Hospital HTTP API: requests doctors (evidence: `app.js`)
- Billing and invoices → Hospital HTTP API: requests billing (evidence: `app.js`)
- Patient dashboard → Hospital HTTP API: loads doctors (evidence: `app.js`)
- Patient dashboard → Appointment routes: books appointment (evidence: `app.js`)
- Doctor dashboard → Appointment routes: loads appointments (evidence: `app.js`)
- Appointment status updates → Appointment routes: updates status (evidence: `app.js`)
- Appointment routes → JWT and role gates: checks access (evidence: `server.js`)
- Appointment routes → User and appointment records: reads and writes (evidence: `server.js`)
