# ahsansabeeh910/cloud-based-medical-appointment-system architecture

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

- Interactive diagram: https://gitdiagram.com/ahsansabeeh910/cloud-based-medical-appointment-system
- Repository: https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system

## Overview

MediConnect is a patient/doctor appointment and prescription system. Patients find doctors, check availability, book appointments, and manage records; doctors manage appointments and issue prescriptions; administrators oversee users and system activity. The React client calls an Express API, whose controllers enforce domain operations against MongoDB and use S3 for prescription files. The graph preserves these major documented capabilities; unsampled components and deployment details are represented only where the README or source index supports them.

Main entry points: [`client/src/services/api.js`](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/services/api.js) (API client), [`server/server.js`](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/server.js) (Express API), [`server/models/Appointment.js`](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/models/Appointment.js) (Appointment records), [`server/controllers/adminController.js`](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/controllers/adminController.js) (Administration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web_app["App routing<br/>[App.jsx]"]
  node_auth_state["Auth state<br/>[AuthContext.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_doctor_search["Doctor search<br/>[DoctorSearch.jsx]"]
  node_booking_ui["Appointment booking"]
  node_patient_views["Patient records"]
  node_doctor_views["Doctor portal"]
  node_history_ui["Appointment history"]
  node_profile_ui["Profile management<br/>[Profile.jsx]"]
  node_reports_ui["Doctor reports<br/>[Reports.jsx]"]
  node_admin_ui["Admin dashboard<br/>[AdminDashboard.jsx]"]
end

subgraph group_api["API and access"]
  node_express_app["Express API<br/>[server.js]"]
  node_auth_routes["Authentication routes<br/>[authRoutes.js]"]
  node_doctor_routes["Doctor routes<br/>[doctorRoutes.js]"]
  node_appointment_routes["Appointment routes"]
  node_prescription_routes["Prescription routes"]
  node_admin_routes["Admin routes<br/>[adminRoutes.js]"]
  node_auth_controller["Authentication<br/>[authController.js]"]
  node_admin_controller["Administration<br/>[adminController.js]"]
  node_auth_middleware["JWT and roles<br/>[authMiddleware.js]"]
end

subgraph group_care["Care workflows"]
  node_doctor_controller["Doctor discovery and slots"]
  node_appointment_controller["Appointment lifecycle"]
  node_prescription_controller["Prescription services"]
end

subgraph group_storage["Persistence and files"]
  node_user_model[("User records<br/>[User.js]")]
  node_doctor_model[("Doctor records<br/>[Doctor.js]")]
  node_appointment_model[("Appointment records<br/>[Appointment.js]")]
  node_prescription_model[("Prescription records<br/>[Prescription.js]")]
  node_s3[("Amazon S3<br/>[s3.js]")]
  node_mongodb[("MongoDB")]
end

node_patient(("Patient"))
node_doctor_actor(("Doctor"))

node_patient -->|"uses"| node_web_app
node_doctor_actor -->|"uses"| node_web_app
node_web_app -->|"provides"| node_auth_state
node_auth_state -->|"authenticates through"| node_api_client
node_doctor_search -->|"requests doctors"| node_api_client
node_booking_ui -->|"books and checks slots"| node_api_client
node_patient_views -->|"loads records"| node_api_client
node_doctor_views -->|"manages appointments"| node_api_client
node_history_ui -->|"loads history and prescriptions"| node_api_client
node_profile_ui -->|"updates profile"| node_api_client
node_reports_ui -->|"requests reports"| node_api_client
node_admin_ui -->|"requests administration"| node_api_client
node_api_client -->|"calls API"| node_express_app
node_express_app -->|"mounts"| node_auth_routes
node_express_app -->|"mounts"| node_doctor_routes
node_express_app -->|"mounts"| node_appointment_routes
node_express_app -->|"mounts"| node_prescription_routes
node_express_app -->|"mounts"| node_admin_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_doctor_routes -->|"dispatches"| node_doctor_controller
node_appointment_routes -->|"dispatches"| node_appointment_controller
node_prescription_routes -->|"dispatches"| node_prescription_controller
node_admin_routes -->|"dispatches"| node_admin_controller
node_appointment_routes -->|"protects"| node_auth_middleware
node_prescription_routes -->|"protects"| node_auth_middleware
node_auth_middleware -->|"loads user"| node_user_model
node_auth_controller -->|"authenticates users"| node_user_model
node_doctor_controller -->|"queries doctors"| node_doctor_model
node_doctor_controller -->|"checks booked slots"| node_appointment_model
node_appointment_controller -->|"manages appointments"| node_appointment_model
node_appointment_controller -->|"checks doctor"| node_doctor_model
node_prescription_controller -->|"reads appointment"| node_appointment_model
node_prescription_controller -->|"creates and reads"| node_prescription_model
node_prescription_controller -->|"uploads and signs URLs"| node_s3
node_admin_controller -->|"manages users"| node_user_model
node_admin_controller -->|"queries doctors"| node_doctor_model
node_admin_controller -->|"queries appointments"| node_appointment_model
node_user_model -.->|"persists"| node_mongodb
node_doctor_model -.->|"persists"| node_mongodb
node_appointment_model -.->|"persists"| node_mongodb
node_prescription_model -.->|"persists"| node_mongodb

click node_web_app "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/App.jsx"
click node_auth_state "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/context/AuthContext.jsx"
click node_api_client "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/services/api.js"
click node_doctor_search "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/DoctorSearch.jsx"
click node_booking_ui "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/BookAppointment.jsx"
click node_patient_views "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/PatientDashboard.jsx"
click node_doctor_views "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/DoctorDashboard.jsx"
click node_history_ui "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/AppointmentHistory.jsx"
click node_profile_ui "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/Profile.jsx"
click node_reports_ui "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/Reports.jsx"
click node_admin_ui "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/AdminDashboard.jsx"
click node_express_app "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/server.js"
click node_auth_routes "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/routes/authRoutes.js"
click node_doctor_routes "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/routes/doctorRoutes.js"
click node_appointment_routes "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/routes/appointmentRoutes.js"
click node_prescription_routes "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/routes/prescriptionRoutes.js"
click node_admin_routes "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/routes/adminRoutes.js"
click node_auth_controller "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/controllers/authController.js"
click node_doctor_controller "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/controllers/doctorController.js"
click node_appointment_controller "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/controllers/appointmentController.js"
click node_prescription_controller "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/controllers/prescriptionController.js"
click node_admin_controller "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/controllers/adminController.js"
click node_auth_middleware "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/middleware/authMiddleware.js"
click node_user_model "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/models/User.js"
click node_doctor_model "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/models/Doctor.js"
click node_appointment_model "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/models/Appointment.js"
click node_prescription_model "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/models/Prescription.js"
click node_s3 "https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/utils/s3.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_web_app,node_auth_state,node_api_client,node_doctor_search,node_booking_ui,node_patient_views,node_doctor_views,node_history_ui,node_profile_ui,node_reports_ui,node_admin_ui toneBlue
class node_express_app,node_auth_routes,node_doctor_routes,node_appointment_routes,node_prescription_routes,node_admin_routes,node_auth_controller,node_admin_controller,node_auth_middleware toneAmber
class node_doctor_controller,node_appointment_controller,node_prescription_controller toneMint
class node_user_model,node_doctor_model,node_appointment_model,node_prescription_model,node_s3,node_mongodb toneRose
class node_patient,node_doctor_actor toneIndigo
```

## Components

### Web client

- [App routing](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Auth state](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [API client](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/services/api.js): `client/src/services/api.js`
- [Doctor search](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/DoctorSearch.jsx): `client/src/pages/DoctorSearch.jsx`
- [Appointment booking](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/BookAppointment.jsx): `client/src/pages/BookAppointment.jsx`
- [Patient records](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/PatientDashboard.jsx): `client/src/pages/PatientDashboard.jsx`
- [Doctor portal](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/DoctorDashboard.jsx): `client/src/pages/DoctorDashboard.jsx`
- [Appointment history](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/AppointmentHistory.jsx): `client/src/pages/AppointmentHistory.jsx`
- [Profile management](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/Profile.jsx): `client/src/pages/Profile.jsx`
- [Doctor reports](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/Reports.jsx): `client/src/pages/Reports.jsx`
- [Admin dashboard](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/client/src/pages/AdminDashboard.jsx): `client/src/pages/AdminDashboard.jsx`

### API and access

- [Express API](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/server.js): `server/server.js`
- [Authentication routes](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [Doctor routes](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/routes/doctorRoutes.js): `server/routes/doctorRoutes.js`
- [Appointment routes](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/routes/appointmentRoutes.js): `server/routes/appointmentRoutes.js`
- [Prescription routes](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/routes/prescriptionRoutes.js): `server/routes/prescriptionRoutes.js`
- [Admin routes](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/routes/adminRoutes.js): `server/routes/adminRoutes.js`
- [Authentication](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [Administration](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/controllers/adminController.js): `server/controllers/adminController.js`
- [JWT and roles](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`

### Care workflows

- [Doctor discovery and slots](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/controllers/doctorController.js): `server/controllers/doctorController.js`
- [Appointment lifecycle](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/controllers/appointmentController.js): `server/controllers/appointmentController.js`
- [Prescription services](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/controllers/prescriptionController.js): `server/controllers/prescriptionController.js`

### Persistence and files

- [User records](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/models/User.js): `server/models/User.js`
- [Doctor records](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/models/Doctor.js): `server/models/Doctor.js`
- [Appointment records](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/models/Appointment.js): `server/models/Appointment.js`
- [Prescription records](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/models/Prescription.js): `server/models/Prescription.js`
- [Amazon S3](https://github.com/ahsansabeeh910/cloud-based-medical-appointment-system/blob/main/server/utils/s3.js): `server/utils/s3.js`
- **MongoDB**

### Other components

- **Patient**
- **Doctor**

## Connections

- Patient → App routing: uses (evidence: `README.md`)
- Doctor → App routing: uses (evidence: `README.md`)
- App routing → Auth state: provides (evidence: `client/src/App.jsx`)
- Auth state → API client: authenticates through (evidence: `client/src/context/AuthContext.jsx`)
- Doctor search → API client: requests doctors (evidence: `client/src/services/api.js`)
- Appointment booking → API client: books and checks slots (evidence: `client/src/services/api.js`)
- Patient records → API client: loads records (evidence: `client/src/services/api.js`)
- Doctor portal → API client: manages appointments (evidence: `client/src/services/api.js`)
- Appointment history → API client: loads history and prescriptions (evidence: `client/src/services/api.js`)
- Profile management → API client: updates profile (evidence: `client/src/services/api.js`)
- Doctor reports → API client: requests reports (evidence: `client/src/services/api.js`)
- Admin dashboard → API client: requests administration (evidence: `client/src/services/api.js`)
- API client → Express API: calls API (evidence: `client/src/services/api.js`)
- Express API → Authentication routes: mounts (evidence: `server/server.js`)
- Express API → Doctor routes: mounts (evidence: `server/server.js`)
- Express API → Appointment routes: mounts (evidence: `server/server.js`)
- Express API → Prescription routes: mounts (evidence: `server/server.js`)
- Express API → Admin routes: mounts (evidence: `server/server.js`)
- Authentication routes → Authentication: dispatches (evidence: `server/routes/authRoutes.js`)
- Doctor routes → Doctor discovery and slots: dispatches (evidence: `server/routes/doctorRoutes.js`)
- Appointment routes → Appointment lifecycle: dispatches (evidence: `server/routes/appointmentRoutes.js`)
- Prescription routes → Prescription services: dispatches (evidence: `server/routes/prescriptionRoutes.js`)
- Admin routes → Administration: dispatches (evidence: `server/routes/adminRoutes.js`)
- Appointment routes → JWT and roles: protects (evidence: `server/routes/appointmentRoutes.js`)
- Prescription routes → JWT and roles: protects (evidence: `server/routes/prescriptionRoutes.js`)
- JWT and roles → User records: loads user (evidence: `server/middleware/authMiddleware.js`)
- Authentication → User records: authenticates users (evidence: `server/controllers/authController.js`)
- Doctor discovery and slots → Doctor records: queries doctors (evidence: `server/controllers/doctorController.js`)
- Doctor discovery and slots → Appointment records: checks booked slots (evidence: `server/controllers/doctorController.js`)
- Appointment lifecycle → Appointment records: manages appointments (evidence: `server/controllers/appointmentController.js`)
- Appointment lifecycle → Doctor records: checks doctor (evidence: `server/controllers/appointmentController.js`)
- Prescription services → Appointment records: reads appointment (evidence: `server/controllers/prescriptionController.js`)
- Prescription services → Prescription records: creates and reads (evidence: `server/controllers/prescriptionController.js`)
- Prescription services → Amazon S3: uploads and signs URLs (evidence: `server/controllers/prescriptionController.js`)
- Administration → User records: manages users (evidence: `server/controllers/adminController.js`)
- Administration → Doctor records: queries doctors (evidence: `server/controllers/adminController.js`)
- Administration → Appointment records: queries appointments (evidence: `server/controllers/adminController.js`)
- User records → MongoDB: persists
- Doctor records → MongoDB: persists
- Appointment records → MongoDB: persists
- Prescription records → MongoDB: persists
