# lokasorus/prescripto architecture

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

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

## Overview

Prescripto is a doctor-appointment booking system with patient, doctor, and admin portals backed by an Express API. The patient journey is doctor discovery, appointment selection and booking, payment, then appointment and profile management; doctors and admins manage appointments and platform records. The graph separates portal routing/state, API controllers, and domain data. Some frontend service files are present in the tree but their product role and connections are unclear from the excerpts, so they are omitted rather than assumed to be runtime dependencies.

Main entry points: [`backend/controllers/userController.js`](https://github.com/lokasorus/prescripto/blob/master/backend/controllers/userController.js) (Patient workflows), [`backend/controllers/adminController.js`](https://github.com/lokasorus/prescripto/blob/master/backend/controllers/adminController.js) (Admin workflows), [`frontend/src/App.jsx`](https://github.com/lokasorus/prescripto/blob/master/frontend/src/App.jsx) (Patient app routes), [`backend/controllers/doctorController.js`](https://github.com/lokasorus/prescripto/blob/master/backend/controllers/doctorController.js) (Doctor workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patient["Patient portal"]
  node_patient_app["Patient app routes<br/>[App.jsx]"]
  node_patient_context["Patient state and API<br/>[AppContext.jsx]"]
  node_doctor_discovery["Doctor discovery<br/>[Doctors.jsx]"]
  node_booking["Appointment booking<br/>[Appointment.jsx]"]
  node_patient_profile["Patient profile<br/>[MyProfile.jsx]"]
  node_patient_appointments["My appointments<br/>[MyAppointments.jsx]"]
end

subgraph group_staff["Doctor and admin portals"]
  node_admin_app["Staff app routes<br/>[App.jsx]"]
  node_admin_context["Admin state and API<br/>[AdminContext.jsx]"]
  node_doctor_context["Doctor state and API<br/>[DoctorContext.jsx]"]
  node_doctor_portal["Doctor management"]
  node_admin_portal["Admin management"]
end

subgraph group_api["Backend API"]
  node_server["API server<br/>[server.js]"]
  node_user_routes["Patient routes<br/>[userRoute.js]"]
  node_doctor_routes["Doctor routes<br/>[doctorRoute.js]"]
  node_admin_routes["Admin routes<br/>[adminRoute.js]"]
  node_user_controller["Patient workflows<br/>[userController.js]"]
  node_doctor_controller["Doctor workflows"]
  node_admin_controller["Admin workflows<br/>[adminController.js]"]
end

subgraph group_domain["Domain data"]
  node_users[("User records<br/>[userModel.js]")]
  node_doctors[("Doctor records and slots<br/>[doctorModel.js]")]
  node_appointments[("Appointment records")]
end

node_patient_actor(("Patient"))
node_razorpay["Razorpay"]
node_cloudinary["Cloudinary"]

node_patient_actor -->|"uses"| node_patient_app
node_patient_app -->|"routes to"| node_doctor_discovery
node_patient_app -->|"routes to"| node_booking
node_patient_app -->|"routes to"| node_patient_profile
node_patient_app -->|"routes to"| node_patient_appointments
node_patient_context -->|"provides data"| node_doctor_discovery
node_patient_context -.->|"requests profile"| node_user_controller
node_booking -.->|"books appointment"| node_user_controller
node_patient_appointments -.->|"manages bookings"| node_user_controller
node_admin_app -->|"routes to"| node_admin_portal
node_admin_app -->|"routes to"| node_doctor_portal
node_admin_context -->|"requests admin data"| node_admin_controller
node_doctor_context -->|"requests doctor data"| node_doctor_controller
node_server -->|"mounts"| node_user_routes
node_server -->|"mounts"| node_doctor_routes
node_server -->|"mounts"| node_admin_routes
node_user_routes -->|"dispatches"| node_user_controller
node_doctor_routes -->|"dispatches"| node_doctor_controller
node_admin_routes -->|"dispatches"| node_admin_controller
node_user_controller -->|"reads and writes"| node_users
node_user_controller -->|"reads and updates slots"| node_doctors
node_user_controller -->|"creates and updates"| node_appointments
node_user_controller -->|"creates payment orders"| node_razorpay
node_user_controller -.->|"uploads profile images"| node_cloudinary
node_doctor_controller -->|"reads and updates"| node_doctors
node_doctor_controller -->|"reads and updates"| node_appointments
node_admin_controller -->|"reads and writes"| node_doctors
node_admin_controller -->|"reads and updates"| node_appointments
node_admin_controller -->|"reads"| node_users
node_admin_controller -.->|"uploads doctor images"| node_cloudinary

click node_patient_app "https://github.com/lokasorus/prescripto/blob/master/frontend/src/App.jsx"
click node_patient_context "https://github.com/lokasorus/prescripto/blob/master/frontend/src/context/AppContext.jsx"
click node_doctor_discovery "https://github.com/lokasorus/prescripto/blob/master/frontend/src/pages/Doctors.jsx"
click node_booking "https://github.com/lokasorus/prescripto/blob/master/frontend/src/pages/Appointment.jsx"
click node_patient_profile "https://github.com/lokasorus/prescripto/blob/master/frontend/src/pages/MyProfile.jsx"
click node_patient_appointments "https://github.com/lokasorus/prescripto/blob/master/frontend/src/pages/MyAppointments.jsx"
click node_admin_app "https://github.com/lokasorus/prescripto/blob/master/admin/src/App.jsx"
click node_admin_context "https://github.com/lokasorus/prescripto/blob/master/admin/src/context/AdminContext.jsx"
click node_doctor_context "https://github.com/lokasorus/prescripto/blob/master/admin/src/context/DoctorContext.jsx"
click node_doctor_portal "https://github.com/lokasorus/prescripto/tree/master/admin/src/pages/doctor"
click node_admin_portal "https://github.com/lokasorus/prescripto/tree/master/admin/src/pages/admin"
click node_server "https://github.com/lokasorus/prescripto/blob/master/backend/server.js"
click node_user_routes "https://github.com/lokasorus/prescripto/blob/master/backend/routes/userRoute.js"
click node_doctor_routes "https://github.com/lokasorus/prescripto/blob/master/backend/routes/doctorRoute.js"
click node_admin_routes "https://github.com/lokasorus/prescripto/blob/master/backend/routes/adminRoute.js"
click node_user_controller "https://github.com/lokasorus/prescripto/blob/master/backend/controllers/userController.js"
click node_doctor_controller "https://github.com/lokasorus/prescripto/blob/master/backend/controllers/doctorController.js"
click node_admin_controller "https://github.com/lokasorus/prescripto/blob/master/backend/controllers/adminController.js"
click node_users "https://github.com/lokasorus/prescripto/blob/master/backend/models/userModel.js"
click node_doctors "https://github.com/lokasorus/prescripto/blob/master/backend/models/doctorModel.js"
click node_appointments "https://github.com/lokasorus/prescripto/blob/master/backend/models/appointmentModel.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_context,node_doctor_discovery,node_booking,node_patient_profile,node_patient_appointments toneBlue
class node_admin_app,node_admin_context,node_doctor_context,node_doctor_portal,node_admin_portal toneAmber
class node_server,node_user_routes,node_doctor_routes,node_admin_routes,node_user_controller,node_doctor_controller,node_admin_controller toneMint
class node_users,node_doctors,node_appointments toneRose
class node_patient_actor,node_razorpay,node_cloudinary toneIndigo
```

## Components

### Patient portal

- [Patient app routes](https://github.com/lokasorus/prescripto/blob/master/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Patient state and API](https://github.com/lokasorus/prescripto/blob/master/frontend/src/context/AppContext.jsx): `frontend/src/context/AppContext.jsx`
- [Doctor discovery](https://github.com/lokasorus/prescripto/blob/master/frontend/src/pages/Doctors.jsx): `frontend/src/pages/Doctors.jsx`
- [Appointment booking](https://github.com/lokasorus/prescripto/blob/master/frontend/src/pages/Appointment.jsx): `frontend/src/pages/Appointment.jsx`
- [Patient profile](https://github.com/lokasorus/prescripto/blob/master/frontend/src/pages/MyProfile.jsx): `frontend/src/pages/MyProfile.jsx`
- [My appointments](https://github.com/lokasorus/prescripto/blob/master/frontend/src/pages/MyAppointments.jsx): `frontend/src/pages/MyAppointments.jsx`

### Doctor and admin portals

- [Staff app routes](https://github.com/lokasorus/prescripto/blob/master/admin/src/App.jsx): `admin/src/App.jsx`
- [Admin state and API](https://github.com/lokasorus/prescripto/blob/master/admin/src/context/AdminContext.jsx): `admin/src/context/AdminContext.jsx`
- [Doctor state and API](https://github.com/lokasorus/prescripto/blob/master/admin/src/context/DoctorContext.jsx): `admin/src/context/DoctorContext.jsx`
- [Doctor management](https://github.com/lokasorus/prescripto/tree/master/admin/src/pages/doctor): `admin/src/pages/doctor`
- [Admin management](https://github.com/lokasorus/prescripto/tree/master/admin/src/pages/admin): `admin/src/pages/admin`

### Backend API

- [API server](https://github.com/lokasorus/prescripto/blob/master/backend/server.js): `backend/server.js`
- [Patient routes](https://github.com/lokasorus/prescripto/blob/master/backend/routes/userRoute.js): `backend/routes/userRoute.js`
- [Doctor routes](https://github.com/lokasorus/prescripto/blob/master/backend/routes/doctorRoute.js): `backend/routes/doctorRoute.js`
- [Admin routes](https://github.com/lokasorus/prescripto/blob/master/backend/routes/adminRoute.js): `backend/routes/adminRoute.js`
- [Patient workflows](https://github.com/lokasorus/prescripto/blob/master/backend/controllers/userController.js): `backend/controllers/userController.js`
- [Doctor workflows](https://github.com/lokasorus/prescripto/blob/master/backend/controllers/doctorController.js): `backend/controllers/doctorController.js`
- [Admin workflows](https://github.com/lokasorus/prescripto/blob/master/backend/controllers/adminController.js): `backend/controllers/adminController.js`

### Domain data

- [User records](https://github.com/lokasorus/prescripto/blob/master/backend/models/userModel.js): `backend/models/userModel.js`
- [Doctor records and slots](https://github.com/lokasorus/prescripto/blob/master/backend/models/doctorModel.js): `backend/models/doctorModel.js`
- [Appointment records](https://github.com/lokasorus/prescripto/blob/master/backend/models/appointmentModel.js): `backend/models/appointmentModel.js`

### Other components

- **Patient**
- **Razorpay**
- **Cloudinary**

## Connections

- Patient → Patient app routes: uses
- Patient app routes → Doctor discovery: routes to (evidence: `frontend/src/App.jsx`)
- Patient app routes → Appointment booking: routes to (evidence: `frontend/src/App.jsx`)
- Patient app routes → Patient profile: routes to (evidence: `frontend/src/App.jsx`)
- Patient app routes → My appointments: routes to (evidence: `frontend/src/App.jsx`)
- Patient state and API → Doctor discovery: provides data (evidence: `frontend/src/context/AppContext.jsx`)
- Patient state and API → Patient workflows: requests profile
- Appointment booking → Patient workflows: books appointment
- My appointments → Patient workflows: manages bookings
- Staff app routes → Admin management: routes to (evidence: `admin/src/App.jsx`)
- Staff app routes → Doctor management: routes to (evidence: `admin/src/App.jsx`)
- Admin state and API → Admin workflows: requests admin data (evidence: `admin/src/context/AdminContext.jsx`)
- Doctor state and API → Doctor workflows: requests doctor data (evidence: `admin/src/context/DoctorContext.jsx`)
- API server → Patient routes: mounts (evidence: `backend/server.js`)
- API server → Doctor routes: mounts (evidence: `backend/server.js`)
- API server → Admin routes: mounts (evidence: `backend/server.js`)
- Patient routes → Patient workflows: dispatches (evidence: `backend/routes/userRoute.js`)
- Doctor routes → Doctor workflows: dispatches (evidence: `backend/routes/doctorRoute.js`)
- Admin routes → Admin workflows: dispatches (evidence: `backend/routes/adminRoute.js`)
- Patient workflows → User records: reads and writes (evidence: `backend/controllers/userController.js`)
- Patient workflows → Doctor records and slots: reads and updates slots (evidence: `backend/controllers/userController.js`)
- Patient workflows → Appointment records: creates and updates (evidence: `backend/controllers/userController.js`)
- Patient workflows → Razorpay: creates payment orders (evidence: `backend/controllers/userController.js`)
- Patient workflows → Cloudinary: uploads profile images
- Doctor workflows → Doctor records and slots: reads and updates (evidence: `backend/controllers/doctorController.js`)
- Doctor workflows → Appointment records: reads and updates (evidence: `backend/controllers/doctorController.js`)
- Admin workflows → Doctor records and slots: reads and writes (evidence: `backend/controllers/adminController.js`)
- Admin workflows → Appointment records: reads and updates (evidence: `backend/controllers/adminController.js`)
- Admin workflows → User records: reads (evidence: `backend/controllers/adminController.js`)
- Admin workflows → Cloudinary: uploads doctor images
