# vishwak-tech/prescripto architecture

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

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

## Overview

Prescripto is a role-based healthcare appointment platform: patients discover doctors, manage profiles, book and pay for appointments; doctors manage availability and appointments; administrators manage doctors, appointments and platform activity. The runtime comprises patient and staff React apps backed by an Express API, MongoDB models, and media/payment integrations. The graph keeps booking, payment, provider management and administrative workflows distinct. Some browser-to-API wiring is documented but not shown in sampled frontend source, so those connections are marked unverified.

Main entry points: [`backend/controllers/userController.js`](https://github.com/vishwak-tech/prescripto/blob/main/backend/controllers/userController.js) (Patient workflows), [`backend/server.js`](https://github.com/vishwak-tech/prescripto/blob/main/backend/server.js) (API server), [`frontend/src/App.jsx`](https://github.com/vishwak-tech/prescripto/blob/main/frontend/src/App.jsx) (Patient app routes), [`backend/controllers/adminController.js`](https://github.com/vishwak-tech/prescripto/blob/main/backend/controllers/adminController.js) (Admin workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patient["Patient experience"]
  node_webapp["Patient app routes<br/>[App.jsx]"]
  node_discovery["Doctor discovery<br/>[Doctors.jsx]"]
  node_booking["Appointment booking<br/>[Appointment.jsx]"]
  node_patientaccount["Patient account<br/>[MyProfile.jsx]"]
  node_patientappointments["Appointment management<br/>[MyAppointments.jsx]"]
  node_patientstate["Patient app state<br/>[AppContext.jsx]"]
end

subgraph group_staff["Staff consoles"]
  node_adminapp["Staff app routes<br/>[App.jsx]"]
  node_adminpages["Admin management<br/>[AddDoctor.jsx]"]
  node_doctorpages["Doctor workspace"]
  node_stafflogin["Staff authentication UI<br/>[Login.jsx]"]
  node_adminstate["Admin state<br/>[AdminContext.jsx]"]
  node_doctorstate["Doctor state<br/>[DoctorContext.jsx]"]
end

subgraph group_api["Backend API"]
  node_server["API server<br/>[server.js]"]
  node_userroute["Patient API routes<br/>[userRoute.js]"]
  node_adminroute["Admin API routes<br/>[adminRoute.js]"]
  node_doctorroute["Doctor API routes<br/>[doctorRoute.js]"]
  node_usercontroller["Patient workflows<br/>[userController.js]"]
  node_admincontroller["Admin workflows<br/>[adminController.js]"]
  node_doctorcontroller["Doctor workflows"]
end

subgraph group_data["Data and integrations"]
  node_users[("Patient records<br/>[userModel.js]")]
  node_doctors[("Doctor records<br/>[doctorModel.js]")]
  node_appointments[("Appointment records")]
  node_mongodb[("MongoDB<br/>[mongodb.js]")]
  node_cloudinary["Cloudinary media<br/>[cloudinary.js]"]
  node_razorpay["Razorpay"]
end

node_patient(("Patient"))

node_patient -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_discovery
node_webapp -->|"routes to"| node_booking
node_webapp -->|"routes to"| node_patientaccount
node_webapp -->|"routes to"| node_patientappointments
node_booking -->|"uses"| node_patientstate
node_patientappointments -->|"uses"| node_patientstate
node_patientaccount -->|"uses"| node_patientstate
node_booking -.->|"opens checkout"| node_razorpay
node_booking -.->|"requests booking and payment"| node_userroute
node_patientappointments -.->|"requests appointment actions"| node_userroute
node_patientaccount -.->|"requests account actions"| node_userroute
node_adminapp -->|"routes to"| node_adminpages
node_adminapp -->|"routes to"| node_doctorpages
node_adminapp -->|"shows when unauthenticated"| node_stafflogin
node_adminpages -->|"uses"| node_adminstate
node_doctorpages -->|"uses"| node_doctorstate
node_stafflogin -->|"uses"| node_adminstate
node_stafflogin -->|"uses"| node_doctorstate
node_adminstate -.->|"requests staff operations"| node_adminroute
node_doctorstate -.->|"requests staff operations"| node_doctorroute
node_server -->|"mounts"| node_userroute
node_server -->|"mounts"| node_adminroute
node_server -->|"mounts"| node_doctorroute
node_userroute -->|"routes to"| node_usercontroller
node_adminroute -->|"routes to"| node_admincontroller
node_doctorroute -->|"routes to"| node_doctorcontroller
node_usercontroller -->|"reads and writes"| node_users
node_usercontroller -->|"reads and updates"| node_doctors
node_usercontroller -->|"creates and updates"| node_appointments
node_admincontroller -->|"reads and writes"| node_doctors
node_admincontroller -->|"reads and updates"| node_appointments
node_admincontroller -->|"reads"| node_users
node_doctorcontroller -->|"reads and updates"| node_doctors
node_doctorcontroller -->|"reads and updates"| node_appointments
node_server -->|"connects"| node_mongodb
node_server -->|"initializes"| node_cloudinary
node_usercontroller -->|"uploads profile media"| node_cloudinary
node_admincontroller -->|"uploads doctor media"| node_cloudinary
node_usercontroller -->|"creates and verifies orders"| node_razorpay

click node_webapp "https://github.com/vishwak-tech/prescripto/blob/main/frontend/src/App.jsx"
click node_discovery "https://github.com/vishwak-tech/prescripto/blob/main/frontend/src/pages/Doctors.jsx"
click node_booking "https://github.com/vishwak-tech/prescripto/blob/main/frontend/src/pages/Appointment.jsx"
click node_patientaccount "https://github.com/vishwak-tech/prescripto/blob/main/frontend/src/pages/MyProfile.jsx"
click node_patientappointments "https://github.com/vishwak-tech/prescripto/blob/main/frontend/src/pages/MyAppointments.jsx"
click node_patientstate "https://github.com/vishwak-tech/prescripto/blob/main/frontend/src/context/AppContext.jsx"
click node_adminapp "https://github.com/vishwak-tech/prescripto/blob/main/admin/src/App.jsx"
click node_adminpages "https://github.com/vishwak-tech/prescripto/blob/main/admin/src/pages/Admin/AddDoctor.jsx"
click node_doctorpages "https://github.com/vishwak-tech/prescripto/blob/main/admin/src/pages/Doctor/DoctorDashboard.jsx"
click node_stafflogin "https://github.com/vishwak-tech/prescripto/blob/main/admin/src/pages/Login.jsx"
click node_adminstate "https://github.com/vishwak-tech/prescripto/blob/main/admin/src/context/AdminContext.jsx"
click node_doctorstate "https://github.com/vishwak-tech/prescripto/blob/main/admin/src/context/DoctorContext.jsx"
click node_server "https://github.com/vishwak-tech/prescripto/blob/main/backend/server.js"
click node_userroute "https://github.com/vishwak-tech/prescripto/blob/main/backend/routes/userRoute.js"
click node_adminroute "https://github.com/vishwak-tech/prescripto/blob/main/backend/routes/adminRoute.js"
click node_doctorroute "https://github.com/vishwak-tech/prescripto/blob/main/backend/routes/doctorRoute.js"
click node_usercontroller "https://github.com/vishwak-tech/prescripto/blob/main/backend/controllers/userController.js"
click node_admincontroller "https://github.com/vishwak-tech/prescripto/blob/main/backend/controllers/adminController.js"
click node_doctorcontroller "https://github.com/vishwak-tech/prescripto/blob/main/backend/controllers/doctorController.js"
click node_users "https://github.com/vishwak-tech/prescripto/blob/main/backend/models/userModel.js"
click node_doctors "https://github.com/vishwak-tech/prescripto/blob/main/backend/models/doctorModel.js"
click node_appointments "https://github.com/vishwak-tech/prescripto/blob/main/backend/models/appointmentModel.js"
click node_mongodb "https://github.com/vishwak-tech/prescripto/blob/main/backend/config/mongodb.js"
click node_cloudinary "https://github.com/vishwak-tech/prescripto/blob/main/backend/config/cloudinary.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_webapp,node_discovery,node_booking,node_patientaccount,node_patientappointments,node_patientstate toneBlue
class node_adminapp,node_adminpages,node_doctorpages,node_stafflogin,node_adminstate,node_doctorstate toneAmber
class node_server,node_userroute,node_adminroute,node_doctorroute,node_usercontroller,node_admincontroller,node_doctorcontroller toneMint
class node_users,node_doctors,node_appointments,node_mongodb,node_cloudinary,node_razorpay toneRose
class node_patient toneIndigo
```

## Components

### Patient experience

- [Patient app routes](https://github.com/vishwak-tech/prescripto/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Doctor discovery](https://github.com/vishwak-tech/prescripto/blob/main/frontend/src/pages/Doctors.jsx): `frontend/src/pages/Doctors.jsx`
- [Appointment booking](https://github.com/vishwak-tech/prescripto/blob/main/frontend/src/pages/Appointment.jsx): `frontend/src/pages/Appointment.jsx`
- [Patient account](https://github.com/vishwak-tech/prescripto/blob/main/frontend/src/pages/MyProfile.jsx): `frontend/src/pages/MyProfile.jsx`
- [Appointment management](https://github.com/vishwak-tech/prescripto/blob/main/frontend/src/pages/MyAppointments.jsx): `frontend/src/pages/MyAppointments.jsx`
- [Patient app state](https://github.com/vishwak-tech/prescripto/blob/main/frontend/src/context/AppContext.jsx): `frontend/src/context/AppContext.jsx`

### Staff consoles

- [Staff app routes](https://github.com/vishwak-tech/prescripto/blob/main/admin/src/App.jsx): `admin/src/App.jsx`
- [Admin management](https://github.com/vishwak-tech/prescripto/blob/main/admin/src/pages/Admin/AddDoctor.jsx): `admin/src/pages/Admin/AddDoctor.jsx`
- [Doctor workspace](https://github.com/vishwak-tech/prescripto/blob/main/admin/src/pages/Doctor/DoctorDashboard.jsx): `admin/src/pages/Doctor/DoctorDashboard.jsx`
- [Staff authentication UI](https://github.com/vishwak-tech/prescripto/blob/main/admin/src/pages/Login.jsx): `admin/src/pages/Login.jsx`
- [Admin state](https://github.com/vishwak-tech/prescripto/blob/main/admin/src/context/AdminContext.jsx): `admin/src/context/AdminContext.jsx`
- [Doctor state](https://github.com/vishwak-tech/prescripto/blob/main/admin/src/context/DoctorContext.jsx): `admin/src/context/DoctorContext.jsx`

### Backend API

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

### Data and integrations

- [Patient records](https://github.com/vishwak-tech/prescripto/blob/main/backend/models/userModel.js): `backend/models/userModel.js`
- [Doctor records](https://github.com/vishwak-tech/prescripto/blob/main/backend/models/doctorModel.js): `backend/models/doctorModel.js`
- [Appointment records](https://github.com/vishwak-tech/prescripto/blob/main/backend/models/appointmentModel.js): `backend/models/appointmentModel.js`
- [MongoDB](https://github.com/vishwak-tech/prescripto/blob/main/backend/config/mongodb.js): `backend/config/mongodb.js`
- [Cloudinary media](https://github.com/vishwak-tech/prescripto/blob/main/backend/config/cloudinary.js): `backend/config/cloudinary.js`
- **Razorpay**

### Other components

- **Patient**

## Connections

- Patient → Patient app routes: uses (evidence: `README.md`)
- 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 account: routes to (evidence: `frontend/src/App.jsx`)
- Patient app routes → Appointment management: routes to (evidence: `frontend/src/App.jsx`)
- Appointment booking → Patient app state: uses (evidence: `frontend/src/pages/Appointment.jsx`)
- Appointment management → Patient app state: uses (evidence: `frontend/src/pages/MyAppointments.jsx`)
- Patient account → Patient app state: uses (evidence: `frontend/src/pages/MyProfile.jsx`)
- Appointment booking → Razorpay: opens checkout (evidence: `README.md`)
- Appointment booking → Patient API routes: requests booking and payment (evidence: `README.md`)
- Appointment management → Patient API routes: requests appointment actions (evidence: `README.md`)
- Patient account → Patient API routes: requests account actions (evidence: `README.md`)
- Staff app routes → Admin management: routes to (evidence: `admin/src/App.jsx`)
- Staff app routes → Doctor workspace: routes to (evidence: `admin/src/App.jsx`)
- Staff app routes → Staff authentication UI: shows when unauthenticated (evidence: `admin/src/App.jsx`)
- Admin management → Admin state: uses (evidence: `admin/src/pages/Admin/AddDoctor.jsx`)
- Doctor workspace → Doctor state: uses (evidence: `admin/src/pages/Doctor/DoctorDashboard.jsx`)
- Staff authentication UI → Admin state: uses (evidence: `admin/src/pages/Login.jsx`)
- Staff authentication UI → Doctor state: uses (evidence: `admin/src/pages/Login.jsx`)
- Admin state → Admin API routes: requests staff operations
- Doctor state → Doctor API routes: requests staff operations
- API server → Patient API routes: mounts (evidence: `backend/server.js`)
- API server → Admin API routes: mounts (evidence: `backend/server.js`)
- API server → Doctor API routes: mounts (evidence: `backend/server.js`)
- Patient API routes → Patient workflows: routes to (evidence: `backend/routes/userRoute.js`)
- Admin API routes → Admin workflows: routes to (evidence: `backend/routes/adminRoute.js`)
- Doctor API routes → Doctor workflows: routes to (evidence: `backend/routes/doctorRoute.js`)
- Patient workflows → Patient records: reads and writes (evidence: `backend/controllers/userController.js`)
- Patient workflows → Doctor records: reads and updates (evidence: `backend/controllers/userController.js`)
- Patient workflows → Appointment records: creates and updates (evidence: `backend/controllers/userController.js`)
- Admin workflows → Doctor records: reads and writes (evidence: `backend/controllers/adminController.js`)
- Admin workflows → Appointment records: reads and updates (evidence: `backend/controllers/adminController.js`)
- Admin workflows → Patient records: reads (evidence: `backend/controllers/adminController.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`)
- API server → MongoDB: connects (evidence: `backend/server.js`)
- API server → Cloudinary media: initializes (evidence: `backend/server.js`)
- Patient workflows → Cloudinary media: uploads profile media (evidence: `backend/controllers/userController.js`)
- Admin workflows → Cloudinary media: uploads doctor media (evidence: `backend/controllers/adminController.js`)
- Patient workflows → Razorpay: creates and verifies orders (evidence: `backend/controllers/userController.js`)
