# somya-raman/medora architecture

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

- Interactive diagram: https://gitdiagram.com/somya-raman/medora
- Repository: https://github.com/somya-raman/medora

## Overview

Medora is a full-stack healthcare platform for patients, doctors, and administrators. The principal patient workflow is specialist discovery, appointment booking, consultation, and access to AI-simplified PDF reports; doctors manage appointments and author reports, while admins oversee users, appointments, and analytics. The graph groups route-level frontend workflows, API services, backend domain handlers, and supporting integrations. Some backend routes and domain handlers were not sampled, so uncertain connections are omitted or marked dashed.

Main entry points: [`server/src/controllers/report.controller.js`](https://github.com/somya-raman/medora/blob/main/server/src/controllers/report.controller.js) (Medical reports and templates), [`client/src/routes/AppRoutes.jsx`](https://github.com/somya-raman/medora/blob/main/client/src/routes/AppRoutes.jsx) (Role-based routing), [`client/src/pages/patient`](https://github.com/somya-raman/medora/tree/main/client/src/pages/patient) (Patient workflows), [`server/src/controllers/review.controller.js`](https://github.com/somya-raman/medora/blob/main/server/src/controllers/review.controller.js) (Ratings and reviews)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_patient["Patient workflows"]
  node_doctor["Doctor workflows"]
  node_admin["Admin workflows"]
  node_public["Public and account pages"]
  node_routing["Role-based routing<br/>[AppRoutes.jsx]"]
end

subgraph group_services["Client API"]
  node_patientapi["Patient API<br/>[patient.api.js]"]
  node_appointmentapi["Appointment API<br/>[appointment.api.js]"]
  node_reportapi["Report API<br/>[report.api.js]"]
  node_reviewapi["Review API<br/>[review.api.js]"]
  node_authapi["Authentication API<br/>[auth.api.js]"]
end

subgraph group_backend["Backend domains"]
  node_auth["Authentication<br/>[auth.controller.js]"]
  node_appointments["Appointment management"]
  node_doctors["Doctor and specialty discovery"]
  node_reports["Medical reports and templates"]
  node_reviews["Ratings and reviews"]
  node_administration["Administration and analytics"]
end

subgraph group_support["Backend services"]
  node_ai["AI report generation<br/>[ai.service.js]"]
  node_pdf["PDF and cloud storage<br/>[pdf.service.js]"]
  node_email["Email notifications<br/>[email.service.js]"]
end

subgraph group_data["Domain data"]
  node_appointmentdata[("Appointment records")]
  node_reportdata[("Medical report records")]
  node_reviewdata[("Review records<br/>[Review.model.js]")]
  node_doctordata[("Doctor records<br/>[Doctor.model.js]")]
  node_userdata[("User records<br/>[User.model.js]")]
end

node_mongo[("MongoDB")]
node_gemini["Google Gemini"]
node_cloudinary["Cloudinary"]
node_smtp["SMTP email"]

node_routing -->|"routes to"| node_patient
node_routing -->|"routes to"| node_doctor
node_routing -->|"routes to"| node_admin
node_routing -->|"routes to"| node_public
node_patient -.->|"uses"| node_patientapi
node_patient -->|"uses"| node_appointmentapi
node_doctor -->|"uses"| node_reportapi
node_doctor -->|"loads specialties"| node_patientapi
node_patient -->|"uses"| node_reviewapi
node_public -.->|"uses"| node_authapi
node_patientapi -.->|"requests data"| node_doctors
node_appointmentapi -.->|"requests actions"| node_appointments
node_reportapi -.->|"requests actions"| node_reports
node_reviewapi -.->|"requests actions"| node_reviews
node_authapi -.->|"requests actions"| node_auth
node_reports -->|"generates content"| node_ai
node_reports -->|"generates PDF"| node_pdf
node_reports -->|"notifies patient"| node_email
node_administration -->|"sends credentials"| node_email
node_reviews -->|"checks appointment"| node_appointmentdata
node_reviews -->|"creates and updates"| node_reviewdata
node_reviews -->|"updates ratings"| node_doctordata
node_reports -->|"stores reports"| node_reportdata
node_reports -->|"reads appointment"| node_appointmentdata
node_ai -.->|"uses model"| node_gemini
node_pdf -->|"stores documents"| node_cloudinary
node_email -.->|"sends mail"| node_smtp
node_appointmentdata -.->|"persists in"| node_mongo
node_reportdata -.->|"persists in"| node_mongo
node_reviewdata -.->|"persists in"| node_mongo
node_doctordata -.->|"persists in"| node_mongo
node_userdata -.->|"persists in"| node_mongo

click node_patient "https://github.com/somya-raman/medora/tree/main/client/src/pages/patient"
click node_doctor "https://github.com/somya-raman/medora/tree/main/client/src/pages/doctor"
click node_admin "https://github.com/somya-raman/medora/tree/main/client/src/pages/admin"
click node_public "https://github.com/somya-raman/medora/tree/main/client/src/pages/public"
click node_routing "https://github.com/somya-raman/medora/blob/main/client/src/routes/AppRoutes.jsx"
click node_patientapi "https://github.com/somya-raman/medora/blob/main/client/src/api/patient.api.js"
click node_appointmentapi "https://github.com/somya-raman/medora/blob/main/client/src/api/appointment.api.js"
click node_reportapi "https://github.com/somya-raman/medora/blob/main/client/src/api/report.api.js"
click node_reviewapi "https://github.com/somya-raman/medora/blob/main/client/src/api/review.api.js"
click node_authapi "https://github.com/somya-raman/medora/blob/main/client/src/api/auth.api.js"
click node_auth "https://github.com/somya-raman/medora/blob/main/server/src/controllers/auth.controller.js"
click node_appointments "https://github.com/somya-raman/medora/blob/main/server/src/controllers/appointment.controller.js"
click node_doctors "https://github.com/somya-raman/medora/blob/main/server/src/controllers/doctor.controller.js"
click node_reports "https://github.com/somya-raman/medora/blob/main/server/src/controllers/report.controller.js"
click node_reviews "https://github.com/somya-raman/medora/blob/main/server/src/controllers/review.controller.js"
click node_administration "https://github.com/somya-raman/medora/blob/main/server/src/controllers/admin.controller.js"
click node_ai "https://github.com/somya-raman/medora/blob/main/server/src/services/ai.service.js"
click node_pdf "https://github.com/somya-raman/medora/blob/main/server/src/services/pdf.service.js"
click node_email "https://github.com/somya-raman/medora/blob/main/server/src/services/email.service.js"
click node_appointmentdata "https://github.com/somya-raman/medora/blob/main/server/src/models/Appointment.model.js"
click node_reportdata "https://github.com/somya-raman/medora/blob/main/server/src/models/MedicalReport.model.js"
click node_reviewdata "https://github.com/somya-raman/medora/blob/main/server/src/models/Review.model.js"
click node_doctordata "https://github.com/somya-raman/medora/blob/main/server/src/models/Doctor.model.js"
click node_userdata "https://github.com/somya-raman/medora/blob/main/server/src/models/User.model.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_patient,node_doctor,node_admin,node_public,node_routing toneBlue
class node_patientapi,node_appointmentapi,node_reportapi,node_reviewapi,node_authapi,node_mongo toneAmber
class node_auth,node_appointments,node_doctors,node_reports,node_reviews,node_administration toneMint
class node_ai,node_pdf,node_email toneRose
class node_appointmentdata,node_reportdata,node_reviewdata,node_doctordata,node_userdata,node_gemini,node_cloudinary,node_smtp toneIndigo
```

## Components

### Web application

- [Patient workflows](https://github.com/somya-raman/medora/tree/main/client/src/pages/patient): `client/src/pages/patient`
- [Doctor workflows](https://github.com/somya-raman/medora/tree/main/client/src/pages/doctor): `client/src/pages/doctor`
- [Admin workflows](https://github.com/somya-raman/medora/tree/main/client/src/pages/admin): `client/src/pages/admin`
- [Public and account pages](https://github.com/somya-raman/medora/tree/main/client/src/pages/public): `client/src/pages/public`
- [Role-based routing](https://github.com/somya-raman/medora/blob/main/client/src/routes/AppRoutes.jsx): `client/src/routes/AppRoutes.jsx`

### Client API

- [Patient API](https://github.com/somya-raman/medora/blob/main/client/src/api/patient.api.js): `client/src/api/patient.api.js`
- [Appointment API](https://github.com/somya-raman/medora/blob/main/client/src/api/appointment.api.js): `client/src/api/appointment.api.js`
- [Report API](https://github.com/somya-raman/medora/blob/main/client/src/api/report.api.js): `client/src/api/report.api.js`
- [Review API](https://github.com/somya-raman/medora/blob/main/client/src/api/review.api.js): `client/src/api/review.api.js`
- [Authentication API](https://github.com/somya-raman/medora/blob/main/client/src/api/auth.api.js): `client/src/api/auth.api.js`

### Backend domains

- [Authentication](https://github.com/somya-raman/medora/blob/main/server/src/controllers/auth.controller.js): `server/src/controllers/auth.controller.js`
- [Appointment management](https://github.com/somya-raman/medora/blob/main/server/src/controllers/appointment.controller.js): `server/src/controllers/appointment.controller.js`
- [Doctor and specialty discovery](https://github.com/somya-raman/medora/blob/main/server/src/controllers/doctor.controller.js): `server/src/controllers/doctor.controller.js`
- [Medical reports and templates](https://github.com/somya-raman/medora/blob/main/server/src/controllers/report.controller.js): `server/src/controllers/report.controller.js`
- [Ratings and reviews](https://github.com/somya-raman/medora/blob/main/server/src/controllers/review.controller.js): `server/src/controllers/review.controller.js`
- [Administration and analytics](https://github.com/somya-raman/medora/blob/main/server/src/controllers/admin.controller.js): `server/src/controllers/admin.controller.js`

### Backend services

- [AI report generation](https://github.com/somya-raman/medora/blob/main/server/src/services/ai.service.js): `server/src/services/ai.service.js`
- [PDF and cloud storage](https://github.com/somya-raman/medora/blob/main/server/src/services/pdf.service.js): `server/src/services/pdf.service.js`
- [Email notifications](https://github.com/somya-raman/medora/blob/main/server/src/services/email.service.js): `server/src/services/email.service.js`

### Domain data

- [Appointment records](https://github.com/somya-raman/medora/blob/main/server/src/models/Appointment.model.js): `server/src/models/Appointment.model.js`
- [Medical report records](https://github.com/somya-raman/medora/blob/main/server/src/models/MedicalReport.model.js): `server/src/models/MedicalReport.model.js`
- [Review records](https://github.com/somya-raman/medora/blob/main/server/src/models/Review.model.js): `server/src/models/Review.model.js`
- [Doctor records](https://github.com/somya-raman/medora/blob/main/server/src/models/Doctor.model.js): `server/src/models/Doctor.model.js`
- [User records](https://github.com/somya-raman/medora/blob/main/server/src/models/User.model.js): `server/src/models/User.model.js`

### Other components

- **MongoDB**
- **Google Gemini**
- **Cloudinary**
- **SMTP email**

## Connections

- Role-based routing → Patient workflows: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Role-based routing → Doctor workflows: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Role-based routing → Admin workflows: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Role-based routing → Public and account pages: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Patient workflows → Patient API: uses (evidence: `client/src/pages/patient/BookingPage.jsx`)
- Patient workflows → Appointment API: uses (evidence: `client/src/pages/patient/BookingPage.jsx`)
- Doctor workflows → Report API: uses (evidence: `client/src/pages/doctor/TemplateManagerPage.jsx`)
- Doctor workflows → Patient API: loads specialties (evidence: `client/src/pages/doctor/TemplateManagerPage.jsx`)
- Patient workflows → Review API: uses
- Public and account pages → Authentication API: uses
- Patient API → Doctor and specialty discovery: requests data
- Appointment API → Appointment management: requests actions
- Report API → Medical reports and templates: requests actions
- Review API → Ratings and reviews: requests actions
- Authentication API → Authentication: requests actions
- Medical reports and templates → AI report generation: generates content (evidence: `server/src/controllers/report.controller.js`)
- Medical reports and templates → PDF and cloud storage: generates PDF (evidence: `server/src/controllers/report.controller.js`)
- Medical reports and templates → Email notifications: notifies patient (evidence: `server/src/controllers/report.controller.js`)
- Administration and analytics → Email notifications: sends credentials (evidence: `server/src/controllers/admin.controller.js`)
- Ratings and reviews → Appointment records: checks appointment (evidence: `server/src/controllers/review.controller.js`)
- Ratings and reviews → Review records: creates and updates (evidence: `server/src/controllers/review.controller.js`)
- Ratings and reviews → Doctor records: updates ratings (evidence: `server/src/controllers/review.controller.js`)
- Medical reports and templates → Medical report records: stores reports (evidence: `server/src/controllers/report.controller.js`)
- Medical reports and templates → Appointment records: reads appointment (evidence: `server/src/controllers/report.controller.js`)
- AI report generation → Google Gemini: uses model
- PDF and cloud storage → Cloudinary: stores documents (evidence: `server/src/services/pdf.service.js`)
- Email notifications → SMTP email: sends mail
- Appointment records → MongoDB: persists in
- Medical report records → MongoDB: persists in
- Review records → MongoDB: persists in
- Doctor records → MongoDB: persists in
- User records → MongoDB: persists in
