# ayushee-sharma/mp1 architecture

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

- Interactive diagram: https://gitdiagram.com/ayushee-sharma/mp1
- Repository: https://github.com/ayushee-sharma/mp1

## Overview

Reaching the Unreached is a rural-health access platform connecting patients with local doctors and hospitals. Users register or log in, discover providers and availability, book appointments, and manage follow-up; doctors handle appointment status and prescriptions, while admins oversee activity. The React app calls an Express API backed by MongoDB models. The main domain branches are represented alongside auth and API infrastructure. Some frontend pages and backend route/controller wiring were not sampled, so their connections are omitted where the evidence does not establish them.

Main entry points: [`frontend/src/App.jsx`](https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/App.jsx) (React application), [`backend/src/app.js`](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/app.js) (Express API), [`backend/src/controllers/adminController.js`](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/controllers/adminController.js) (Admin oversight), [`backend/src/models/Doctor.js`](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/models/Doctor.js) (Doctor records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["React application<br/>[App.jsx]"]
  node_discover["Doctor discovery"]
  node_profile["Doctor profile"]
  node_hospitals["Hospital directory<br/>[HospitalsPage.jsx]"]
  node_patient["Patient dashboard"]
  node_doctorui["Doctor dashboard"]
  node_adminui["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_appointmentsui["Appointments view"]
end

subgraph group_identity["Identity and access"]
  node_authcontext["Session context<br/>[AuthContext.jsx]"]
  node_authservice["Auth requests<br/>[authService.js]"]
  node_authcontroller["Authentication<br/>[authController.js]"]
  node_authmw["JWT authorization<br/>[authMiddleware.js]"]
end

subgraph group_care["Care coordination"]
  node_doctorservice["Doctor requests<br/>[doctorService.js]"]
  node_appointmentservice["Appointment requests"]
  node_doctorcontroller["Doctor directory and availability"]
  node_appointmentcontroller["Appointment lifecycle"]
  node_prescriptioncontroller["E-prescriptions"]
  node_hospitalcontroller["Hospital listings"]
end

subgraph group_oversight["Administration"]
  node_adminservice["Admin requests<br/>[adminService.js]"]
  node_admincontroller["Admin oversight<br/>[adminController.js]"]
end

subgraph group_platform["API and persistence"]
  node_api["HTTP client<br/>[api.js]"]
  node_server["Express API<br/>[app.js]"]
  node_users[("User records<br/>[User.js]")]
  node_doctors[("Doctor records<br/>[Doctor.js]")]
  node_patients[("Patient records<br/>[Patient.js]")]
  node_appointments[("Appointment records<br/>[Appointment.js]")]
  node_prescriptions[("Prescription records<br/>[Prescription.js]")]
  node_hospitalsdata[("Hospital records<br/>[Hospital.js]")]
end

node_visitor(("Patients and providers"))
node_mongo[("MongoDB")]

node_visitor -->|"uses"| node_app
node_app -->|"provides session"| node_authcontext
node_app -->|"routes to"| node_discover
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_hospitals
node_app -->|"routes to"| node_patient
node_app -->|"routes to"| node_doctorui
node_app -->|"routes to"| node_adminui
node_app -->|"routes to"| node_appointmentsui
node_authcontext -->|"calls"| node_authservice
node_authservice -->|"sends requests"| node_api
node_profile -->|"loads provider"| node_doctorservice
node_profile -->|"books visit"| node_appointmentservice
node_doctorui -->|"manages visits"| node_appointmentservice
node_doctorui -->|"updates availability"| node_doctorservice
node_doctorservice -->|"sends requests"| node_api
node_appointmentservice -->|"sends requests"| node_api
node_adminservice -->|"sends requests"| node_api
node_server -->|"mounts routes"| node_authcontroller
node_server -->|"mounts routes"| node_doctorcontroller
node_server -->|"mounts routes"| node_appointmentcontroller
node_server -->|"mounts routes"| node_prescriptioncontroller
node_server -->|"mounts routes"| node_admincontroller
node_server -.->|"mounts routes"| node_hospitalcontroller
node_authcontroller -->|"reads and writes"| node_users
node_authcontroller -->|"creates and reads"| node_doctors
node_authcontroller -->|"creates and reads"| node_patients
node_authmw -->|"resolves identity"| node_users
node_appointmentcontroller -->|"creates and updates"| node_appointments
node_appointmentcontroller -->|"checks provider"| node_doctors
node_appointmentcontroller -->|"loads patient"| node_patients
node_doctorcontroller -->|"searches and updates"| node_doctors
node_doctorcontroller -->|"checks booked slots"| node_appointments
node_prescriptioncontroller -->|"validates visit"| node_appointments
node_prescriptioncontroller -->|"checks ownership"| node_doctors
node_prescriptioncontroller -->|"manages records"| node_prescriptions
node_admincontroller -->|"counts users"| node_users
node_admincontroller -->|"oversees providers"| node_doctors
node_admincontroller -->|"counts patients"| node_patients
node_admincontroller -->|"counts visits"| node_appointments
node_admincontroller -->|"counts facilities"| node_hospitalsdata
node_hospitalcontroller -.->|"serves listings"| node_hospitalsdata
node_doctors -.->|"persists in"| node_mongo
node_users -.->|"persists in"| node_mongo
node_patients -.->|"persists in"| node_mongo
node_appointments -.->|"persists in"| node_mongo
node_prescriptions -.->|"persists in"| node_mongo
node_hospitalsdata -.->|"persists in"| node_mongo

click node_app "https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/App.jsx"
click node_discover "https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/pages/FindDoctorsPage.jsx"
click node_profile "https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/pages/DoctorProfilePage.jsx"
click node_hospitals "https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/pages/HospitalsPage.jsx"
click node_patient "https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/pages/PatientDashboard.jsx"
click node_doctorui "https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/pages/DoctorDashboard.jsx"
click node_adminui "https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/pages/AdminDashboard.jsx"
click node_appointmentsui "https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/pages/AppointmentsPage.jsx"
click node_authcontext "https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/context/AuthContext.jsx"
click node_authservice "https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/services/authService.js"
click node_api "https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/services/api.js"
click node_doctorservice "https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/services/doctorService.js"
click node_appointmentservice "https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/services/appointmentService.js"
click node_adminservice "https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/services/adminService.js"
click node_server "https://github.com/ayushee-sharma/mp1/blob/main/backend/src/app.js"
click node_authcontroller "https://github.com/ayushee-sharma/mp1/blob/main/backend/src/controllers/authController.js"
click node_authmw "https://github.com/ayushee-sharma/mp1/blob/main/backend/src/middleware/authMiddleware.js"
click node_doctorcontroller "https://github.com/ayushee-sharma/mp1/blob/main/backend/src/controllers/doctorController.js"
click node_appointmentcontroller "https://github.com/ayushee-sharma/mp1/blob/main/backend/src/controllers/appointmentController.js"
click node_prescriptioncontroller "https://github.com/ayushee-sharma/mp1/blob/main/backend/src/controllers/prescriptionController.js"
click node_admincontroller "https://github.com/ayushee-sharma/mp1/blob/main/backend/src/controllers/adminController.js"
click node_hospitalcontroller "https://github.com/ayushee-sharma/mp1/blob/main/backend/src/controllers/hospitalController.js"
click node_users "https://github.com/ayushee-sharma/mp1/blob/main/backend/src/models/User.js"
click node_doctors "https://github.com/ayushee-sharma/mp1/blob/main/backend/src/models/Doctor.js"
click node_patients "https://github.com/ayushee-sharma/mp1/blob/main/backend/src/models/Patient.js"
click node_appointments "https://github.com/ayushee-sharma/mp1/blob/main/backend/src/models/Appointment.js"
click node_prescriptions "https://github.com/ayushee-sharma/mp1/blob/main/backend/src/models/Prescription.js"
click node_hospitalsdata "https://github.com/ayushee-sharma/mp1/blob/main/backend/src/models/Hospital.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_discover,node_profile,node_hospitals,node_patient,node_doctorui,node_adminui,node_appointmentsui toneBlue
class node_authcontext,node_authservice,node_authcontroller,node_authmw,node_mongo toneAmber
class node_doctorservice,node_appointmentservice,node_doctorcontroller,node_appointmentcontroller,node_prescriptioncontroller,node_hospitalcontroller toneMint
class node_adminservice,node_admincontroller toneRose
class node_api,node_server,node_users,node_doctors,node_patients,node_appointments,node_prescriptions,node_hospitalsdata,node_visitor toneIndigo
```

## Components

### Web experience

- [React application](https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Doctor discovery](https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/pages/FindDoctorsPage.jsx): `frontend/src/pages/FindDoctorsPage.jsx`
- [Doctor profile](https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/pages/DoctorProfilePage.jsx): `frontend/src/pages/DoctorProfilePage.jsx`
- [Hospital directory](https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/pages/HospitalsPage.jsx): `frontend/src/pages/HospitalsPage.jsx`
- [Patient dashboard](https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/pages/PatientDashboard.jsx): `frontend/src/pages/PatientDashboard.jsx`
- [Doctor dashboard](https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/pages/DoctorDashboard.jsx): `frontend/src/pages/DoctorDashboard.jsx`
- [Admin dashboard](https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/pages/AdminDashboard.jsx): `frontend/src/pages/AdminDashboard.jsx`
- [Appointments view](https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/pages/AppointmentsPage.jsx): `frontend/src/pages/AppointmentsPage.jsx`

### Identity and access

- [Session context](https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Auth requests](https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/services/authService.js): `frontend/src/services/authService.js`
- [Authentication](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/controllers/authController.js): `backend/src/controllers/authController.js`
- [JWT authorization](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/middleware/authMiddleware.js): `backend/src/middleware/authMiddleware.js`

### Care coordination

- [Doctor requests](https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/services/doctorService.js): `frontend/src/services/doctorService.js`
- [Appointment requests](https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/services/appointmentService.js): `frontend/src/services/appointmentService.js`
- [Doctor directory and availability](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/controllers/doctorController.js): `backend/src/controllers/doctorController.js`
- [Appointment lifecycle](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/controllers/appointmentController.js): `backend/src/controllers/appointmentController.js`
- [E-prescriptions](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/controllers/prescriptionController.js): `backend/src/controllers/prescriptionController.js`
- [Hospital listings](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/controllers/hospitalController.js): `backend/src/controllers/hospitalController.js`

### Administration

- [Admin requests](https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/services/adminService.js): `frontend/src/services/adminService.js`
- [Admin oversight](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/controllers/adminController.js): `backend/src/controllers/adminController.js`

### API and persistence

- [HTTP client](https://github.com/ayushee-sharma/mp1/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Express API](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/app.js): `backend/src/app.js`
- [User records](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/models/User.js): `backend/src/models/User.js`
- [Doctor records](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/models/Doctor.js): `backend/src/models/Doctor.js`
- [Patient records](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/models/Patient.js): `backend/src/models/Patient.js`
- [Appointment records](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/models/Appointment.js): `backend/src/models/Appointment.js`
- [Prescription records](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/models/Prescription.js): `backend/src/models/Prescription.js`
- [Hospital records](https://github.com/ayushee-sharma/mp1/blob/main/backend/src/models/Hospital.js): `backend/src/models/Hospital.js`

### Other components

- **Patients and providers**
- **MongoDB**

## Connections

- Patients and providers → React application: uses (evidence: `frontend/src/App.jsx`)
- React application → Session context: provides session (evidence: `frontend/src/App.jsx`)
- React application → Doctor discovery: routes to (evidence: `frontend/src/App.jsx`)
- React application → Doctor profile: routes to (evidence: `frontend/src/App.jsx`)
- React application → Hospital directory: routes to (evidence: `frontend/src/App.jsx`)
- React application → Patient dashboard: routes to (evidence: `frontend/src/App.jsx`)
- React application → Doctor dashboard: routes to (evidence: `frontend/src/App.jsx`)
- React application → Admin dashboard: routes to (evidence: `frontend/src/App.jsx`)
- React application → Appointments view: routes to (evidence: `frontend/src/App.jsx`)
- Session context → Auth requests: calls (evidence: `frontend/src/context/AuthContext.jsx`)
- Auth requests → HTTP client: sends requests (evidence: `frontend/src/services/authService.js`)
- Doctor profile → Doctor requests: loads provider (evidence: `frontend/src/pages/DoctorProfilePage.jsx`)
- Doctor profile → Appointment requests: books visit (evidence: `frontend/src/pages/DoctorProfilePage.jsx`)
- Doctor dashboard → Appointment requests: manages visits (evidence: `frontend/src/pages/DoctorDashboard.jsx`)
- Doctor dashboard → Doctor requests: updates availability (evidence: `frontend/src/pages/DoctorDashboard.jsx`)
- Doctor requests → HTTP client: sends requests (evidence: `frontend/src/services/doctorService.js`)
- Appointment requests → HTTP client: sends requests (evidence: `frontend/src/services/appointmentService.js`)
- Admin requests → HTTP client: sends requests (evidence: `frontend/src/services/adminService.js`)
- Express API → Authentication: mounts routes (evidence: `backend/src/app.js`)
- Express API → Doctor directory and availability: mounts routes (evidence: `backend/src/app.js`)
- Express API → Appointment lifecycle: mounts routes (evidence: `backend/src/app.js`)
- Express API → E-prescriptions: mounts routes (evidence: `backend/src/app.js`)
- Express API → Admin oversight: mounts routes (evidence: `backend/src/app.js`)
- Express API → Hospital listings: mounts routes
- Authentication → User records: reads and writes (evidence: `backend/src/controllers/authController.js`)
- Authentication → Doctor records: creates and reads (evidence: `backend/src/controllers/authController.js`)
- Authentication → Patient records: creates and reads (evidence: `backend/src/controllers/authController.js`)
- JWT authorization → User records: resolves identity (evidence: `backend/src/middleware/authMiddleware.js`)
- Appointment lifecycle → Appointment records: creates and updates (evidence: `backend/src/controllers/appointmentController.js`)
- Appointment lifecycle → Doctor records: checks provider (evidence: `backend/src/controllers/appointmentController.js`)
- Appointment lifecycle → Patient records: loads patient (evidence: `backend/src/controllers/appointmentController.js`)
- Doctor directory and availability → Doctor records: searches and updates (evidence: `backend/src/controllers/doctorController.js`)
- Doctor directory and availability → Appointment records: checks booked slots (evidence: `backend/src/controllers/doctorController.js`)
- E-prescriptions → Appointment records: validates visit (evidence: `backend/src/controllers/prescriptionController.js`)
- E-prescriptions → Doctor records: checks ownership (evidence: `backend/src/controllers/prescriptionController.js`)
- E-prescriptions → Prescription records: manages records (evidence: `backend/src/controllers/prescriptionController.js`)
- Admin oversight → User records: counts users (evidence: `backend/src/controllers/adminController.js`)
- Admin oversight → Doctor records: oversees providers (evidence: `backend/src/controllers/adminController.js`)
- Admin oversight → Patient records: counts patients (evidence: `backend/src/controllers/adminController.js`)
- Admin oversight → Appointment records: counts visits (evidence: `backend/src/controllers/adminController.js`)
- Admin oversight → Hospital records: counts facilities (evidence: `backend/src/controllers/adminController.js`)
- Hospital listings → Hospital records: serves listings
- Doctor records → MongoDB: persists in
- User records → MongoDB: persists in
- Patient records → MongoDB: persists in
- Appointment records → MongoDB: persists in
- Prescription records → MongoDB: persists in
- Hospital records → MongoDB: persists in
