# gantasrinivasarao96/doctor-appointment-booking-system architecture

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

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

## Overview

Doctor Appointment Booking System is a role-based MERN application for patients, doctors, and administrators. Patients register, discover doctors, select generated availability, and book appointments; doctors manage availability and appointment status; administrators review doctor applications. The client routes role-specific pages and sends authenticated requests to the Express API, whose controllers apply workflow logic and persist records. Major README capabilities such as notifications and private medical-document access are represented. Some subsystem links rely on the README or SOURCE INDEX because their implementation excerpts were not provided.

Main entry points: [`client/src/App.jsx`](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/App.jsx) (Route application), [`client/src/services/api.js`](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/services/api.js) (API client), [`server/app.js`](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/app.js) (Express API), [`server/controllers/appointmentController.js`](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/controllers/appointmentController.js) (Slot booking and management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client application"]
  node_app["Route application<br/>[App.jsx]"]
  node_api["API client<br/>[api.js]"]
  node_patientui["Patient booking pages"]
  node_historyui["Appointment history<br/>[MyAppointments.jsx]"]
  node_applyui["Doctor application<br/>[ApplyDoctor.jsx]"]
  node_doctorui["Doctor dashboard"]
  node_adminui["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_notifyui["Notification state"]
  node_server["Express API<br/>[app.js]"]
end

subgraph group_identity["Identity and access"]
  node_authui["Session state<br/>[AuthContext.jsx]"]
  node_authroutes["Authentication routes<br/>[authRoutes.js]"]
  node_authlogic["Authentication logic<br/>[authController.js]"]
  node_authmw["Token authentication<br/>[authMiddleware.js]"]
end

subgraph group_care["Doctor and appointments"]
  node_doctorroutes["Doctor routes<br/>[doctorRoutes.js]"]
  node_doctorlogic["Doctor profiles and availability"]
  node_approutes["Appointment routes"]
  node_applogic["Slot booking and management"]
  node_upload["Medical document upload"]
end

subgraph group_oversight["Administration and notifications"]
  node_adminroutes["Admin routes<br/>[adminRoutes.js]"]
  node_adminlogic["Application decisions<br/>[adminController.js]"]
  node_notifroutes["Notification routes"]
  node_notiflogic["Notification handling"]
end

subgraph group_persistence["Persistence and files"]
  node_doctorstore[("Doctor records<br/>[Doctor.js]")]
  node_appstore[("Appointment records<br/>[Appointment.js]")]
  node_notifstore[("Notification records<br/>[Notification.js]")]
  node_userstore[("User records<br/>[User.js]")]
end

node_visitor(("Patient / doctor / admin"))
node_mongo[("MongoDB")]
node_files[("Private document files")]

node_visitor -->|"uses"| node_app
node_app -->|"provides session"| node_authui
node_app -->|"routes to"| node_patientui
node_app -->|"routes to"| node_historyui
node_app -->|"routes to"| node_applyui
node_app -->|"routes to"| node_doctorui
node_app -->|"routes to"| node_adminui
node_authui -->|"validates session"| node_api
node_patientui -->|"requests data"| node_api
node_historyui -->|"requests history"| node_api
node_applyui -->|"submits application"| node_api
node_doctorui -->|"manages appointments"| node_api
node_adminui -->|"reviews applications"| node_api
node_api -->|"calls API"| node_server
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_doctorroutes
node_server -->|"mounts routes"| node_approutes
node_server -->|"mounts routes"| node_adminroutes
node_server -->|"mounts routes"| node_notifroutes
node_authroutes -->|"dispatches to"| node_authlogic
node_authroutes -->|"authenticates"| node_authmw
node_authmw -->|"loads user"| node_userstore
node_authlogic -->|"reads and writes"| node_userstore
node_doctorroutes -->|"dispatches to"| node_doctorlogic
node_doctorlogic -->|"reads and writes"| node_doctorstore
node_doctorlogic -->|"looks up admins"| node_userstore
node_doctorlogic -->|"creates alerts"| node_notifstore
node_approutes -->|"dispatches to"| node_applogic
node_approutes -->|"authenticates"| node_authmw
node_approutes -->|"accepts document"| node_upload
node_applogic -->|"checks availability"| node_doctorstore
node_applogic -->|"books and updates"| node_appstore
node_applogic -->|"creates alerts"| node_notifstore
node_upload -->|"stores upload"| node_files
node_applogic -->|"serves documents"| node_files
node_adminroutes -->|"dispatches to"| node_adminlogic
node_adminlogic -->|"decides applications"| node_doctorstore
node_adminlogic -->|"updates access"| node_userstore
node_adminlogic -->|"sends decisions"| node_notifstore
node_notifroutes -->|"dispatches to"| node_notiflogic
node_notiflogic -->|"reads and updates"| node_notifstore
node_doctorstore -->|"persists"| node_mongo
node_appstore -->|"persists"| node_mongo
node_userstore -->|"persists"| node_mongo
node_notifstore -->|"persists"| node_mongo

click node_app "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/App.jsx"
click node_authui "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/context/AuthContext.jsx"
click node_api "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/services/api.js"
click node_patientui "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/pages/BookAppointment.jsx"
click node_historyui "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/pages/MyAppointments.jsx"
click node_applyui "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/pages/ApplyDoctor.jsx"
click node_doctorui "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/dashboard/DoctorDashboard.jsx"
click node_adminui "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/dashboard/AdminDashboard.jsx"
click node_notifyui "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/context/NotificationContext.jsx"
click node_server "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/app.js"
click node_authroutes "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/routes/authRoutes.js"
click node_authlogic "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/controllers/authController.js"
click node_authmw "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/middleware/authMiddleware.js"
click node_doctorroutes "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/routes/doctorRoutes.js"
click node_doctorlogic "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/controllers/doctorController.js"
click node_doctorstore "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/models/Doctor.js"
click node_approutes "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/routes/appointmentRoutes.js"
click node_applogic "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/controllers/appointmentController.js"
click node_appstore "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/models/Appointment.js"
click node_upload "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/middleware/medicalDocumentUpload.js"
click node_adminroutes "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/routes/adminRoutes.js"
click node_adminlogic "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/controllers/adminController.js"
click node_notifroutes "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/routes/notificationRoutes.js"
click node_notiflogic "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/controllers/notificationController.js"
click node_notifstore "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/models/Notification.js"
click node_userstore "https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/models/User.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_api,node_patientui,node_historyui,node_applyui,node_doctorui,node_adminui,node_notifyui,node_server toneBlue
class node_authui,node_authroutes,node_authlogic,node_authmw,node_mongo,node_files toneAmber
class node_doctorroutes,node_doctorlogic,node_approutes,node_applogic,node_upload toneMint
class node_adminroutes,node_adminlogic,node_notifroutes,node_notiflogic toneRose
class node_doctorstore,node_appstore,node_notifstore,node_userstore,node_visitor toneIndigo
```

## Components

### Client application

- [Route application](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [API client](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/services/api.js): `client/src/services/api.js`
- [Patient booking pages](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/pages/BookAppointment.jsx): `client/src/pages/BookAppointment.jsx`
- [Appointment history](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/pages/MyAppointments.jsx): `client/src/pages/MyAppointments.jsx`
- [Doctor application](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/pages/ApplyDoctor.jsx): `client/src/pages/ApplyDoctor.jsx`
- [Doctor dashboard](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/dashboard/DoctorDashboard.jsx): `client/src/dashboard/DoctorDashboard.jsx`
- [Admin dashboard](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/dashboard/AdminDashboard.jsx): `client/src/dashboard/AdminDashboard.jsx`
- [Notification state](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/context/NotificationContext.jsx): `client/src/context/NotificationContext.jsx`
- [Express API](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/app.js): `server/app.js`

### Identity and access

- [Session state](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Authentication routes](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [Authentication logic](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [Token authentication](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`

### Doctor and appointments

- [Doctor routes](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/routes/doctorRoutes.js): `server/routes/doctorRoutes.js`
- [Doctor profiles and availability](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/controllers/doctorController.js): `server/controllers/doctorController.js`
- [Appointment routes](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/routes/appointmentRoutes.js): `server/routes/appointmentRoutes.js`
- [Slot booking and management](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/controllers/appointmentController.js): `server/controllers/appointmentController.js`
- [Medical document upload](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/middleware/medicalDocumentUpload.js): `server/middleware/medicalDocumentUpload.js`

### Administration and notifications

- [Admin routes](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/routes/adminRoutes.js): `server/routes/adminRoutes.js`
- [Application decisions](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/controllers/adminController.js): `server/controllers/adminController.js`
- [Notification routes](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/routes/notificationRoutes.js): `server/routes/notificationRoutes.js`
- [Notification handling](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/controllers/notificationController.js): `server/controllers/notificationController.js`

### Persistence and files

- [Doctor records](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/models/Doctor.js): `server/models/Doctor.js`
- [Appointment records](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/models/Appointment.js): `server/models/Appointment.js`
- [Notification records](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/models/Notification.js): `server/models/Notification.js`
- [User records](https://github.com/gantasrinivasarao96/doctor-appointment-booking-system/blob/main/server/models/User.js): `server/models/User.js`

### Other components

- **Patient / doctor / admin**
- **MongoDB**
- **Private document files**

## Connections

- Patient / doctor / admin → Route application: uses (evidence: `README.md`)
- Route application → Session state: provides session (evidence: `client/src/App.jsx`)
- Route application → Patient booking pages: routes to (evidence: `client/src/App.jsx`)
- Route application → Appointment history: routes to (evidence: `client/src/App.jsx`)
- Route application → Doctor application: routes to (evidence: `client/src/App.jsx`)
- Route application → Doctor dashboard: routes to (evidence: `client/src/App.jsx`)
- Route application → Admin dashboard: routes to (evidence: `client/src/App.jsx`)
- Session state → API client: validates session (evidence: `client/src/context/AuthContext.jsx`)
- Patient booking pages → API client: requests data (evidence: `client/src/pages/BookAppointment.jsx`)
- Appointment history → API client: requests history (evidence: `client/src/pages/MyAppointments.jsx`)
- Doctor application → API client: submits application (evidence: `client/src/pages/ApplyDoctor.jsx`)
- Doctor dashboard → API client: manages appointments (evidence: `client/src/dashboard/DoctorDashboard.jsx`)
- Admin dashboard → API client: reviews applications (evidence: `client/src/dashboard/AdminDashboard.jsx`)
- API client → Express API: calls API (evidence: `README.md`)
- Express API → Authentication routes: mounts routes (evidence: `server/app.js`)
- Express API → Doctor routes: mounts routes (evidence: `server/app.js`)
- Express API → Appointment routes: mounts routes (evidence: `server/app.js`)
- Express API → Admin routes: mounts routes (evidence: `server/app.js`)
- Express API → Notification routes: mounts routes (evidence: `server/app.js`)
- Authentication routes → Authentication logic: dispatches to (evidence: `server/routes/authRoutes.js`)
- Authentication routes → Token authentication: authenticates (evidence: `server/routes/authRoutes.js`)
- Token authentication → User records: loads user (evidence: `server/middleware/authMiddleware.js`)
- Authentication logic → User records: reads and writes (evidence: `server/controllers/authController.js`)
- Doctor routes → Doctor profiles and availability: dispatches to (evidence: `server/routes/doctorRoutes.js`)
- Doctor profiles and availability → Doctor records: reads and writes (evidence: `server/controllers/doctorController.js`)
- Doctor profiles and availability → User records: looks up admins (evidence: `server/controllers/doctorController.js`)
- Doctor profiles and availability → Notification records: creates alerts (evidence: `server/controllers/doctorController.js`)
- Appointment routes → Slot booking and management: dispatches to (evidence: `server/routes/appointmentRoutes.js`)
- Appointment routes → Token authentication: authenticates (evidence: `server/routes/appointmentRoutes.js`)
- Appointment routes → Medical document upload: accepts document (evidence: `server/routes/appointmentRoutes.js`)
- Slot booking and management → Doctor records: checks availability (evidence: `server/controllers/appointmentController.js`)
- Slot booking and management → Appointment records: books and updates (evidence: `server/controllers/appointmentController.js`)
- Slot booking and management → Notification records: creates alerts (evidence: `server/controllers/appointmentController.js`)
- Medical document upload → Private document files: stores upload (evidence: `README.md`)
- Slot booking and management → Private document files: serves documents (evidence: `README.md`)
- Admin routes → Application decisions: dispatches to (evidence: `server/routes/adminRoutes.js`)
- Application decisions → Doctor records: decides applications (evidence: `server/controllers/adminController.js`)
- Application decisions → User records: updates access (evidence: `server/controllers/adminController.js`)
- Application decisions → Notification records: sends decisions (evidence: `server/controllers/adminController.js`)
- Notification routes → Notification handling: dispatches to (evidence: `server/routes/notificationRoutes.js`)
- Notification handling → Notification records: reads and updates (evidence: `server/controllers/notificationController.js`)
- Doctor records → MongoDB: persists (evidence: `README.md`)
- Appointment records → MongoDB: persists (evidence: `README.md`)
- User records → MongoDB: persists (evidence: `README.md`)
- Notification records → MongoDB: persists (evidence: `README.md`)
