# akash-annavarapu/doctor-appointment-booking-system architecture

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

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

## Overview

The repository contains two distinct products: a MERN doctor-appointment system and a separately runnable TestPilot Lab for generating and reviewing tests against an allowlisted healthcare app. The graph keeps their workflows separate, while showing the healthcare app’s role-based booking stages and the Lab’s inspection, generation, review, and reporting capabilities. Some Lab subsystems are documented or named but not sampled; their links are omitted where the available evidence does not establish a call.

Main entry points: [`client/src/App.jsx`](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/client/src/App.jsx) (Healthcare UI routes), [`testpilot-lab/server.js`](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/testpilot-lab/server.js) (Lab API workflow), [`server/app.js`](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/app.js) (HTTP route dispatch), [`server/controllers/appointmentController.js`](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/controllers/appointmentController.js) (Scheduling logic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_health_ui["Healthcare experience"]
  node_health_app["Healthcare UI routes<br/>[App.jsx]"]
  node_auth_context["Session context<br/>[AuthContext.jsx]"]
  node_booking_ui["Appointment booking"]
  node_doctor_dashboard["Doctor dashboard"]
  node_user_dashboard["Patient dashboard<br/>[UserDashboard.jsx]"]
  node_admin_dashboard["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_doctor_discovery["Doctor discovery"]
end

subgraph group_health_api["Healthcare services"]
  node_api_routes["HTTP route dispatch<br/>[app.js]"]
  node_auth_routes["Authentication routes<br/>[authRoutes.js]"]
  node_appointment_routes["Appointment routes"]
  node_doctor_routes["Doctor routes<br/>[doctorRoutes.js]"]
  node_appointment_logic["Scheduling logic"]
  node_doctor_logic["Doctor applications"]
  node_auth_guard["JWT user lookup<br/>[authMiddleware.js]"]
end

subgraph group_health_data["Healthcare data"]
  node_user_store[("User records<br/>[User.js]")]
  node_doctor_store[("Doctor records<br/>[Doctor.js]")]
  node_appointment_store[("Appointment records<br/>[Appointment.js]")]
  node_notification_store[("Notifications<br/>[Notification.js]")]
end

subgraph group_lab["TestPilot Lab"]
  node_lab_ui["Lab web interface<br/>[app.js]"]
  node_lab_server["Lab API workflow<br/>[server.js]"]
  node_probe_checks["Read-only checks<br/>[verifiedChecks.js]"]
  node_case_runner["Generated case execution"]
  node_review_sessions["Human review<br/>[reviewSession.js]"]
end

subgraph group_reports["Test reporting"]
  node_report_routes["Report ingestion and feed<br/>[reportRoutes.js]"]
  node_report_store[("Test run records<br/>[TestRun.js]")]
  node_report_logic["Report validation"]
end

node_patient(("Patient"))
node_doctor_actor(("Doctor"))
node_admin_actor(("Administrator"))
node_lab_user(("Test designer"))
node_health_target["Healthcare app URL"]
node_ai_provider{{"Gemini / OpenAI"}}

node_patient -->|"uses"| node_health_app
node_doctor_actor -->|"uses"| node_health_app
node_admin_actor -->|"uses"| node_health_app
node_health_app -->|"provides session"| node_auth_context
node_health_app -->|"routes to"| node_booking_ui
node_health_app -->|"routes to"| node_doctor_dashboard
node_health_app -->|"routes to"| node_user_dashboard
node_health_app -->|"routes to"| node_admin_dashboard
node_patient -->|"browses"| node_doctor_discovery
node_booking_ui -->|"requests booking"| node_appointment_routes
node_doctor_dashboard -->|"manages appointments"| node_appointment_routes
node_admin_dashboard -->|"uses admin services"| node_api_routes
node_api_routes -->|"mounts"| node_auth_routes
node_api_routes -->|"mounts"| node_appointment_routes
node_api_routes -->|"mounts"| node_doctor_routes
node_appointment_routes -->|"authenticates"| node_auth_guard
node_appointment_routes -->|"dispatches to"| node_appointment_logic
node_doctor_routes -->|"dispatches to"| node_doctor_logic
node_doctor_routes -->|"dispatches slots"| node_appointment_logic
node_auth_guard -->|"loads user"| node_user_store
node_doctor_logic -->|"reads and writes"| node_doctor_store
node_doctor_logic -->|"reads"| node_user_store
node_doctor_logic -->|"creates notices"| node_notification_store
node_appointment_logic -->|"reads and writes"| node_appointment_store
node_appointment_logic -->|"reads"| node_doctor_store
node_appointment_logic -->|"uses notices"| node_notification_store
node_lab_user -->|"submits story"| node_lab_ui
node_lab_ui -->|"calls API"| node_lab_server
node_lab_server -->|"inspects public data"| node_health_target
node_lab_server -->|"runs checks"| node_probe_checks
node_lab_server -->|"executes approved cases"| node_case_runner
node_lab_server -->|"handles review"| node_review_sessions
node_lab_server -.->|"requests generation"| node_ai_provider
node_api_routes -->|"mounts reports"| node_report_routes
node_report_routes -->|"validates payload"| node_report_logic
node_report_routes -->|"stores and reads"| node_report_store

click node_health_app "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/client/src/App.jsx"
click node_auth_context "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/client/src/context/AuthContext.jsx"
click node_booking_ui "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/client/src/pages/BookAppointment.jsx"
click node_doctor_dashboard "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/client/src/dashboard/DoctorDashboard.jsx"
click node_user_dashboard "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/client/src/dashboard/UserDashboard.jsx"
click node_admin_dashboard "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/client/src/dashboard/AdminDashboard.jsx"
click node_doctor_discovery "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/client/src/components/FeaturedDoctors.jsx"
click node_api_routes "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/app.js"
click node_auth_routes "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/routes/authRoutes.js"
click node_appointment_routes "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/routes/appointmentRoutes.js"
click node_doctor_routes "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/routes/doctorRoutes.js"
click node_appointment_logic "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/controllers/appointmentController.js"
click node_doctor_logic "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/controllers/doctorController.js"
click node_auth_guard "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/middleware/authMiddleware.js"
click node_user_store "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/models/User.js"
click node_doctor_store "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/models/Doctor.js"
click node_appointment_store "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/models/Appointment.js"
click node_notification_store "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/models/Notification.js"
click node_lab_ui "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/testpilot-lab/public/app.js"
click node_lab_server "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/testpilot-lab/server.js"
click node_probe_checks "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/testpilot-lab/verifiedChecks.js"
click node_case_runner "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/testpilot-lab/generatedCaseRunner.js"
click node_review_sessions "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/testpilot-lab/reviewSession.js"
click node_report_routes "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/routes/reportRoutes.js"
click node_report_store "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/models/TestRun.js"
click node_report_logic "https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/services/testRunReporting.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_health_app,node_auth_context,node_booking_ui,node_doctor_dashboard,node_user_dashboard,node_admin_dashboard,node_doctor_discovery toneBlue
class node_api_routes,node_auth_routes,node_appointment_routes,node_doctor_routes,node_appointment_logic,node_doctor_logic,node_auth_guard toneAmber
class node_user_store,node_doctor_store,node_appointment_store,node_notification_store toneMint
class node_lab_ui,node_lab_server,node_probe_checks,node_case_runner,node_review_sessions toneRose
class node_report_routes,node_report_store,node_report_logic,node_patient,node_doctor_actor,node_admin_actor,node_lab_user,node_health_target,node_ai_provider toneIndigo
```

## Components

### Healthcare experience

- [Healthcare UI routes](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Session context](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Appointment booking](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/client/src/pages/BookAppointment.jsx): `client/src/pages/BookAppointment.jsx`
- [Doctor dashboard](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/client/src/dashboard/DoctorDashboard.jsx): `client/src/dashboard/DoctorDashboard.jsx`
- [Patient dashboard](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/client/src/dashboard/UserDashboard.jsx): `client/src/dashboard/UserDashboard.jsx`
- [Admin dashboard](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/client/src/dashboard/AdminDashboard.jsx): `client/src/dashboard/AdminDashboard.jsx`
- [Doctor discovery](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/client/src/components/FeaturedDoctors.jsx): `client/src/components/FeaturedDoctors.jsx`

### Healthcare services

- [HTTP route dispatch](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/app.js): `server/app.js`
- [Authentication routes](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [Appointment routes](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/routes/appointmentRoutes.js): `server/routes/appointmentRoutes.js`
- [Doctor routes](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/routes/doctorRoutes.js): `server/routes/doctorRoutes.js`
- [Scheduling logic](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/controllers/appointmentController.js): `server/controllers/appointmentController.js`
- [Doctor applications](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/controllers/doctorController.js): `server/controllers/doctorController.js`
- [JWT user lookup](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`

### Healthcare data

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

### TestPilot Lab

- [Lab web interface](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/testpilot-lab/public/app.js): `testpilot-lab/public/app.js`
- [Lab API workflow](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/testpilot-lab/server.js): `testpilot-lab/server.js`
- [Read-only checks](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/testpilot-lab/verifiedChecks.js): `testpilot-lab/verifiedChecks.js`
- [Generated case execution](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/testpilot-lab/generatedCaseRunner.js): `testpilot-lab/generatedCaseRunner.js`
- [Human review](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/testpilot-lab/reviewSession.js): `testpilot-lab/reviewSession.js`

### Test reporting

- [Report ingestion and feed](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/routes/reportRoutes.js): `server/routes/reportRoutes.js`
- [Test run records](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/models/TestRun.js): `server/models/TestRun.js`
- [Report validation](https://github.com/akash-annavarapu/doctor-appointment-booking-system/blob/main/server/services/testRunReporting.js): `server/services/testRunReporting.js`

### Other components

- **Patient**
- **Doctor**
- **Administrator**
- **Test designer**
- **Healthcare app URL**
- **Gemini / OpenAI**

## Connections

- Patient → Healthcare UI routes: uses (evidence: `README.md`)
- Doctor → Healthcare UI routes: uses (evidence: `README.md`)
- Administrator → Healthcare UI routes: uses (evidence: `README.md`)
- Healthcare UI routes → Session context: provides session (evidence: `client/src/App.jsx`)
- Healthcare UI routes → Appointment booking: routes to (evidence: `client/src/App.jsx`)
- Healthcare UI routes → Doctor dashboard: routes to (evidence: `client/src/App.jsx`)
- Healthcare UI routes → Patient dashboard: routes to (evidence: `client/src/App.jsx`)
- Healthcare UI routes → Admin dashboard: routes to (evidence: `client/src/App.jsx`)
- Patient → Doctor discovery: browses (evidence: `README.md`)
- Appointment booking → Appointment routes: requests booking (evidence: `README.md`)
- Doctor dashboard → Appointment routes: manages appointments (evidence: `README.md`)
- Admin dashboard → HTTP route dispatch: uses admin services (evidence: `README.md`)
- HTTP route dispatch → Authentication routes: mounts (evidence: `server/app.js`)
- HTTP route dispatch → Appointment routes: mounts (evidence: `server/app.js`)
- HTTP route dispatch → Doctor routes: mounts (evidence: `server/app.js`)
- Appointment routes → JWT user lookup: authenticates (evidence: `server/routes/appointmentRoutes.js`)
- Appointment routes → Scheduling logic: dispatches to (evidence: `server/routes/appointmentRoutes.js`)
- Doctor routes → Doctor applications: dispatches to (evidence: `server/routes/doctorRoutes.js`)
- Doctor routes → Scheduling logic: dispatches slots (evidence: `server/routes/doctorRoutes.js`)
- JWT user lookup → User records: loads user (evidence: `server/middleware/authMiddleware.js`)
- Doctor applications → Doctor records: reads and writes (evidence: `server/controllers/doctorController.js`)
- Doctor applications → User records: reads (evidence: `server/controllers/doctorController.js`)
- Doctor applications → Notifications: creates notices (evidence: `server/controllers/doctorController.js`)
- Scheduling logic → Appointment records: reads and writes (evidence: `server/controllers/appointmentController.js`)
- Scheduling logic → Doctor records: reads (evidence: `server/controllers/appointmentController.js`)
- Scheduling logic → Notifications: uses notices (evidence: `server/controllers/appointmentController.js`)
- Test designer → Lab web interface: submits story (evidence: `README.md`)
- Lab web interface → Lab API workflow: calls API (evidence: `README.md`)
- Lab API workflow → Healthcare app URL: inspects public data (evidence: `testpilot-lab/server.js`)
- Lab API workflow → Read-only checks: runs checks (evidence: `testpilot-lab/server.js`)
- Lab API workflow → Generated case execution: executes approved cases (evidence: `testpilot-lab/server.js`)
- Lab API workflow → Human review: handles review (evidence: `testpilot-lab/server.js`)
- Lab API workflow → Gemini / OpenAI: requests generation
- HTTP route dispatch → Report ingestion and feed: mounts reports (evidence: `server/app.js`)
- Report ingestion and feed → Report validation: validates payload (evidence: `server/routes/reportRoutes.js`)
- Report ingestion and feed → Test run records: stores and reads (evidence: `server/routes/reportRoutes.js`)
