# rohan-bahule/doctor-appointment-booking-system architecture

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

- Interactive diagram: https://gitdiagram.com/rohan-bahule/doctor-appointment-booking-system
- Repository: https://github.com/rohan-bahule/doctor-appointment-booking-system

## Overview

DocBook is a three-role healthcare appointment platform. Patients discover doctors, book and pay for appointments, manage bookings, and review completed consultations; doctors manage availability, blocked times, appointments, profiles, and reviews; admins manage doctors and oversee appointments and refunds. React patient and staff applications call an Express API backed by MongoDB, with scheduling, payment, feedback, and reminder services supporting the workflows. Several relationships come from the README or SOURCE INDEX because their implementation files were not sampled; those evidence limits are reflected in the graph.

Main entry points: [`backend/server.js`](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/server.js) (Express API), [`backend/controllers/userController.js`](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/controllers/userController.js) (Patient workflows), [`backend/models/appointmentModel.js`](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/models/appointmentModel.js) (Appointment records), [`backend/routes/userRoute.js`](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/routes/userRoute.js) (Patient routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User applications"]
  node_patient_app["Patient app<br/>[App.jsx]"]
  node_staff_app["Doctor and admin panel<br/>[App.jsx]"]
end

subgraph group_api["API and access"]
  node_api_server["Express API<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_scheduling["Scheduling and care"]
  node_availability["Availability and slots"]
  node_blocked_slots["Blocked time management"]
  node_booking_validation["Booking validation"]
  node_feedback["Feedback and ratings<br/>[feedbackService.js]"]
end

subgraph group_payments["Payments and reminders"]
  node_payment_service["Payment and refunds<br/>[paymentService.js]"]
  node_reminders["Appointment reminders<br/>[reminderService.js]"]
  node_mailer["Email delivery<br/>[nodemailer.js]"]
end

subgraph group_persistence["MongoDB records"]
  node_doctors_store[("Doctor records<br/>[doctorModel.js]")]
  node_appointments_store[("Appointment records")]
  node_payments_store[("Payment records<br/>[paymentModel.js]")]
  node_feedback_store[("Feedback records<br/>[feedbackModel.js]")]
end

node_patients(("Patients"))
node_staff(("Doctors and admins"))
node_razorpay["Razorpay"]
node_mongodb[("MongoDB")]

node_patients -->|"use"| node_patient_app
node_staff -->|"use"| node_staff_app
node_patient_app -->|"call API"| node_api_server
node_staff_app -->|"call API"| node_api_server
node_api_server -->|"mounts"| node_user_routes
node_api_server -->|"mounts"| node_doctor_routes
node_api_server -->|"mounts"| node_admin_routes
node_user_routes -->|"dispatch"| node_user_controller
node_doctor_routes -->|"dispatch"| node_doctor_controller
node_admin_routes -->|"dispatch"| node_admin_controller
node_user_routes -->|"dispatch"| node_availability
node_doctor_routes -->|"dispatch"| node_availability
node_doctor_routes -->|"dispatch"| node_blocked_slots
node_user_routes -->|"dispatch"| node_feedback
node_doctor_routes -->|"dispatch"| node_feedback
node_user_routes -.->|"dispatch"| node_booking_validation
node_user_controller -->|"validate booking"| node_booking_validation
node_user_controller -->|"create booking"| node_appointments_store
node_user_controller -->|"update booked slots"| node_doctors_store
node_booking_validation -->|"check doctor"| node_doctors_store
node_booking_validation -->|"check conflicts"| node_appointments_store
node_booking_validation -->|"check blocks"| node_blocked_slots
node_availability -.->|"read bookings"| node_appointments_store
node_doctor_controller -->|"read appointments"| node_appointments_store
node_doctor_controller -->|"check refunds"| node_payment_service
node_admin_controller -->|"read appointments"| node_appointments_store
node_admin_controller -->|"check refunds"| node_payment_service
node_admin_controller -->|"manage doctors"| node_doctors_store
node_admin_controller -->|"send invitations"| node_mailer
node_user_controller -.->|"manage payment"| node_payments_store
node_user_controller -.->|"process payment"| node_payment_service
node_payment_service -->|"save payment"| node_payments_store
node_payment_service -->|"create orders"| node_razorpay
node_feedback -->|"store reviews"| node_feedback_store
node_feedback -->|"verify completion"| node_appointments_store
node_reminders -.->|"select appointments"| node_appointments_store
node_api_server -->|"start cron"| node_reminders
node_reminders -.->|"send reminders"| node_mailer
node_api_server -->|"connect"| node_mongodb

click node_patient_app "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/frontend/src/App.jsx"
click node_staff_app "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/admin/src/App.jsx"
click node_api_server "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/server.js"
click node_user_routes "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/routes/userRoute.js"
click node_doctor_routes "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/routes/doctorRoute.js"
click node_admin_routes "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/routes/adminRoute.js"
click node_user_controller "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/controllers/userController.js"
click node_doctor_controller "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/controllers/doctorController.js"
click node_admin_controller "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/controllers/adminController.js"
click node_availability "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/controllers/availabilityController.js"
click node_blocked_slots "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/controllers/blockedSlotController.js"
click node_booking_validation "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/services/bookingValidationService.js"
click node_feedback "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/services/feedbackService.js"
click node_payment_service "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/services/paymentService.js"
click node_reminders "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/services/reminderService.js"
click node_mailer "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/config/nodemailer.js"
click node_doctors_store "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/models/doctorModel.js"
click node_appointments_store "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/models/appointmentModel.js"
click node_payments_store "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/models/paymentModel.js"
click node_feedback_store "https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/models/feedbackModel.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_staff_app toneBlue
class node_api_server,node_user_routes,node_doctor_routes,node_admin_routes,node_user_controller,node_doctor_controller,node_admin_controller,node_mongodb toneAmber
class node_availability,node_blocked_slots,node_booking_validation,node_feedback toneMint
class node_payment_service,node_reminders,node_mailer toneRose
class node_doctors_store,node_appointments_store,node_payments_store,node_feedback_store,node_patients,node_staff,node_razorpay toneIndigo
```

## Components

### User applications

- [Patient app](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Doctor and admin panel](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/admin/src/App.jsx): `admin/src/App.jsx`

### API and access

- [Express API](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/server.js): `backend/server.js`
- [Patient routes](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/routes/userRoute.js): `backend/routes/userRoute.js`
- [Doctor routes](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/routes/doctorRoute.js): `backend/routes/doctorRoute.js`
- [Admin routes](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/routes/adminRoute.js): `backend/routes/adminRoute.js`
- [Patient workflows](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`
- [Doctor workflows](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/controllers/doctorController.js): `backend/controllers/doctorController.js`
- [Admin workflows](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/controllers/adminController.js): `backend/controllers/adminController.js`

### Scheduling and care

- [Availability and slots](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/controllers/availabilityController.js): `backend/controllers/availabilityController.js`
- [Blocked time management](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/controllers/blockedSlotController.js): `backend/controllers/blockedSlotController.js`
- [Booking validation](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/services/bookingValidationService.js): `backend/services/bookingValidationService.js`
- [Feedback and ratings](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/services/feedbackService.js): `backend/services/feedbackService.js`

### Payments and reminders

- [Payment and refunds](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/services/paymentService.js): `backend/services/paymentService.js`
- [Appointment reminders](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/services/reminderService.js): `backend/services/reminderService.js`
- [Email delivery](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/config/nodemailer.js): `backend/config/nodemailer.js`

### MongoDB records

- [Doctor records](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/models/doctorModel.js): `backend/models/doctorModel.js`
- [Appointment records](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/models/appointmentModel.js): `backend/models/appointmentModel.js`
- [Payment records](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/models/paymentModel.js): `backend/models/paymentModel.js`
- [Feedback records](https://github.com/rohan-bahule/doctor-appointment-booking-system/blob/main/backend/models/feedbackModel.js): `backend/models/feedbackModel.js`

### Other components

- **Patients**
- **Doctors and admins**
- **Razorpay**
- **MongoDB**

## Connections

- Patients → Patient app: use (evidence: `README.md`)
- Doctors and admins → Doctor and admin panel: use (evidence: `README.md`)
- Patient app → Express API: call API (evidence: `README.md`)
- Doctor and admin panel → Express API: call API (evidence: `README.md`)
- Express API → Patient routes: mounts (evidence: `backend/server.js`)
- Express API → Doctor routes: mounts (evidence: `backend/server.js`)
- Express API → Admin routes: mounts (evidence: `backend/server.js`)
- Patient routes → Patient workflows: dispatch (evidence: `backend/routes/userRoute.js`)
- Doctor routes → Doctor workflows: dispatch (evidence: `backend/routes/doctorRoute.js`)
- Admin routes → Admin workflows: dispatch
- Patient routes → Availability and slots: dispatch (evidence: `backend/routes/userRoute.js`)
- Doctor routes → Availability and slots: dispatch (evidence: `backend/routes/doctorRoute.js`)
- Doctor routes → Blocked time management: dispatch (evidence: `backend/routes/doctorRoute.js`)
- Patient routes → Feedback and ratings: dispatch (evidence: `backend/routes/userRoute.js`)
- Doctor routes → Feedback and ratings: dispatch (evidence: `backend/routes/doctorRoute.js`)
- Patient routes → Booking validation: dispatch
- Patient workflows → Booking validation: validate booking (evidence: `backend/controllers/userController.js`)
- Patient workflows → Appointment records: create booking (evidence: `backend/controllers/userController.js`)
- Patient workflows → Doctor records: update booked slots (evidence: `backend/controllers/userController.js`)
- Booking validation → Doctor records: check doctor (evidence: `backend/services/bookingValidationService.js`)
- Booking validation → Appointment records: check conflicts (evidence: `backend/services/bookingValidationService.js`)
- Booking validation → Blocked time management: check blocks (evidence: `backend/services/bookingValidationService.js`)
- Availability and slots → Appointment records: read bookings
- Doctor workflows → Appointment records: read appointments (evidence: `backend/controllers/doctorController.js`)
- Doctor workflows → Payment and refunds: check refunds (evidence: `backend/controllers/doctorController.js`)
- Admin workflows → Appointment records: read appointments (evidence: `backend/controllers/adminController.js`)
- Admin workflows → Payment and refunds: check refunds (evidence: `backend/controllers/adminController.js`)
- Admin workflows → Doctor records: manage doctors (evidence: `backend/controllers/adminController.js`)
- Admin workflows → Email delivery: send invitations (evidence: `backend/controllers/adminController.js`)
- Patient workflows → Payment records: manage payment (evidence: `backend/controllers/userController.js`)
- Patient workflows → Payment and refunds: process payment (evidence: `backend/controllers/userController.js`)
- Payment and refunds → Payment records: save payment (evidence: `backend/services/paymentService.js`)
- Payment and refunds → Razorpay: create orders (evidence: `backend/services/paymentService.js`)
- Feedback and ratings → Feedback records: store reviews (evidence: `backend/services/feedbackService.js`)
- Feedback and ratings → Appointment records: verify completion (evidence: `backend/services/feedbackService.js`)
- Appointment reminders → Appointment records: select appointments
- Express API → Appointment reminders: start cron (evidence: `backend/server.js`)
- Appointment reminders → Email delivery: send reminders
- Express API → MongoDB: connect (evidence: `backend/server.js`)
