# soham-lodh/prescripto architecture

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

- Interactive diagram: https://gitdiagram.com/soham-lodh/prescripto
- Repository: https://github.com/soham-lodh/prescripto

## Overview

Prescripto is a healthcare appointment platform with patient and combined admin/doctor portals backed by an Express API. Patients discover doctors, manage profiles, book and track appointments, and submit contact messages; doctors manage availability and appointments; admins manage doctors, appointments, and messages. The graph separates portal state and workflows from API routing, domain controllers, persistence, and image storage. Relationships reflect shown calls, imports, or README capabilities; unsampled page and backend behavior is not inferred beyond documented features.

Main entry points: [`backend/server.js`](https://github.com/soham-lodh/prescripto/blob/master/backend/server.js) (API server), [`backend/controllers/userController.js`](https://github.com/soham-lodh/prescripto/blob/master/backend/controllers/userController.js) (Patient workflows), [`backend/controllers/adminController.js`](https://github.com/soham-lodh/prescripto/blob/master/backend/controllers/adminController.js) (Admin workflows), [`frontend/src/context/AppContext.jsx`](https://github.com/soham-lodh/prescripto/blob/master/frontend/src/context/AppContext.jsx) (Patient state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patient["Patient portal"]
  node_patient_app["Patient app<br/>[App.jsx]"]
  node_patient_state["Patient state<br/>[AppContext.jsx]"]
  node_patient_login["Sign-in and profile<br/>[Login.jsx]"]
  node_doctor_discovery["Doctor discovery<br/>[Doctors.jsx]"]
  node_booking["Appointment booking<br/>[Appointments.jsx]"]
  node_patient_history["Appointment history<br/>[MyAppointments.jsx]"]
  node_contact["Contact form<br/>[Contact.jsx]"]
end

subgraph group_staff["Admin and doctor portal"]
  node_staff_app["Staff app<br/>[App.jsx]"]
  node_admin_state["Admin state<br/>[AdminContext.jsx]"]
  node_doctor_state["Doctor state<br/>[DoctorContext.jsx]"]
  node_doctor_admin["Doctor management<br/>[AddDoctor.jsx]"]
  node_doctor_list["Doctor directory<br/>[DoctorsList.jsx]"]
  node_admin_appointments["Platform appointments"]
  node_admin_messages["Message inbox<br/>[Messages.jsx]"]
  node_doctor_schedule["Doctor schedule"]
  node_doctor_profile["Doctor profile<br/>[DoctorProfile.jsx]"]
end

subgraph group_api["REST API"]
  node_server["API server<br/>[server.js]"]
  node_user_routes["Patient routes<br/>[userRoute.js]"]
  node_doctor_routes["Doctor routes<br/>[doctorRoutes.js]"]
  node_admin_routes["Admin routes<br/>[adminRoutes.js]"]
end

subgraph group_domain["Domain and persistence"]
  node_user_controller["Patient workflows<br/>[userController.js]"]
  node_doctor_controller["Doctor workflows"]
  node_admin_controller["Admin workflows<br/>[adminController.js]"]
  node_appointment_helper["Appointment lifecycle"]
  node_doctor_model[("Doctor records<br/>[doctorModel.js]")]
  node_user_model[("Patient records<br/>[userModel.js]")]
  node_appointment_model[("Appointment records")]
  node_contact_model[("Contact messages<br/>[contactModel.js]")]
end

node_patient_actor(("Patient"))
node_staff_actor(("Admin or doctor"))
node_cloudinary["Cloudinary"]

node_patient_actor -->|"uses"| node_patient_app
node_patient_app -->|"provides state"| node_patient_state
node_patient_state -->|"requests doctors and profile"| node_server
node_patient_login -->|"uses"| node_patient_state
node_doctor_discovery -->|"uses"| node_patient_state
node_booking -->|"uses"| node_patient_state
node_patient_history -->|"uses"| node_patient_state
node_contact -.->|"submits message"| node_server
node_staff_actor -->|"uses"| node_staff_app
node_staff_app -->|"provides state"| node_admin_state
node_staff_app -->|"provides state"| node_doctor_state
node_admin_state -->|"requests admin data"| node_server
node_doctor_state -->|"requests doctor data"| node_server
node_doctor_admin -->|"uses"| node_admin_state
node_doctor_profile -->|"updates profile"| node_doctor_state
node_admin_routes -->|"routes to"| node_admin_controller
node_doctor_routes -->|"routes to"| node_doctor_controller
node_server -->|"mounts"| node_admin_routes
node_server -->|"mounts"| node_doctor_routes
node_server -->|"mounts"| node_user_routes
node_user_routes -->|"routes to"| node_user_controller
node_user_controller -->|"reads and updates"| node_doctor_model
node_user_controller -->|"reads and writes"| node_user_model
node_user_controller -->|"creates and updates"| node_appointment_model
node_user_controller -->|"creates messages"| node_contact_model
node_user_controller -->|"checks completion"| node_appointment_helper
node_doctor_controller -->|"reads and updates"| node_doctor_model
node_doctor_controller -->|"reads and updates"| node_appointment_model
node_doctor_controller -->|"checks completion"| node_appointment_helper
node_admin_controller -->|"manages doctors"| node_doctor_model
node_admin_controller -->|"manages appointments"| node_appointment_model
node_admin_controller -->|"reads messages"| node_contact_model
node_admin_controller -->|"reads patients"| node_user_model
node_appointment_helper -->|"updates lifecycle"| node_appointment_model
node_admin_controller -->|"uploads doctor images"| node_cloudinary
node_doctor_controller -->|"uploads profile images"| node_cloudinary

click node_patient_app "https://github.com/soham-lodh/prescripto/blob/master/frontend/src/App.jsx"
click node_patient_state "https://github.com/soham-lodh/prescripto/blob/master/frontend/src/context/AppContext.jsx"
click node_patient_login "https://github.com/soham-lodh/prescripto/blob/master/frontend/src/pages/Login.jsx"
click node_doctor_discovery "https://github.com/soham-lodh/prescripto/blob/master/frontend/src/pages/Doctors.jsx"
click node_booking "https://github.com/soham-lodh/prescripto/blob/master/frontend/src/pages/Appointments.jsx"
click node_patient_history "https://github.com/soham-lodh/prescripto/blob/master/frontend/src/pages/MyAppointments.jsx"
click node_contact "https://github.com/soham-lodh/prescripto/blob/master/frontend/src/pages/Contact.jsx"
click node_staff_app "https://github.com/soham-lodh/prescripto/blob/master/admin/src/App.jsx"
click node_admin_state "https://github.com/soham-lodh/prescripto/blob/master/admin/src/context/AdminContext.jsx"
click node_doctor_state "https://github.com/soham-lodh/prescripto/blob/master/admin/src/context/DoctorContext.jsx"
click node_doctor_admin "https://github.com/soham-lodh/prescripto/blob/master/admin/src/pages/Admin/AddDoctor.jsx"
click node_doctor_list "https://github.com/soham-lodh/prescripto/blob/master/admin/src/pages/Admin/DoctorsList.jsx"
click node_admin_appointments "https://github.com/soham-lodh/prescripto/blob/master/admin/src/pages/Admin/AllAppointments.jsx"
click node_admin_messages "https://github.com/soham-lodh/prescripto/blob/master/admin/src/pages/Admin/Messages.jsx"
click node_doctor_schedule "https://github.com/soham-lodh/prescripto/blob/master/admin/src/pages/Doctor/DoctorAppointments.jsx"
click node_doctor_profile "https://github.com/soham-lodh/prescripto/blob/master/admin/src/pages/Doctor/DoctorProfile.jsx"
click node_server "https://github.com/soham-lodh/prescripto/blob/master/backend/server.js"
click node_user_routes "https://github.com/soham-lodh/prescripto/blob/master/backend/routes/userRoute.js"
click node_doctor_routes "https://github.com/soham-lodh/prescripto/blob/master/backend/routes/doctorRoutes.js"
click node_admin_routes "https://github.com/soham-lodh/prescripto/blob/master/backend/routes/adminRoutes.js"
click node_user_controller "https://github.com/soham-lodh/prescripto/blob/master/backend/controllers/userController.js"
click node_doctor_controller "https://github.com/soham-lodh/prescripto/blob/master/backend/controllers/doctorController.js"
click node_admin_controller "https://github.com/soham-lodh/prescripto/blob/master/backend/controllers/adminController.js"
click node_appointment_helper "https://github.com/soham-lodh/prescripto/blob/master/backend/helpers/appointmentHelper.js"
click node_doctor_model "https://github.com/soham-lodh/prescripto/blob/master/backend/models/doctorModel.js"
click node_user_model "https://github.com/soham-lodh/prescripto/blob/master/backend/models/userModel.js"
click node_appointment_model "https://github.com/soham-lodh/prescripto/blob/master/backend/models/appointmentModel.js"
click node_contact_model "https://github.com/soham-lodh/prescripto/blob/master/backend/models/contactModel.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_app,node_patient_state,node_patient_login,node_doctor_discovery,node_booking,node_patient_history,node_contact toneBlue
class node_staff_app,node_admin_state,node_doctor_state,node_doctor_admin,node_doctor_list,node_admin_appointments,node_admin_messages,node_doctor_schedule,node_doctor_profile toneAmber
class node_server,node_user_routes,node_doctor_routes,node_admin_routes toneMint
class node_user_controller,node_doctor_controller,node_admin_controller,node_appointment_helper,node_doctor_model,node_user_model,node_appointment_model,node_contact_model toneRose
class node_patient_actor,node_staff_actor,node_cloudinary toneIndigo
```

## Components

### Patient portal

- [Patient app](https://github.com/soham-lodh/prescripto/blob/master/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Patient state](https://github.com/soham-lodh/prescripto/blob/master/frontend/src/context/AppContext.jsx): `frontend/src/context/AppContext.jsx`
- [Sign-in and profile](https://github.com/soham-lodh/prescripto/blob/master/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Doctor discovery](https://github.com/soham-lodh/prescripto/blob/master/frontend/src/pages/Doctors.jsx): `frontend/src/pages/Doctors.jsx`
- [Appointment booking](https://github.com/soham-lodh/prescripto/blob/master/frontend/src/pages/Appointments.jsx): `frontend/src/pages/Appointments.jsx`
- [Appointment history](https://github.com/soham-lodh/prescripto/blob/master/frontend/src/pages/MyAppointments.jsx): `frontend/src/pages/MyAppointments.jsx`
- [Contact form](https://github.com/soham-lodh/prescripto/blob/master/frontend/src/pages/Contact.jsx): `frontend/src/pages/Contact.jsx`

### Admin and doctor portal

- [Staff app](https://github.com/soham-lodh/prescripto/blob/master/admin/src/App.jsx): `admin/src/App.jsx`
- [Admin state](https://github.com/soham-lodh/prescripto/blob/master/admin/src/context/AdminContext.jsx): `admin/src/context/AdminContext.jsx`
- [Doctor state](https://github.com/soham-lodh/prescripto/blob/master/admin/src/context/DoctorContext.jsx): `admin/src/context/DoctorContext.jsx`
- [Doctor management](https://github.com/soham-lodh/prescripto/blob/master/admin/src/pages/Admin/AddDoctor.jsx): `admin/src/pages/Admin/AddDoctor.jsx`
- [Doctor directory](https://github.com/soham-lodh/prescripto/blob/master/admin/src/pages/Admin/DoctorsList.jsx): `admin/src/pages/Admin/DoctorsList.jsx`
- [Platform appointments](https://github.com/soham-lodh/prescripto/blob/master/admin/src/pages/Admin/AllAppointments.jsx): `admin/src/pages/Admin/AllAppointments.jsx`
- [Message inbox](https://github.com/soham-lodh/prescripto/blob/master/admin/src/pages/Admin/Messages.jsx): `admin/src/pages/Admin/Messages.jsx`
- [Doctor schedule](https://github.com/soham-lodh/prescripto/blob/master/admin/src/pages/Doctor/DoctorAppointments.jsx): `admin/src/pages/Doctor/DoctorAppointments.jsx`
- [Doctor profile](https://github.com/soham-lodh/prescripto/blob/master/admin/src/pages/Doctor/DoctorProfile.jsx): `admin/src/pages/Doctor/DoctorProfile.jsx`

### REST API

- [API server](https://github.com/soham-lodh/prescripto/blob/master/backend/server.js): `backend/server.js`
- [Patient routes](https://github.com/soham-lodh/prescripto/blob/master/backend/routes/userRoute.js): `backend/routes/userRoute.js`
- [Doctor routes](https://github.com/soham-lodh/prescripto/blob/master/backend/routes/doctorRoutes.js): `backend/routes/doctorRoutes.js`
- [Admin routes](https://github.com/soham-lodh/prescripto/blob/master/backend/routes/adminRoutes.js): `backend/routes/adminRoutes.js`

### Domain and persistence

- [Patient workflows](https://github.com/soham-lodh/prescripto/blob/master/backend/controllers/userController.js): `backend/controllers/userController.js`
- [Doctor workflows](https://github.com/soham-lodh/prescripto/blob/master/backend/controllers/doctorController.js): `backend/controllers/doctorController.js`
- [Admin workflows](https://github.com/soham-lodh/prescripto/blob/master/backend/controllers/adminController.js): `backend/controllers/adminController.js`
- [Appointment lifecycle](https://github.com/soham-lodh/prescripto/blob/master/backend/helpers/appointmentHelper.js): `backend/helpers/appointmentHelper.js`
- [Doctor records](https://github.com/soham-lodh/prescripto/blob/master/backend/models/doctorModel.js): `backend/models/doctorModel.js`
- [Patient records](https://github.com/soham-lodh/prescripto/blob/master/backend/models/userModel.js): `backend/models/userModel.js`
- [Appointment records](https://github.com/soham-lodh/prescripto/blob/master/backend/models/appointmentModel.js): `backend/models/appointmentModel.js`
- [Contact messages](https://github.com/soham-lodh/prescripto/blob/master/backend/models/contactModel.js): `backend/models/contactModel.js`

### Other components

- **Patient**
- **Admin or doctor**
- **Cloudinary**

## Connections

- Patient → Patient app: uses
- Patient app → Patient state: provides state (evidence: `frontend/src/main.jsx`)
- Patient state → API server: requests doctors and profile (evidence: `frontend/src/context/AppContext.jsx`)
- Sign-in and profile → Patient state: uses (evidence: `frontend/src/pages/Login.jsx`)
- Doctor discovery → Patient state: uses (evidence: `frontend/src/context/AppContext.jsx`)
- Appointment booking → Patient state: uses (evidence: `frontend/src/pages/Appointments.jsx`)
- Appointment history → Patient state: uses (evidence: `frontend/src/pages/MyAppointments.jsx`)
- Contact form → API server: submits message
- Admin or doctor → Staff app: uses
- Staff app → Admin state: provides state (evidence: `admin/src/main.jsx`)
- Staff app → Doctor state: provides state (evidence: `admin/src/main.jsx`)
- Admin state → API server: requests admin data (evidence: `admin/src/context/AdminContext.jsx`)
- Doctor state → API server: requests doctor data (evidence: `admin/src/context/DoctorContext.jsx`)
- Doctor management → Admin state: uses
- Doctor profile → Doctor state: updates profile (evidence: `admin/src/pages/Doctor/DoctorProfile.jsx`)
- Admin routes → Admin workflows: routes to (evidence: `backend/routes/adminRoutes.js`)
- Doctor routes → Doctor workflows: routes to (evidence: `backend/routes/doctorRoutes.js`)
- API server → Admin routes: mounts (evidence: `backend/server.js`)
- API server → Doctor routes: mounts (evidence: `backend/server.js`)
- API server → Patient routes: mounts (evidence: `backend/server.js`)
- Patient routes → Patient workflows: routes to (evidence: `backend/routes/userRoute.js`)
- Patient workflows → Doctor records: reads and updates (evidence: `backend/controllers/userController.js`)
- Patient workflows → Patient records: reads and writes (evidence: `backend/controllers/userController.js`)
- Patient workflows → Appointment records: creates and updates (evidence: `backend/controllers/userController.js`)
- Patient workflows → Contact messages: creates messages (evidence: `backend/controllers/userController.js`)
- Patient workflows → Appointment lifecycle: checks completion (evidence: `backend/controllers/userController.js`)
- Doctor workflows → Doctor records: reads and updates (evidence: `backend/controllers/doctorController.js`)
- Doctor workflows → Appointment records: reads and updates (evidence: `backend/controllers/doctorController.js`)
- Doctor workflows → Appointment lifecycle: checks completion (evidence: `backend/controllers/doctorController.js`)
- Admin workflows → Doctor records: manages doctors (evidence: `backend/controllers/adminController.js`)
- Admin workflows → Appointment records: manages appointments (evidence: `backend/controllers/adminController.js`)
- Admin workflows → Contact messages: reads messages (evidence: `backend/controllers/adminController.js`)
- Admin workflows → Patient records: reads patients (evidence: `backend/controllers/adminController.js`)
- Appointment lifecycle → Appointment records: updates lifecycle (evidence: `backend/helpers/appointmentHelper.js`)
- Admin workflows → Cloudinary: uploads doctor images (evidence: `backend/controllers/adminController.js`)
- Doctor workflows → Cloudinary: uploads profile images (evidence: `backend/controllers/doctorController.js`)
