# frontfury/doc-sheba-client architecture

> Architecture diagram of the GitHub repository frontfury/doc-sheba-client, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/frontfury/doc-sheba-client
- Repository: https://github.com/frontfury/doc-sheba-client

## Overview

DocSheba is a Next.js hospital-management client. Its main patient journey runs from doctor discovery through authenticated booking and appointment submission; role-specific dashboards support follow-up and administration. The sampled server actions and API adapters connect UI operations to a separately configured backend, while Better Auth uses MongoDB for identity persistence. The README documents assistant review, availability, cancellation, and notifications, but this tree does not expose a distinct assistant workspace or those implementations, so those capabilities are represented only where supported by the client structure. Some dashboard and profile links are omitted because their wiring was not sampled.

Main entry points: [`src/lib/actions/appointments.js`](https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/actions/appointments.js) (Appointment actions), [`src/app/book-appointment/page.jsx`](https://github.com/frontfury/doc-sheba-client/blob/main/src/app/book-appointment/page.jsx) (Booking page), [`src/lib/core/server.js`](https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/core/server.js) (Authenticated requests), [`src/lib/core/session.js`](https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/core/session.js) (Session and roles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public discovery"]
  node_home["Home experience<br/>[page.jsx]"]
  node_symptoms["Symptom selector"]
  node_doctor_directory["Doctor directory<br/>[page.jsx]"]
  node_departments["Departments<br/>[page.jsx]"]
end

subgraph group_care["Booking and care"]
  node_booking_page["Booking page<br/>[page.jsx]"]
  node_booking_form["Booking form<br/>[BookingForm.jsx]"]
  node_appointment_actions["Appointment actions<br/>[appointments.js]"]
end

subgraph group_workspace["Role workspaces"]
  node_patient_workspace["Patient workspace<br/>[page.jsx]"]
  node_doctor_workspace["Doctor workspace<br/>[page.jsx]"]
  node_appointment_list["Appointment list"]
  node_admin_users["Admin user management<br/>[page.jsx]"]
  node_patient_profile["Patient profile"]
  node_doctor_profile["Doctor profile<br/>[DoctorProfile.jsx]"]
end

subgraph group_platform["Identity and integration"]
  node_sign_in["Sign in and signup<br/>[page.jsx]"]
  node_auth_client["Auth client<br/>[auth-client.js]"]
  node_auth_service["Auth service<br/>[auth.js]"]
  node_auth_store[("Auth MongoDB")]
  node_session["Session and roles<br/>[session.js]"]
  node_appointment_api["Appointment API adapter<br/>[appointments.js]"]
  node_doctor_api["Doctor API adapter<br/>[doctors.js]"]
  node_patient_api["Patient API adapter<br/>[patients.js]"]
  node_server_requests["Authenticated requests<br/>[server.js]"]
  node_user_actions["User actions<br/>[users.js]"]
end

node_patient(("Patient"))
node_backend["Hospital backend"]

node_patient -->|"browses"| node_home
node_patient -->|"finds doctors"| node_doctor_directory
node_doctor_directory -->|"checks session"| node_session
node_doctor_directory -->|"routes to booking"| node_booking_page
node_home -->|"renders"| node_symptoms
node_patient -->|"registers or signs in"| node_sign_in
node_sign_in -->|"uses"| node_auth_client
node_auth_client -.->|"authenticates through"| node_auth_service
node_auth_service -->|"persists identity"| node_auth_store
node_session -->|"reads session"| node_auth_service
node_patient -->|"requests appointment"| node_booking_page
node_booking_page -->|"checks role"| node_session
node_booking_page -->|"loads doctor"| node_doctor_api
node_booking_page -->|"loads patient"| node_patient_api
node_booking_page -.->|"renders form"| node_booking_form
node_booking_form -->|"submits request"| node_appointment_actions
node_appointment_actions -->|"checks role"| node_session
node_appointment_actions -->|"loads doctor details"| node_doctor_api
node_appointment_actions -->|"loads patient details"| node_patient_api
node_appointment_actions -->|"loads appointments"| node_appointment_api
node_appointment_actions -->|"mutates appointments"| node_server_requests
node_doctor_api -->|"fetches doctor data"| node_server_requests
node_patient_api -->|"fetches patient data"| node_server_requests
node_appointment_api -->|"fetches appointments"| node_server_requests
node_server_requests -->|"gets token"| node_session
node_server_requests -->|"sends requests"| node_backend
node_patient_workspace -->|"loads appointments"| node_appointment_api
node_doctor_workspace -->|"loads appointments"| node_appointment_api
node_patient_workspace -->|"shows appointments"| node_appointment_list
node_doctor_workspace -->|"shows appointments"| node_appointment_list
node_appointment_list -->|"updates or deletes"| node_appointment_actions
node_admin_users -->|"manages users"| node_user_actions
node_patient_profile -.->|"manages profile"| node_patient_api
node_doctor_profile -.->|"manages profile"| node_doctor_api

click node_home "https://github.com/frontfury/doc-sheba-client/blob/main/src/app/page.jsx"
click node_symptoms "https://github.com/frontfury/doc-sheba-client/blob/main/src/components/Home/Body/SymptomSelector.jsx"
click node_doctor_directory "https://github.com/frontfury/doc-sheba-client/blob/main/src/app/doctors/page.jsx"
click node_departments "https://github.com/frontfury/doc-sheba-client/blob/main/src/app/departments/page.jsx"
click node_sign_in "https://github.com/frontfury/doc-sheba-client/blob/main/src/app/auth/signin/page.jsx"
click node_auth_client "https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/auth-client.js"
click node_auth_service "https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/auth.js"
click node_session "https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/core/session.js"
click node_booking_page "https://github.com/frontfury/doc-sheba-client/blob/main/src/app/book-appointment/page.jsx"
click node_booking_form "https://github.com/frontfury/doc-sheba-client/blob/main/src/app/book-appointment/BookingForm.jsx"
click node_appointment_actions "https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/actions/appointments.js"
click node_appointment_api "https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/api/appointments.js"
click node_doctor_api "https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/api/doctors.js"
click node_patient_api "https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/api/patients.js"
click node_server_requests "https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/core/server.js"
click node_patient_workspace "https://github.com/frontfury/doc-sheba-client/blob/main/src/app/dashboard/patient/page.jsx"
click node_doctor_workspace "https://github.com/frontfury/doc-sheba-client/blob/main/src/app/dashboard/doctor/page.jsx"
click node_appointment_list "https://github.com/frontfury/doc-sheba-client/blob/main/src/components/Dashboard/AppointmentList.jsx"
click node_admin_users "https://github.com/frontfury/doc-sheba-client/blob/main/src/app/dashboard/admin/users/page.jsx"
click node_user_actions "https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/actions/users.js"
click node_patient_profile "https://github.com/frontfury/doc-sheba-client/blob/main/src/app/dashboard/patient/profile/PatientCreateForm.jsx"
click node_doctor_profile "https://github.com/frontfury/doc-sheba-client/blob/main/src/app/dashboard/doctor/doctor-profile/DoctorProfile.jsx"

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_home,node_symptoms,node_doctor_directory,node_departments toneBlue
class node_booking_page,node_booking_form,node_appointment_actions toneAmber
class node_patient_workspace,node_doctor_workspace,node_appointment_list,node_admin_users,node_patient_profile,node_doctor_profile toneMint
class node_sign_in,node_auth_client,node_auth_service,node_auth_store,node_session,node_appointment_api,node_doctor_api,node_patient_api,node_server_requests,node_user_actions toneRose
class node_patient,node_backend toneIndigo
```

## Components

### Public discovery

- [Home experience](https://github.com/frontfury/doc-sheba-client/blob/main/src/app/page.jsx): `src/app/page.jsx`
- [Symptom selector](https://github.com/frontfury/doc-sheba-client/blob/main/src/components/Home/Body/SymptomSelector.jsx): `src/components/Home/Body/SymptomSelector.jsx`
- [Doctor directory](https://github.com/frontfury/doc-sheba-client/blob/main/src/app/doctors/page.jsx): `src/app/doctors/page.jsx`
- [Departments](https://github.com/frontfury/doc-sheba-client/blob/main/src/app/departments/page.jsx): `src/app/departments/page.jsx`

### Booking and care

- [Booking page](https://github.com/frontfury/doc-sheba-client/blob/main/src/app/book-appointment/page.jsx): `src/app/book-appointment/page.jsx`
- [Booking form](https://github.com/frontfury/doc-sheba-client/blob/main/src/app/book-appointment/BookingForm.jsx): `src/app/book-appointment/BookingForm.jsx`
- [Appointment actions](https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/actions/appointments.js): `src/lib/actions/appointments.js`

### Role workspaces

- [Patient workspace](https://github.com/frontfury/doc-sheba-client/blob/main/src/app/dashboard/patient/page.jsx): `src/app/dashboard/patient/page.jsx`
- [Doctor workspace](https://github.com/frontfury/doc-sheba-client/blob/main/src/app/dashboard/doctor/page.jsx): `src/app/dashboard/doctor/page.jsx`
- [Appointment list](https://github.com/frontfury/doc-sheba-client/blob/main/src/components/Dashboard/AppointmentList.jsx): `src/components/Dashboard/AppointmentList.jsx`
- [Admin user management](https://github.com/frontfury/doc-sheba-client/blob/main/src/app/dashboard/admin/users/page.jsx): `src/app/dashboard/admin/users/page.jsx`
- [Patient profile](https://github.com/frontfury/doc-sheba-client/blob/main/src/app/dashboard/patient/profile/PatientCreateForm.jsx): `src/app/dashboard/patient/profile/PatientCreateForm.jsx`
- [Doctor profile](https://github.com/frontfury/doc-sheba-client/blob/main/src/app/dashboard/doctor/doctor-profile/DoctorProfile.jsx): `src/app/dashboard/doctor/doctor-profile/DoctorProfile.jsx`

### Identity and integration

- [Sign in and signup](https://github.com/frontfury/doc-sheba-client/blob/main/src/app/auth/signin/page.jsx): `src/app/auth/signin/page.jsx`
- [Auth client](https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/auth-client.js): `src/lib/auth-client.js`
- [Auth service](https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/auth.js): `src/lib/auth.js`
- **Auth MongoDB**
- [Session and roles](https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/core/session.js): `src/lib/core/session.js`
- [Appointment API adapter](https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/api/appointments.js): `src/lib/api/appointments.js`
- [Doctor API adapter](https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/api/doctors.js): `src/lib/api/doctors.js`
- [Patient API adapter](https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/api/patients.js): `src/lib/api/patients.js`
- [Authenticated requests](https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/core/server.js): `src/lib/core/server.js`
- [User actions](https://github.com/frontfury/doc-sheba-client/blob/main/src/lib/actions/users.js): `src/lib/actions/users.js`

### Other components

- **Patient**
- **Hospital backend**

## Connections

- Patient → Home experience: browses
- Patient → Doctor directory: finds doctors
- Doctor directory → Session and roles: checks session (evidence: `src/app/doctors/page.jsx`)
- Doctor directory → Booking page: routes to booking (evidence: `src/app/doctors/page.jsx`)
- Home experience → Symptom selector: renders (evidence: `src/app/page.jsx`)
- Patient → Sign in and signup: registers or signs in
- Sign in and signup → Auth client: uses (evidence: `src/app/auth/signin/page.jsx`)
- Auth client → Auth service: authenticates through
- Auth service → Auth MongoDB: persists identity (evidence: `src/lib/auth.js`)
- Session and roles → Auth service: reads session (evidence: `src/lib/core/session.js`)
- Patient → Booking page: requests appointment
- Booking page → Session and roles: checks role (evidence: `src/app/book-appointment/page.jsx`)
- Booking page → Doctor API adapter: loads doctor (evidence: `src/app/book-appointment/page.jsx`)
- Booking page → Patient API adapter: loads patient (evidence: `src/app/book-appointment/page.jsx`)
- Booking page → Booking form: renders form (evidence: `src/app/book-appointment/page.jsx`)
- Booking form → Appointment actions: submits request (evidence: `src/app/book-appointment/BookingForm.jsx`)
- Appointment actions → Session and roles: checks role (evidence: `src/lib/actions/appointments.js`)
- Appointment actions → Doctor API adapter: loads doctor details (evidence: `src/lib/actions/appointments.js`)
- Appointment actions → Patient API adapter: loads patient details (evidence: `src/lib/actions/appointments.js`)
- Appointment actions → Appointment API adapter: loads appointments (evidence: `src/lib/actions/appointments.js`)
- Appointment actions → Authenticated requests: mutates appointments (evidence: `src/lib/actions/appointments.js`)
- Doctor API adapter → Authenticated requests: fetches doctor data (evidence: `src/lib/api/doctors.js`)
- Patient API adapter → Authenticated requests: fetches patient data (evidence: `src/lib/api/patients.js`)
- Appointment API adapter → Authenticated requests: fetches appointments (evidence: `src/lib/api/appointments.js`)
- Authenticated requests → Session and roles: gets token (evidence: `src/lib/core/server.js`)
- Authenticated requests → Hospital backend: sends requests (evidence: `src/lib/core/server.js`)
- Patient workspace → Appointment API adapter: loads appointments
- Doctor workspace → Appointment API adapter: loads appointments
- Patient workspace → Appointment list: shows appointments
- Doctor workspace → Appointment list: shows appointments
- Appointment list → Appointment actions: updates or deletes (evidence: `src/components/Dashboard/AppointmentList.jsx`)
- Admin user management → User actions: manages users (evidence: `src/app/dashboard/admin/users/page.jsx`)
- Patient profile → Patient API adapter: manages profile
- Doctor profile → Doctor API adapter: manages profile
