# anurag16067/caresync architecture

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

- Interactive diagram: https://gitdiagram.com/anurag16067/caresync
- Repository: https://github.com/anurag16067/caresync

## Overview

CareSync is a doctor-booking platform with patient, doctor, and admin experiences, plus an AI symptom checker. Patients browse specialists, optionally get an AI recommendation, book appointments, and manage their profile and bookings; doctors and admins manage appointments and platform data. The graph separates the web experiences, API workflows, domain records, and external services. Relationships for unsampled features are included only where the README documents them; source-level evidence is limited to the provided excerpts and index.

Main entry points: [`backend/routes/userRoute.js`](https://github.com/anurag16067/caresync/blob/main/backend/routes/userRoute.js) (Patient API routes), [`frontend/src/App.jsx`](https://github.com/anurag16067/caresync/blob/main/frontend/src/App.jsx) (Patient web app), [`backend/server.js`](https://github.com/anurag16067/caresync/blob/main/backend/server.js) (REST API server), [`backend/controllers/userController.js`](https://github.com/anurag16067/caresync/blob/main/backend/controllers/userController.js) (Patient account and booking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patient["Patient experience"]
  node_patient_app["Patient web app<br/>[App.jsx]"]
  node_patient_state["Patient app context<br/>[AppContext.jsx]"]
  node_doctor_discovery["Doctor discovery<br/>[Doctors.jsx]"]
  node_symptom_checker["Symptom checker<br/>[SymptomChecker.jsx]"]
  node_booking["Appointment booking<br/>[Appointment.jsx]"]
  node_patient_account["Profile and bookings<br/>[MyAppointments.jsx]"]
end

subgraph group_care_api["Care API"]
  node_api_server["REST API server<br/>[server.js]"]
  node_user_routes["Patient API routes<br/>[userRoute.js]"]
  node_user_workflows["Patient account and booking<br/>[userController.js]"]
  node_ai_workflow["AI recommendations<br/>[aiController.js]"]
  node_admin_routes["Admin API routes<br/>[adminRoute.js]"]
  node_admin_workflows["Admin operations<br/>[adminController.js]"]
  node_doctor_routes["Doctor API routes<br/>[doctorRoute.js]"]
  node_doctor_workflows["Doctor operations"]
end

subgraph group_staff["Doctor and admin panels"]
  node_staff_app["Staff panel<br/>[App.jsx]"]
  node_admin_state["Admin panel state<br/>[AdminContext.jsx]"]
  node_doctor_state["Doctor panel state<br/>[DoctorContext.jsx]"]
end

subgraph group_data["Platform data and services"]
  node_appointment_store[("Appointment records")]
  node_doctor_store[("Doctor records<br/>[doctorModel.js]")]
  node_user_store[("Patient records<br/>[userModel.js]")]
  node_mongodb[("MongoDB<br/>[mongodb.js]")]
  node_cloudinary["Cloudinary<br/>[cloudinary.js]"]
  node_gemini{{"Google Gemini"}}
  node_razorpay["Razorpay"]
end

node_patient_actor(("Patient"))
node_staff_actor(("Doctor or admin"))

node_patient_actor -->|"uses"| node_patient_app
node_patient_app -->|"provides context"| node_patient_state
node_patient_app -->|"routes to"| node_doctor_discovery
node_patient_app -->|"routes to"| node_symptom_checker
node_patient_app -->|"routes to"| node_booking
node_patient_app -->|"routes to"| node_patient_account
node_patient_state -->|"requests profiles"| node_user_routes
node_doctor_discovery -->|"browses doctors"| node_user_routes
node_symptom_checker -->|"submits symptoms"| node_user_routes
node_symptom_checker -->|"carries symptoms"| node_booking
node_booking -->|"books appointments"| node_user_routes
node_patient_account -->|"manages bookings"| node_user_routes
node_user_routes -->|"dispatches"| node_user_workflows
node_user_routes -->|"dispatches"| node_ai_workflow
node_api_server -->|"mounts routes"| node_user_routes
node_api_server -->|"mounts routes"| node_admin_routes
node_api_server -->|"mounts routes"| node_doctor_routes
node_user_workflows -->|"reads and writes"| node_user_store
node_user_workflows -->|"checks slots"| node_doctor_store
node_user_workflows -->|"creates bookings"| node_appointment_store
node_user_workflows -->|"creates payment orders"| node_razorpay
node_ai_workflow -->|"reads patient profile"| node_user_store
node_ai_workflow -->|"requests recommendation"| node_gemini
node_admin_routes -->|"dispatches"| node_admin_workflows
node_doctor_routes -->|"dispatches"| node_doctor_workflows
node_admin_workflows -->|"manages doctors"| node_doctor_store
node_admin_workflows -->|"manages bookings"| node_appointment_store
node_admin_workflows -->|"counts patients"| node_user_store
node_admin_workflows -->|"uploads images"| node_cloudinary
node_doctor_workflows -->|"updates doctor data"| node_doctor_store
node_doctor_workflows -->|"manages appointments"| node_appointment_store
node_staff_actor -->|"uses"| node_staff_app
node_staff_app -->|"uses"| node_admin_state
node_staff_app -->|"uses"| node_doctor_state
node_admin_state -->|"calls admin APIs"| node_admin_routes
node_doctor_state -->|"calls doctor APIs"| node_doctor_routes
node_api_server -->|"connects"| node_mongodb
node_api_server -->|"configures"| node_cloudinary
node_appointment_store -.->|"persists in"| node_mongodb
node_doctor_store -.->|"persists in"| node_mongodb
node_user_store -.->|"persists in"| node_mongodb

click node_patient_app "https://github.com/anurag16067/caresync/blob/main/frontend/src/App.jsx"
click node_patient_state "https://github.com/anurag16067/caresync/blob/main/frontend/src/context/AppContext.jsx"
click node_doctor_discovery "https://github.com/anurag16067/caresync/blob/main/frontend/src/pages/Doctors.jsx"
click node_symptom_checker "https://github.com/anurag16067/caresync/blob/main/frontend/src/pages/SymptomChecker.jsx"
click node_booking "https://github.com/anurag16067/caresync/blob/main/frontend/src/pages/Appointment.jsx"
click node_patient_account "https://github.com/anurag16067/caresync/blob/main/frontend/src/pages/MyAppointments.jsx"
click node_api_server "https://github.com/anurag16067/caresync/blob/main/backend/server.js"
click node_user_routes "https://github.com/anurag16067/caresync/blob/main/backend/routes/userRoute.js"
click node_user_workflows "https://github.com/anurag16067/caresync/blob/main/backend/controllers/userController.js"
click node_ai_workflow "https://github.com/anurag16067/caresync/blob/main/backend/controllers/aiController.js"
click node_admin_routes "https://github.com/anurag16067/caresync/blob/main/backend/routes/adminRoute.js"
click node_admin_workflows "https://github.com/anurag16067/caresync/blob/main/backend/controllers/adminController.js"
click node_doctor_routes "https://github.com/anurag16067/caresync/blob/main/backend/routes/doctorRoute.js"
click node_doctor_workflows "https://github.com/anurag16067/caresync/blob/main/backend/controllers/doctorController.js"
click node_staff_app "https://github.com/anurag16067/caresync/blob/main/admin/src/App.jsx"
click node_admin_state "https://github.com/anurag16067/caresync/blob/main/admin/src/context/AdminContext.jsx"
click node_doctor_state "https://github.com/anurag16067/caresync/blob/main/admin/src/context/DoctorContext.jsx"
click node_appointment_store "https://github.com/anurag16067/caresync/blob/main/backend/models/appointmentModel.js"
click node_doctor_store "https://github.com/anurag16067/caresync/blob/main/backend/models/doctorModel.js"
click node_user_store "https://github.com/anurag16067/caresync/blob/main/backend/models/userModel.js"
click node_mongodb "https://github.com/anurag16067/caresync/blob/main/backend/config/mongodb.js"
click node_cloudinary "https://github.com/anurag16067/caresync/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_patient_app,node_patient_state,node_doctor_discovery,node_symptom_checker,node_booking,node_patient_account toneBlue
class node_api_server,node_user_routes,node_user_workflows,node_ai_workflow,node_admin_routes,node_admin_workflows,node_doctor_routes,node_doctor_workflows toneAmber
class node_staff_app,node_admin_state,node_doctor_state toneMint
class node_appointment_store,node_doctor_store,node_user_store,node_mongodb,node_cloudinary,node_gemini,node_razorpay toneRose
class node_patient_actor,node_staff_actor toneIndigo
```

## Components

### Patient experience

- [Patient web app](https://github.com/anurag16067/caresync/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Patient app context](https://github.com/anurag16067/caresync/blob/main/frontend/src/context/AppContext.jsx): `frontend/src/context/AppContext.jsx`
- [Doctor discovery](https://github.com/anurag16067/caresync/blob/main/frontend/src/pages/Doctors.jsx): `frontend/src/pages/Doctors.jsx`
- [Symptom checker](https://github.com/anurag16067/caresync/blob/main/frontend/src/pages/SymptomChecker.jsx): `frontend/src/pages/SymptomChecker.jsx`
- [Appointment booking](https://github.com/anurag16067/caresync/blob/main/frontend/src/pages/Appointment.jsx): `frontend/src/pages/Appointment.jsx`
- [Profile and bookings](https://github.com/anurag16067/caresync/blob/main/frontend/src/pages/MyAppointments.jsx): `frontend/src/pages/MyAppointments.jsx`

### Care API

- [REST API server](https://github.com/anurag16067/caresync/blob/main/backend/server.js): `backend/server.js`
- [Patient API routes](https://github.com/anurag16067/caresync/blob/main/backend/routes/userRoute.js): `backend/routes/userRoute.js`
- [Patient account and booking](https://github.com/anurag16067/caresync/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`
- [AI recommendations](https://github.com/anurag16067/caresync/blob/main/backend/controllers/aiController.js): `backend/controllers/aiController.js`
- [Admin API routes](https://github.com/anurag16067/caresync/blob/main/backend/routes/adminRoute.js): `backend/routes/adminRoute.js`
- [Admin operations](https://github.com/anurag16067/caresync/blob/main/backend/controllers/adminController.js): `backend/controllers/adminController.js`
- [Doctor API routes](https://github.com/anurag16067/caresync/blob/main/backend/routes/doctorRoute.js): `backend/routes/doctorRoute.js`
- [Doctor operations](https://github.com/anurag16067/caresync/blob/main/backend/controllers/doctorController.js): `backend/controllers/doctorController.js`

### Doctor and admin panels

- [Staff panel](https://github.com/anurag16067/caresync/blob/main/admin/src/App.jsx): `admin/src/App.jsx`
- [Admin panel state](https://github.com/anurag16067/caresync/blob/main/admin/src/context/AdminContext.jsx): `admin/src/context/AdminContext.jsx`
- [Doctor panel state](https://github.com/anurag16067/caresync/blob/main/admin/src/context/DoctorContext.jsx): `admin/src/context/DoctorContext.jsx`

### Platform data and services

- [Appointment records](https://github.com/anurag16067/caresync/blob/main/backend/models/appointmentModel.js): `backend/models/appointmentModel.js`
- [Doctor records](https://github.com/anurag16067/caresync/blob/main/backend/models/doctorModel.js): `backend/models/doctorModel.js`
- [Patient records](https://github.com/anurag16067/caresync/blob/main/backend/models/userModel.js): `backend/models/userModel.js`
- [MongoDB](https://github.com/anurag16067/caresync/blob/main/backend/config/mongodb.js): `backend/config/mongodb.js`
- [Cloudinary](https://github.com/anurag16067/caresync/blob/main/backend/config/cloudinary.js): `backend/config/cloudinary.js`
- **Google Gemini**
- **Razorpay**

### Other components

- **Patient**
- **Doctor or admin**

## Connections

- Patient → Patient web app: uses
- Patient web app → Patient app context: provides context (evidence: `frontend/src/main.jsx`)
- Patient web app → Doctor discovery: routes to (evidence: `frontend/src/App.jsx`)
- Patient web app → Symptom checker: routes to (evidence: `frontend/src/App.jsx`)
- Patient web app → Appointment booking: routes to (evidence: `frontend/src/App.jsx`)
- Patient web app → Profile and bookings: routes to (evidence: `frontend/src/App.jsx`)
- Patient app context → Patient API routes: requests profiles (evidence: `frontend/src/context/AppContext.jsx`)
- Doctor discovery → Patient API routes: browses doctors
- Symptom checker → Patient API routes: submits symptoms
- Symptom checker → Appointment booking: carries symptoms
- Appointment booking → Patient API routes: books appointments
- Profile and bookings → Patient API routes: manages bookings
- Patient API routes → Patient account and booking: dispatches (evidence: `backend/routes/userRoute.js`)
- Patient API routes → AI recommendations: dispatches (evidence: `backend/routes/userRoute.js`)
- REST API server → Patient API routes: mounts routes (evidence: `backend/server.js`)
- REST API server → Admin API routes: mounts routes (evidence: `backend/server.js`)
- REST API server → Doctor API routes: mounts routes (evidence: `backend/server.js`)
- Patient account and booking → Patient records: reads and writes (evidence: `backend/controllers/userController.js`)
- Patient account and booking → Doctor records: checks slots (evidence: `backend/controllers/userController.js`)
- Patient account and booking → Appointment records: creates bookings (evidence: `backend/controllers/userController.js`)
- Patient account and booking → Razorpay: creates payment orders
- AI recommendations → Patient records: reads patient profile (evidence: `backend/controllers/aiController.js`)
- AI recommendations → Google Gemini: requests recommendation
- Admin API routes → Admin operations: dispatches (evidence: `backend/routes/adminRoute.js`)
- Doctor API routes → Doctor operations: dispatches (evidence: `backend/routes/doctorRoute.js`)
- Admin operations → Doctor records: manages doctors (evidence: `backend/controllers/adminController.js`)
- Admin operations → Appointment records: manages bookings (evidence: `backend/controllers/adminController.js`)
- Admin operations → Patient records: counts patients (evidence: `backend/controllers/adminController.js`)
- Admin operations → Cloudinary: uploads images (evidence: `backend/controllers/adminController.js`)
- Doctor operations → Doctor records: updates doctor data (evidence: `backend/controllers/doctorController.js`)
- Doctor operations → Appointment records: manages appointments (evidence: `backend/controllers/doctorController.js`)
- Doctor or admin → Staff panel: uses
- Staff panel → Admin panel state: uses (evidence: `admin/src/App.jsx`)
- Staff panel → Doctor panel state: uses (evidence: `admin/src/App.jsx`)
- Admin panel state → Admin API routes: calls admin APIs (evidence: `admin/src/context/AdminContext.jsx`)
- Doctor panel state → Doctor API routes: calls doctor APIs (evidence: `admin/src/context/DoctorContext.jsx`)
- REST API server → MongoDB: connects (evidence: `backend/server.js`)
- REST API server → Cloudinary: configures (evidence: `backend/server.js`)
- Appointment records → MongoDB: persists in
- Doctor records → MongoDB: persists in
- Patient records → MongoDB: persists in
