# ssrssudharshanreddy/hospital_app architecture

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

- Interactive diagram: https://gitdiagram.com/ssrssudharshanreddy/hospital_app
- Repository: https://github.com/ssrssudharshanreddy/hospital_app

## Overview

The product is a hospital patient and consultation queue system. Reception staff register and find patients, book doctor-specific consultations with emergency priority, and doctors process queues; the frontend communicates with a C++ REST backend, which owns the queue logic and persistence. The graph preserves dashboard, doctor, records, and cancellation capabilities documented by the README. Some page and server implementation details were not excerpted, so those links rely on README documentation or are omitted where the caller is uncertain.

Main entry points: [`frontend/src/App.jsx`](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/frontend/src/App.jsx) (Routes and shell), [`frontend/src/services/api.js`](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/frontend/src/services/api.js) (HTTP API client), [`backend/dsa/hospital_dsa.cpp`](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/dsa/hospital_dsa.cpp) (Patient and consultation engine), [`backend/database/database_manager.cpp`](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/database/database_manager.cpp) (Database manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["React application"]
  node_app["Routes and shell<br/>[App.jsx]"]
  node_patient_pages["Patient management"]
  node_booking["Consultation booking<br/>[index.jsx]"]
  node_queue_pages["Queue workstation<br/>[index.jsx]"]
  node_records["Records and cancellation"]
  node_dashboard["Dashboard telemetry<br/>[index.jsx]"]
  node_doctor_views["Doctor directory and queues"]
  node_ui_components["Shared UI components"]
  node_api_client["HTTP API client<br/>[api.js]"]
end

subgraph group_api["REST service"]
  node_api_server["HTTP route handler<br/>[server.cpp]"]
  node_runtime["Backend startup<br/>[main.cpp]"]
end

subgraph group_core["Clinical domain"]
  node_domain_engine["Patient and consultation engine<br/>[hospital_dsa.cpp]"]
  node_queue_adt["Circular patient queues<br/>[patient_queue.cpp]"]
  node_domain_types["Patient and visit records<br/>[structures.h]"]
  node_validation["Input validation<br/>[validation.h]"]
end

subgraph group_storage["Persistence"]
  node_db_manager["Database manager"]
  node_db_config["Mongo configuration<br/>[db_config.h]"]
end

node_staff(("Clinic staff"))
node_mongo[("MongoDB")]

node_staff -->|"uses"| node_app
node_app -->|"routes to"| node_patient_pages
node_app -->|"routes to"| node_booking
node_app -->|"routes to"| node_queue_pages
node_app -->|"routes to"| node_records
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_doctor_views
node_patient_pages -->|"requests data"| node_api_client
node_booking -->|"books visits"| node_api_client
node_queue_pages -->|"processes queue"| node_api_client
node_records -->|"requests records"| node_api_client
node_dashboard -->|"requests metrics"| node_api_client
node_doctor_views -->|"requests doctors"| node_api_client
node_patient_pages -->|"renders with"| node_ui_components
node_booking -->|"renders with"| node_ui_components
node_queue_pages -->|"renders with"| node_ui_components
node_records -->|"renders with"| node_ui_components
node_api_client -->|"sends REST JSON"| node_api_server
node_runtime -->|"starts"| node_api_server
node_api_server -->|"delegates domain work"| node_domain_engine
node_api_server -->|"uses persistence"| node_db_manager
node_domain_engine -->|"uses queues"| node_queue_adt
node_domain_engine -->|"manages records"| node_domain_types
node_domain_engine -->|"validates inputs"| node_validation
node_db_manager -->|"stores records"| node_domain_types
node_runtime -->|"initializes"| node_db_manager
node_runtime -->|"initializes"| node_domain_engine
node_db_manager -->|"reads and writes"| node_mongo
node_db_manager -->|"uses configuration"| node_db_config
node_runtime -->|"configures"| node_db_config

click node_app "https://github.com/ssrssudharshanreddy/hospital_app/blob/main/frontend/src/App.jsx"
click node_patient_pages "https://github.com/ssrssudharshanreddy/hospital_app/tree/main/frontend/src/pages"
click node_booking "https://github.com/ssrssudharshanreddy/hospital_app/blob/main/frontend/src/pages/NewConsultation/index.jsx"
click node_queue_pages "https://github.com/ssrssudharshanreddy/hospital_app/blob/main/frontend/src/pages/ProcessPatient/index.jsx"
click node_records "https://github.com/ssrssudharshanreddy/hospital_app/tree/main/frontend/src/pages"
click node_dashboard "https://github.com/ssrssudharshanreddy/hospital_app/blob/main/frontend/src/pages/Dashboard/index.jsx"
click node_doctor_views "https://github.com/ssrssudharshanreddy/hospital_app/tree/main/frontend/src/pages"
click node_ui_components "https://github.com/ssrssudharshanreddy/hospital_app/tree/main/frontend/src/components"
click node_api_client "https://github.com/ssrssudharshanreddy/hospital_app/blob/main/frontend/src/services/api.js"
click node_api_server "https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/api/server.cpp"
click node_domain_engine "https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/dsa/hospital_dsa.cpp"
click node_queue_adt "https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/dsa/patient_queue.cpp"
click node_domain_types "https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/dsa/structures.h"
click node_validation "https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/include/utils/validation.h"
click node_db_manager "https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/database/database_manager.cpp"
click node_db_config "https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/database/db_config.h"
click node_runtime "https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/src/main.cpp"

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_patient_pages,node_booking,node_queue_pages,node_records,node_dashboard,node_doctor_views,node_ui_components,node_api_client toneBlue
class node_api_server,node_runtime,node_mongo toneAmber
class node_domain_engine,node_queue_adt,node_domain_types,node_validation toneMint
class node_db_manager,node_db_config toneRose
class node_staff toneIndigo
```

## Components

### React application

- [Routes and shell](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Patient management](https://github.com/ssrssudharshanreddy/hospital_app/tree/main/frontend/src/pages): `frontend/src/pages`
- [Consultation booking](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/frontend/src/pages/NewConsultation/index.jsx): `frontend/src/pages/NewConsultation/index.jsx`
- [Queue workstation](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/frontend/src/pages/ProcessPatient/index.jsx): `frontend/src/pages/ProcessPatient/index.jsx`
- [Records and cancellation](https://github.com/ssrssudharshanreddy/hospital_app/tree/main/frontend/src/pages): `frontend/src/pages`
- [Dashboard telemetry](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/frontend/src/pages/Dashboard/index.jsx): `frontend/src/pages/Dashboard/index.jsx`
- [Doctor directory and queues](https://github.com/ssrssudharshanreddy/hospital_app/tree/main/frontend/src/pages): `frontend/src/pages`
- [Shared UI components](https://github.com/ssrssudharshanreddy/hospital_app/tree/main/frontend/src/components): `frontend/src/components`
- [HTTP API client](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### REST service

- [HTTP route handler](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/api/server.cpp): `backend/api/server.cpp`
- [Backend startup](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/src/main.cpp): `backend/src/main.cpp`

### Clinical domain

- [Patient and consultation engine](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/dsa/hospital_dsa.cpp): `backend/dsa/hospital_dsa.cpp`
- [Circular patient queues](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/dsa/patient_queue.cpp): `backend/dsa/patient_queue.cpp`
- [Patient and visit records](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/dsa/structures.h): `backend/dsa/structures.h`
- [Input validation](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/include/utils/validation.h): `backend/include/utils/validation.h`

### Persistence

- [Database manager](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/database/database_manager.cpp): `backend/database/database_manager.cpp`
- [Mongo configuration](https://github.com/ssrssudharshanreddy/hospital_app/blob/main/backend/database/db_config.h): `backend/database/db_config.h`

### Other components

- **Clinic staff**
- **MongoDB**

## Connections

- Clinic staff → Routes and shell: uses
- Routes and shell → Patient management: routes to (evidence: `frontend/src/App.jsx`)
- Routes and shell → Consultation booking: routes to (evidence: `frontend/src/App.jsx`)
- Routes and shell → Queue workstation: routes to (evidence: `frontend/src/App.jsx`)
- Routes and shell → Records and cancellation: routes to (evidence: `frontend/src/App.jsx`)
- Routes and shell → Dashboard telemetry: routes to (evidence: `frontend/src/App.jsx`)
- Routes and shell → Doctor directory and queues: routes to (evidence: `frontend/src/App.jsx`)
- Patient management → HTTP API client: requests data (evidence: `frontend/src/pages/Dashboard/index.jsx`)
- Consultation booking → HTTP API client: books visits (evidence: `frontend/src/pages/NewConsultation/index.jsx`)
- Queue workstation → HTTP API client: processes queue (evidence: `frontend/src/pages/ProcessPatient/index.jsx`)
- Records and cancellation → HTTP API client: requests records (evidence: `frontend/src/pages/Dashboard/index.jsx`)
- Dashboard telemetry → HTTP API client: requests metrics (evidence: `frontend/src/pages/Dashboard/index.jsx`)
- Doctor directory and queues → HTTP API client: requests doctors (evidence: `frontend/src/pages/Dashboard/index.jsx`)
- Patient management → Shared UI components: renders with (evidence: `frontend/src/pages/RegisterPatient/index.jsx`)
- Consultation booking → Shared UI components: renders with (evidence: `frontend/src/pages/NewConsultation/index.jsx`)
- Queue workstation → Shared UI components: renders with (evidence: `frontend/src/pages/ProcessPatient/index.jsx`)
- Records and cancellation → Shared UI components: renders with (evidence: `frontend/src/pages/CancelConsultation/index.jsx`)
- HTTP API client → HTTP route handler: sends REST JSON
- Backend startup → HTTP route handler: starts (evidence: `backend/src/main.cpp`)
- HTTP route handler → Patient and consultation engine: delegates domain work
- HTTP route handler → Database manager: uses persistence
- Patient and consultation engine → Circular patient queues: uses queues
- Patient and consultation engine → Patient and visit records: manages records
- Patient and consultation engine → Input validation: validates inputs (evidence: `backend/dsa/hospital_dsa.cpp`)
- Database manager → Patient and visit records: stores records
- Backend startup → Database manager: initializes (evidence: `backend/src/main.cpp`)
- Backend startup → Patient and consultation engine: initializes (evidence: `backend/src/main.cpp`)
- Database manager → MongoDB: reads and writes
- Database manager → Mongo configuration: uses configuration
- Backend startup → Mongo configuration: configures (evidence: `backend/src/main.cpp`)
