# adeepas/hospital-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/adeepas/hospital-management-system
- Repository: https://github.com/adeepas/hospital-management-system

## Overview

This is an in-development hospital management system. Its clearest implemented workflow is patient appointment booking: a patient uses the React app to find a doctor and request a slot; the Express API checks the doctor’s working days, creates an appointment, and returns populated appointment details. Admin interfaces also cover doctor and patient management and appointments. The README lists medical records, billing, staff management, and analytics as planned capabilities; the supplied tree does not show implemented source for most of these. Backend controller/service details are sampled selectively, so uncertain internal wiring is omitted.

Main entry points: [`backend/src/routes/index.js`](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/routes/index.js) (API route index), [`frontend/src/routes/AppRoutes.jsx`](https://github.com/adeepas/hospital-management-system/blob/main/frontend/src/routes/AppRoutes.jsx) (Role-based routes), [`frontend/src/modules/admin/pages`](https://github.com/adeepas/hospital-management-system/tree/main/frontend/src/modules/admin/pages) (Admin management), [`backend/src/models/Appointment.js`](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/models/Appointment.js) (Appointment records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["React app<br/>[App.jsx]"]
  node_routes["Role-based routes<br/>[AppRoutes.jsx]"]
  node_patient_ui["Patient booking"]
  node_admin_ui["Admin management"]
  node_auth_ui["Login and registration"]
  node_appointment_http["Appointment API client"]
  node_doctor_http["Doctor API client<br/>[doctorService.js]"]
  node_patient_http["Patient API client<br/>[patientService.js]"]
  node_auth_http["Auth API client<br/>[authService.js]"]
end

subgraph group_api["API and access"]
  node_express["Express application<br/>[app.js]"]
  node_api_routes["API route index<br/>[index.js]"]
  node_appointment_routes["Appointment routes"]
  node_doctor_routes["Doctor routes<br/>[doctorRoutes.js]"]
  node_patient_routes["Patient routes<br/>[patientRoutes.js]"]
  node_auth_routes["Auth routes<br/>[authRoute.js]"]
  node_access["JWT role checks<br/>[authMiddlewae.js]"]
end

subgraph group_domain["Hospital operations"]
  node_appointment_logic["Appointment handling"]
  node_doctor_logic["Doctor management"]
  node_doctor_service["Doctor queries<br/>[doctorService.js]"]
  node_patient_logic["Patient management"]
  node_patient_service["Patient queries<br/>[patientService.js]"]
  node_auth_logic["Authentication<br/>[authController.js]"]
end

subgraph group_data["Persistence"]
  node_appointment_model[("Appointment records<br/>[Appointment.js]")]
  node_doctor_model[("Doctor records<br/>[Doctor.js]")]
  node_user_model[("User records<br/>[User.js]")]
end

node_patient(("Patient"))
node_mongo[("MongoDB")]

node_patient -->|"uses"| node_app
node_app -->|"renders"| node_routes
node_routes -->|"routes booking"| node_patient_ui
node_routes -->|"routes admin"| node_admin_ui
node_routes -->|"routes auth"| node_auth_ui
node_patient_ui -->|"finds doctors"| node_doctor_http
node_patient_ui -->|"requests booking"| node_appointment_http
node_auth_ui -->|"submits credentials"| node_auth_http
node_admin_ui -->|"manages doctors"| node_doctor_http
node_admin_ui -->|"manages patients"| node_patient_http
node_admin_ui -->|"views appointments"| node_appointment_http
node_express -->|"mounts API"| node_api_routes
node_api_routes -->|"dispatches"| node_appointment_routes
node_api_routes -->|"dispatches"| node_doctor_routes
node_api_routes -->|"dispatches"| node_patient_routes
node_api_routes -->|"dispatches"| node_auth_routes
node_appointment_routes -->|"checks roles"| node_access
node_doctor_routes -->|"checks roles"| node_access
node_patient_routes -->|"checks roles"| node_access
node_appointment_routes -->|"dispatches"| node_appointment_logic
node_doctor_routes -->|"dispatches"| node_doctor_logic
node_patient_routes -->|"dispatches"| node_patient_logic
node_auth_routes -->|"dispatches"| node_auth_logic
node_doctor_logic -->|"calls"| node_doctor_service
node_patient_logic -->|"calls"| node_patient_service
node_appointment_logic -->|"checks doctor"| node_doctor_model
node_appointment_logic -->|"creates and reads"| node_appointment_model
node_doctor_service -->|"queries"| node_doctor_model
node_doctor_service -->|"queries slots"| node_appointment_model
node_patient_service -->|"queries"| node_user_model
node_patient_service -->|"queries"| node_appointment_model
node_auth_logic -->|"authenticates"| node_user_model
node_appointment_model -->|"persists"| node_mongo
node_doctor_model -->|"persists"| node_mongo
node_user_model -->|"persists"| node_mongo

click node_app "https://github.com/adeepas/hospital-management-system/blob/main/frontend/src/App.jsx"
click node_routes "https://github.com/adeepas/hospital-management-system/blob/main/frontend/src/routes/AppRoutes.jsx"
click node_patient_ui "https://github.com/adeepas/hospital-management-system/blob/main/frontend/src/pages/AppointmentBooking.jsx"
click node_admin_ui "https://github.com/adeepas/hospital-management-system/tree/main/frontend/src/modules/admin/pages"
click node_auth_ui "https://github.com/adeepas/hospital-management-system/tree/main/frontend/src/modules/auth/pages"
click node_appointment_http "https://github.com/adeepas/hospital-management-system/blob/main/frontend/src/services/appointmentService.js"
click node_doctor_http "https://github.com/adeepas/hospital-management-system/blob/main/frontend/src/services/doctorService.js"
click node_patient_http "https://github.com/adeepas/hospital-management-system/blob/main/frontend/src/services/patientService.js"
click node_auth_http "https://github.com/adeepas/hospital-management-system/blob/main/frontend/src/services/authService.js"
click node_express "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/app.js"
click node_api_routes "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/routes/index.js"
click node_appointment_routes "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/routes/appointmentRoutes.js"
click node_doctor_routes "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/routes/doctorRoutes.js"
click node_patient_routes "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/routes/patientRoutes.js"
click node_auth_routes "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/routes/authRoute.js"
click node_access "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/middleware/authMiddlewae.js"
click node_appointment_logic "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/controllers/appointmentController.js"
click node_doctor_logic "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/controllers/doctorController.js"
click node_doctor_service "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/services/doctorService.js"
click node_patient_logic "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/controllers/patientController.js"
click node_patient_service "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/services/patientService.js"
click node_auth_logic "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/controllers/authController.js"
click node_appointment_model "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/models/Appointment.js"
click node_doctor_model "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/models/Doctor.js"
click node_user_model "https://github.com/adeepas/hospital-management-system/blob/main/backend/src/models/User.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_app,node_routes,node_patient_ui,node_admin_ui,node_auth_ui,node_appointment_http,node_doctor_http,node_patient_http,node_auth_http toneBlue
class node_express,node_api_routes,node_appointment_routes,node_doctor_routes,node_patient_routes,node_auth_routes,node_access,node_mongo toneAmber
class node_appointment_logic,node_doctor_logic,node_doctor_service,node_patient_logic,node_patient_service,node_auth_logic toneMint
class node_appointment_model,node_doctor_model,node_user_model toneRose
class node_patient toneIndigo
```

## Components

### Web application

- [React app](https://github.com/adeepas/hospital-management-system/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Role-based routes](https://github.com/adeepas/hospital-management-system/blob/main/frontend/src/routes/AppRoutes.jsx): `frontend/src/routes/AppRoutes.jsx`
- [Patient booking](https://github.com/adeepas/hospital-management-system/blob/main/frontend/src/pages/AppointmentBooking.jsx): `frontend/src/pages/AppointmentBooking.jsx`
- [Admin management](https://github.com/adeepas/hospital-management-system/tree/main/frontend/src/modules/admin/pages): `frontend/src/modules/admin/pages`
- [Login and registration](https://github.com/adeepas/hospital-management-system/tree/main/frontend/src/modules/auth/pages): `frontend/src/modules/auth/pages`
- [Appointment API client](https://github.com/adeepas/hospital-management-system/blob/main/frontend/src/services/appointmentService.js): `frontend/src/services/appointmentService.js`
- [Doctor API client](https://github.com/adeepas/hospital-management-system/blob/main/frontend/src/services/doctorService.js): `frontend/src/services/doctorService.js`
- [Patient API client](https://github.com/adeepas/hospital-management-system/blob/main/frontend/src/services/patientService.js): `frontend/src/services/patientService.js`
- [Auth API client](https://github.com/adeepas/hospital-management-system/blob/main/frontend/src/services/authService.js): `frontend/src/services/authService.js`

### API and access

- [Express application](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/app.js): `backend/src/app.js`
- [API route index](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/routes/index.js): `backend/src/routes/index.js`
- [Appointment routes](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/routes/appointmentRoutes.js): `backend/src/routes/appointmentRoutes.js`
- [Doctor routes](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/routes/doctorRoutes.js): `backend/src/routes/doctorRoutes.js`
- [Patient routes](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/routes/patientRoutes.js): `backend/src/routes/patientRoutes.js`
- [Auth routes](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/routes/authRoute.js): `backend/src/routes/authRoute.js`
- [JWT role checks](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/middleware/authMiddlewae.js): `backend/src/middleware/authMiddlewae.js`

### Hospital operations

- [Appointment handling](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/controllers/appointmentController.js): `backend/src/controllers/appointmentController.js`
- [Doctor management](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/controllers/doctorController.js): `backend/src/controllers/doctorController.js`
- [Doctor queries](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/services/doctorService.js): `backend/src/services/doctorService.js`
- [Patient management](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/controllers/patientController.js): `backend/src/controllers/patientController.js`
- [Patient queries](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/services/patientService.js): `backend/src/services/patientService.js`
- [Authentication](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/controllers/authController.js): `backend/src/controllers/authController.js`

### Persistence

- [Appointment records](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/models/Appointment.js): `backend/src/models/Appointment.js`
- [Doctor records](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/models/Doctor.js): `backend/src/models/Doctor.js`
- [User records](https://github.com/adeepas/hospital-management-system/blob/main/backend/src/models/User.js): `backend/src/models/User.js`

### Other components

- **Patient**
- **MongoDB**

## Connections

- Patient → React app: uses
- React app → Role-based routes: renders
- Role-based routes → Patient booking: routes booking
- Role-based routes → Admin management: routes admin
- Role-based routes → Login and registration: routes auth
- Patient booking → Doctor API client: finds doctors
- Patient booking → Appointment API client: requests booking
- Login and registration → Auth API client: submits credentials
- Admin management → Doctor API client: manages doctors
- Admin management → Patient API client: manages patients
- Admin management → Appointment API client: views appointments
- Express application → API route index: mounts API
- API route index → Appointment routes: dispatches
- API route index → Doctor routes: dispatches
- API route index → Patient routes: dispatches
- API route index → Auth routes: dispatches
- Appointment routes → JWT role checks: checks roles
- Doctor routes → JWT role checks: checks roles
- Patient routes → JWT role checks: checks roles
- Appointment routes → Appointment handling: dispatches
- Doctor routes → Doctor management: dispatches
- Patient routes → Patient management: dispatches
- Auth routes → Authentication: dispatches
- Doctor management → Doctor queries: calls
- Patient management → Patient queries: calls
- Appointment handling → Doctor records: checks doctor
- Appointment handling → Appointment records: creates and reads
- Doctor queries → Doctor records: queries
- Doctor queries → Appointment records: queries slots
- Patient queries → User records: queries
- Patient queries → Appointment records: queries
- Authentication → User records: authenticates
- Appointment records → MongoDB: persists
- Doctor records → MongoDB: persists
- User records → MongoDB: persists
