# shorouqderieh/healthpal architecture

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

- Interactive diagram: https://gitdiagram.com/shorouqderieh/healthpal
- Repository: https://github.com/shorouqderieh/healthpal

## Overview

HealthPal is a healthcare API connecting patients, clinicians, donors, volunteers, and NGOs. Its user-facing flow is role-aware HTTP endpoints into domain handlers and services, with persistence through repositories and MySQL; documented workflows include remote consultations, sponsorship and transparency, aid coordination, education and alerts, counseling, and medical missions. The graph retains those product branches, but several are represented at their exact enclosing directories because their implementation files were not sampled. Edges are limited to relationships visible in excerpts, the source index, or the README.

Main entry points: [`routes/Feature 1.2/consultRoutes.js`](https://github.com/shorouqderieh/healthpal/blob/main/routes/Feature%201.2/consultRoutes.js) (Consult endpoints), [`controllers/Feature 2.2/patientProfileController.js`](https://github.com/shorouqderieh/healthpal/blob/main/controllers/Feature%202.2/patientProfileController.js) (Patient profiles), [`controllers/Feature 2.3/ngoController.js`](https://github.com/shorouqderieh/healthpal/blob/main/controllers/Feature%202.3/ngoController.js) (NGO transparency), [`database.js`](https://github.com/shorouqderieh/healthpal/blob/main/database.js) (MySQL pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_consult["Consultations"]
  node_consult_api["Consult endpoints<br/>[consultRoutes.js]"]
  node_consult_sessions["Session control"]
  node_consult_common["Participant checks"]
  node_consult_messages["Messages &amp; files<br/>[Feature 1.2]"]
  node_appointments["Appointments"]
end

subgraph group_sponsor["Sponsorship"]
  node_sponsor_api["Campaign endpoints"]
  node_sponsor_service["Treatment sponsorship"]
  node_sponsor_store["Campaign records"]
  node_patient_profiles["Patient profiles"]
  node_profile_service["Profile &amp; recovery"]
  node_profile_store["Profile records"]
  node_transparency["NGO transparency<br/>[ngoController.js]"]
  node_transparency_service["Disbursements &amp; docs<br/>[ngoService.js]"]
  node_transparency_store["Transparency records"]
end

subgraph group_community["Community Health"]
  node_education_alerts["Guides &amp; alerts"]
  node_webinars["Webinars<br/>[webinarsService.js]"]
  node_translation["Medical translation"]
  node_counseling["Counseling &amp; groups"]
end

subgraph group_aid["Aid Coordination"]
  node_aid_coordination["Medicine &amp; equipment"]
  node_missions["NGOs &amp; missions"]
end

subgraph group_platform["Platform Core"]
  node_auth["JWT access control<br/>[auth.js]"]
  node_database[("MySQL pool<br/>[database.js]")]
end

node_users(("Patients &amp; roles"))

node_users -->|"requests"| node_consult_api
node_consult_api -->|"dispatches"| node_consult_sessions
node_consult_api -->|"dispatches"| node_consult_messages
node_consult_sessions -->|"checks participants"| node_consult_common
node_users -->|"requests"| node_sponsor_api
node_sponsor_api -->|"calls"| node_sponsor_service
node_sponsor_api -->|"constructs repository"| node_sponsor_store
node_users -->|"requests"| node_patient_profiles
node_patient_profiles -->|"calls"| node_profile_service
node_patient_profiles -->|"constructs repository"| node_profile_store
node_users -->|"requests"| node_transparency
node_transparency -->|"calls"| node_transparency_service
node_transparency -->|"constructs repository"| node_transparency_store
node_users -->|"uses"| node_education_alerts
node_users -->|"uses"| node_webinars
node_users -->|"uses"| node_translation
node_users -->|"uses"| node_counseling
node_users -->|"requests aid"| node_aid_coordination
node_users -->|"joins outreach"| node_missions
node_consult_api -->|"authenticates"| node_auth
node_patient_profiles -->|"authenticates"| node_auth
node_transparency -->|"authenticates"| node_auth
node_consult_common -.->|"queries"| node_database
node_sponsor_store -->|"reads &amp; writes"| node_database
node_profile_store -->|"reads &amp; writes"| node_database
node_transparency_store -->|"reads &amp; writes"| node_database

click node_consult_api "https://github.com/shorouqderieh/healthpal/blob/main/routes/Feature%201.2/consultRoutes.js"
click node_consult_sessions "https://github.com/shorouqderieh/healthpal/blob/main/services/Feature%201.2/consultSessionsService.js"
click node_consult_common "https://github.com/shorouqderieh/healthpal/blob/main/repositories/Feature%201.2/consultCommonRepository.js"
click node_consult_messages "https://github.com/shorouqderieh/healthpal/tree/main/controllers/Feature%201.2"
click node_appointments "https://github.com/shorouqderieh/healthpal/blob/main/services/Feature%201.1/appointmentsService.js"
click node_sponsor_api "https://github.com/shorouqderieh/healthpal/blob/main/controllers/Feature%202.1/sponsorshipController.js"
click node_sponsor_service "https://github.com/shorouqderieh/healthpal/blob/main/services/Feature%202.1/SponsorshipService.js"
click node_sponsor_store "https://github.com/shorouqderieh/healthpal/blob/main/repositories/Feature%202.1/SponsorshipRepository.js"
click node_patient_profiles "https://github.com/shorouqderieh/healthpal/blob/main/controllers/Feature%202.2/patientProfileController.js"
click node_profile_service "https://github.com/shorouqderieh/healthpal/blob/main/services/Feature%202.2/PatientProfileService.js"
click node_profile_store "https://github.com/shorouqderieh/healthpal/blob/main/repositories/Feature%202.2/patientProfileRepository.js"
click node_transparency "https://github.com/shorouqderieh/healthpal/blob/main/controllers/Feature%202.3/ngoController.js"
click node_transparency_service "https://github.com/shorouqderieh/healthpal/blob/main/services/Feature%202.3/ngoService.js"
click node_transparency_store "https://github.com/shorouqderieh/healthpal/blob/main/repositories/Feature%202.3/TransparencyRepository.js"
click node_education_alerts "https://github.com/shorouqderieh/healthpal/blob/main/services/healthAlertsService.js"
click node_webinars "https://github.com/shorouqderieh/healthpal/blob/main/services/webinarsService.js"
click node_translation "https://github.com/shorouqderieh/healthpal/blob/main/services/Feature%201.3/translationService.js"
click node_counseling "https://github.com/shorouqderieh/healthpal/tree/main/services"
click node_aid_coordination "https://github.com/shorouqderieh/healthpal/tree/main/services"
click node_missions "https://github.com/shorouqderieh/healthpal/tree/main/services"
click node_auth "https://github.com/shorouqderieh/healthpal/blob/main/middleware/auth.js"
click node_database "https://github.com/shorouqderieh/healthpal/blob/main/database.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_consult_api,node_consult_sessions,node_consult_common,node_consult_messages,node_appointments toneBlue
class node_sponsor_api,node_sponsor_service,node_sponsor_store,node_patient_profiles,node_profile_service,node_profile_store,node_transparency,node_transparency_service,node_transparency_store toneAmber
class node_education_alerts,node_webinars,node_translation,node_counseling toneMint
class node_aid_coordination,node_missions toneRose
class node_auth,node_database,node_users toneIndigo
```

## Components

### Consultations

- [Consult endpoints](https://github.com/shorouqderieh/healthpal/blob/main/routes/Feature%201.2/consultRoutes.js): `routes/Feature 1.2/consultRoutes.js`
- [Session control](https://github.com/shorouqderieh/healthpal/blob/main/services/Feature%201.2/consultSessionsService.js): `services/Feature 1.2/consultSessionsService.js`
- [Participant checks](https://github.com/shorouqderieh/healthpal/blob/main/repositories/Feature%201.2/consultCommonRepository.js): `repositories/Feature 1.2/consultCommonRepository.js`
- [Messages & files](https://github.com/shorouqderieh/healthpal/tree/main/controllers/Feature%201.2): `controllers/Feature 1.2`
- [Appointments](https://github.com/shorouqderieh/healthpal/blob/main/services/Feature%201.1/appointmentsService.js): `services/Feature 1.1/appointmentsService.js`

### Sponsorship

- [Campaign endpoints](https://github.com/shorouqderieh/healthpal/blob/main/controllers/Feature%202.1/sponsorshipController.js): `controllers/Feature 2.1/sponsorshipController.js`
- [Treatment sponsorship](https://github.com/shorouqderieh/healthpal/blob/main/services/Feature%202.1/SponsorshipService.js): `services/Feature 2.1/SponsorshipService.js`
- [Campaign records](https://github.com/shorouqderieh/healthpal/blob/main/repositories/Feature%202.1/SponsorshipRepository.js): `repositories/Feature 2.1/SponsorshipRepository.js`
- [Patient profiles](https://github.com/shorouqderieh/healthpal/blob/main/controllers/Feature%202.2/patientProfileController.js): `controllers/Feature 2.2/patientProfileController.js`
- [Profile & recovery](https://github.com/shorouqderieh/healthpal/blob/main/services/Feature%202.2/PatientProfileService.js): `services/Feature 2.2/PatientProfileService.js`
- [Profile records](https://github.com/shorouqderieh/healthpal/blob/main/repositories/Feature%202.2/patientProfileRepository.js): `repositories/Feature 2.2/patientProfileRepository.js`
- [NGO transparency](https://github.com/shorouqderieh/healthpal/blob/main/controllers/Feature%202.3/ngoController.js): `controllers/Feature 2.3/ngoController.js`
- [Disbursements & docs](https://github.com/shorouqderieh/healthpal/blob/main/services/Feature%202.3/ngoService.js): `services/Feature 2.3/ngoService.js`
- [Transparency records](https://github.com/shorouqderieh/healthpal/blob/main/repositories/Feature%202.3/TransparencyRepository.js): `repositories/Feature 2.3/TransparencyRepository.js`

### Community Health

- [Guides & alerts](https://github.com/shorouqderieh/healthpal/blob/main/services/healthAlertsService.js): `services/healthAlertsService.js`
- [Webinars](https://github.com/shorouqderieh/healthpal/blob/main/services/webinarsService.js): `services/webinarsService.js`
- [Medical translation](https://github.com/shorouqderieh/healthpal/blob/main/services/Feature%201.3/translationService.js): `services/Feature 1.3/translationService.js`
- [Counseling & groups](https://github.com/shorouqderieh/healthpal/tree/main/services): `services`

### Aid Coordination

- [Medicine & equipment](https://github.com/shorouqderieh/healthpal/tree/main/services): `services`
- [NGOs & missions](https://github.com/shorouqderieh/healthpal/tree/main/services): `services`

### Platform Core

- [JWT access control](https://github.com/shorouqderieh/healthpal/blob/main/middleware/auth.js): `middleware/auth.js`
- [MySQL pool](https://github.com/shorouqderieh/healthpal/blob/main/database.js): `database.js`

### Other components

- **Patients & roles**

## Connections

- Patients & roles → Consult endpoints: requests (evidence: `routes/Feature 1.2/consultRoutes.js`)
- Consult endpoints → Session control: dispatches (evidence: `routes/Feature 1.2/consultRoutes.js`)
- Consult endpoints → Messages & files: dispatches (evidence: `routes/Feature 1.2/consultRoutes.js`)
- Session control → Participant checks: checks participants (evidence: `services/Feature 1.2/consultSessionsService.js`)
- Patients & roles → Campaign endpoints: requests (evidence: `README.md`)
- Campaign endpoints → Treatment sponsorship: calls (evidence: `controllers/Feature 2.1/sponsorshipController.js`)
- Campaign endpoints → Campaign records: constructs repository (evidence: `controllers/Feature 2.1/sponsorshipController.js`)
- Patients & roles → Patient profiles: requests
- Patient profiles → Profile & recovery: calls (evidence: `controllers/Feature 2.2/patientProfileController.js`)
- Patient profiles → Profile records: constructs repository (evidence: `controllers/Feature 2.2/patientProfileController.js`)
- Patients & roles → NGO transparency: requests
- NGO transparency → Disbursements & docs: calls (evidence: `controllers/Feature 2.3/ngoController.js`)
- NGO transparency → Transparency records: constructs repository (evidence: `controllers/Feature 2.3/ngoController.js`)
- Patients & roles → Guides & alerts: uses (evidence: `README.md`)
- Patients & roles → Webinars: uses (evidence: `README.md`)
- Patients & roles → Medical translation: uses (evidence: `README.md`)
- Patients & roles → Counseling & groups: uses (evidence: `README.md`)
- Patients & roles → Medicine & equipment: requests aid (evidence: `README.md`)
- Patients & roles → NGOs & missions: joins outreach (evidence: `README.md`)
- Consult endpoints → JWT access control: authenticates (evidence: `routes/Feature 1.2/consultRoutes.js`)
- Patient profiles → JWT access control: authenticates (evidence: `routes/Feature 2.2/patientProfileRoutes.js`)
- NGO transparency → JWT access control: authenticates (evidence: `routes/Feature 2.3/ngoRoutes.js`)
- Participant checks → MySQL pool: queries
- Campaign records → MySQL pool: reads & writes (evidence: `repositories/Feature 2.1/SponsorshipRepository.js`)
- Profile records → MySQL pool: reads & writes (evidence: `repositories/Feature 2.2/patientProfileRepository.js`)
- Transparency records → MySQL pool: reads & writes (evidence: `repositories/Feature 2.3/TransparencyRepository.js`)
