# obai-khsara/doctor-appointment-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/obai-khsara/doctor-appointment-frontend
- Repository: https://github.com/obai-khsara/doctor-appointment-frontend

## Overview

This is a React doctor-appointment frontend. Users browse doctors and departments, register or log in, then create and manage appointments; administrators can add doctors. The app entry point mounts routing, authentication, and query providers, while route components and shared hooks handle screens and backend requests. The README is only the Vite template, so product capabilities are inferred from the source index and excerpts. Unsampled component internals limit some screen-to-hook details; shown API relationships are supported by the sampled hooks.

Main entry points: [`src/App.jsx`](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/App.jsx) (Routes and shell), [`src/pages/Home.jsx`](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/pages/Home.jsx) (Home page), [`src/hooks/useDoctor.js`](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/hooks/useDoctor.js) (Doctor data hooks), [`src/context/AuthContext.jsx`](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/context/AuthContext.jsx) (Auth context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App and navigation"]
  node_main["React entry<br/>[main.jsx]"]
  node_app["Routes and shell<br/>[App.jsx]"]
  node_navbar["Desktop navigation<br/>[Navbar.jsx]"]
  node_mobile_nav["Mobile navigation<br/>[NavbarMobile.jsx]"]
  node_not_found["Not found page<br/>[NotFound.jsx]"]
end

subgraph group_discovery["Doctor discovery"]
  node_home["Home page<br/>[Home.jsx]"]
  node_hero["Hero slider<br/>[HeroSlider.jsx]"]
  node_cta["Call to action<br/>[CallToAction.jsx]"]
  node_about["About section<br/>[About.jsx]"]
  node_states["Service statistics<br/>[States.jsx]"]
  node_departments_ui["Department listing<br/>[Departments.jsx]"]
  node_doctors_ui["Doctor highlights<br/>[Doctors.jsx]"]
  node_all_doctors["Doctor directory<br/>[AllDoctors.jsx]"]
  node_doctor_details["Doctor details<br/>[DoctorDetails.jsx]"]
  node_doctor_hooks["Doctor data hooks<br/>[useDoctor.js]"]
  node_department_hooks["Department data hooks<br/>[useDepartments.js]"]
end

subgraph group_identity["Identity and access"]
  node_auth["Auth context<br/>[AuthContext.jsx]"]
  node_login["Login screen<br/>[Login.jsx]"]
  node_register["Registration screen<br/>[Register.jsx]"]
  node_guard["Route access guard<br/>[RequireAuth.jsx]"]
end

subgraph group_appointments["Appointments and administration"]
  node_add_appointment["Create appointment<br/>[AddAppointment.jsx]"]
  node_appointment_hooks["Appointment data hooks<br/>[useAppointments.js]"]
  node_my_appointments["My appointments<br/>[MyAppointment.jsx]"]
  node_add_doctor["Add doctor<br/>[AddDoctor.jsx]"]
end

node_visitor(("Visitor / patient / admin"))
node_backend{{"Appointment backend"}}

node_visitor -->|"opens app"| node_main
node_main -->|"renders"| node_app
node_main -->|"provides auth"| node_auth
node_app -->|"renders"| node_navbar
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_register
node_app -->|"routes to"| node_all_doctors
node_app -->|"routes to"| node_doctor_details
node_app -->|"guards routes"| node_guard
node_app -->|"routes to"| node_add_doctor
node_app -->|"routes to"| node_add_appointment
node_app -->|"routes to"| node_my_appointments
node_app -->|"fallback route"| node_not_found
node_app -->|"shows conditionally"| node_mobile_nav
node_navbar -->|"reads session"| node_auth
node_mobile_nav -->|"reads session"| node_auth
node_login -->|"uses auth"| node_auth
node_register -->|"uses auth"| node_auth
node_guard -->|"checks access"| node_auth
node_home -->|"renders"| node_hero
node_home -->|"renders"| node_cta
node_home -->|"renders"| node_about
node_home -->|"renders"| node_states
node_home -->|"renders"| node_departments_ui
node_home -->|"renders"| node_doctors_ui
node_departments_ui -->|"loads data"| node_department_hooks
node_states -->|"loads counts"| node_department_hooks
node_states -->|"loads counts"| node_doctor_hooks
node_doctors_ui -->|"loads data"| node_doctor_hooks
node_all_doctors -->|"loads doctors"| node_doctor_hooks
node_doctor_details -->|"loads doctor"| node_doctor_hooks
node_add_appointment -->|"loads choices"| node_doctor_hooks
node_add_appointment -->|"submits booking"| node_appointment_hooks
node_my_appointments -->|"manages bookings"| node_appointment_hooks
node_add_doctor -->|"submits doctor"| node_doctor_hooks
node_doctor_hooks -->|"requests doctors"| node_backend
node_department_hooks -->|"requests departments"| node_backend
node_appointment_hooks -->|"manages appointments"| node_backend

click node_main "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/main.jsx"
click node_app "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/App.jsx"
click node_navbar "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/Navbar.jsx"
click node_mobile_nav "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/NavbarMobile.jsx"
click node_home "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/pages/Home.jsx"
click node_hero "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/HeroSlider.jsx"
click node_cta "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/CallToAction.jsx"
click node_about "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/About.jsx"
click node_states "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/States.jsx"
click node_departments_ui "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/Departments.jsx"
click node_doctors_ui "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/Doctors.jsx"
click node_all_doctors "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/pages/AllDoctors.jsx"
click node_doctor_details "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/pages/DoctorDetails.jsx"
click node_auth "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/context/AuthContext.jsx"
click node_login "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/Login.jsx"
click node_register "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/Register.jsx"
click node_guard "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/RequireAuth.jsx"
click node_doctor_hooks "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/hooks/useDoctor.js"
click node_department_hooks "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/hooks/useDepartments.js"
click node_add_appointment "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/pages/AddAppointment.jsx"
click node_appointment_hooks "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/hooks/useAppointments.js"
click node_my_appointments "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/pages/MyAppointment.jsx"
click node_add_doctor "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/pages/AddDoctor.jsx"
click node_not_found "https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/pages/NotFound.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_main,node_app,node_navbar,node_mobile_nav,node_not_found toneBlue
class node_home,node_hero,node_cta,node_about,node_states,node_departments_ui,node_doctors_ui,node_all_doctors,node_doctor_details,node_doctor_hooks,node_department_hooks toneAmber
class node_auth,node_login,node_register,node_guard toneMint
class node_add_appointment,node_appointment_hooks,node_my_appointments,node_add_doctor toneRose
class node_visitor,node_backend toneIndigo
```

## Components

### App and navigation

- [React entry](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/main.jsx): `src/main.jsx`
- [Routes and shell](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/App.jsx): `src/App.jsx`
- [Desktop navigation](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/Navbar.jsx): `src/components/Navbar.jsx`
- [Mobile navigation](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/NavbarMobile.jsx): `src/components/NavbarMobile.jsx`
- [Not found page](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/pages/NotFound.jsx): `src/pages/NotFound.jsx`

### Doctor discovery

- [Home page](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`
- [Hero slider](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/HeroSlider.jsx): `src/components/HeroSlider.jsx`
- [Call to action](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/CallToAction.jsx): `src/components/CallToAction.jsx`
- [About section](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/About.jsx): `src/components/About.jsx`
- [Service statistics](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/States.jsx): `src/components/States.jsx`
- [Department listing](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/Departments.jsx): `src/components/Departments.jsx`
- [Doctor highlights](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/Doctors.jsx): `src/components/Doctors.jsx`
- [Doctor directory](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/pages/AllDoctors.jsx): `src/pages/AllDoctors.jsx`
- [Doctor details](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/pages/DoctorDetails.jsx): `src/pages/DoctorDetails.jsx`
- [Doctor data hooks](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/hooks/useDoctor.js): `src/hooks/useDoctor.js`
- [Department data hooks](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/hooks/useDepartments.js): `src/hooks/useDepartments.js`

### Identity and access

- [Auth context](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [Login screen](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/Login.jsx): `src/components/Login.jsx`
- [Registration screen](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/Register.jsx): `src/components/Register.jsx`
- [Route access guard](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/components/RequireAuth.jsx): `src/components/RequireAuth.jsx`

### Appointments and administration

- [Create appointment](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/pages/AddAppointment.jsx): `src/pages/AddAppointment.jsx`
- [Appointment data hooks](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/hooks/useAppointments.js): `src/hooks/useAppointments.js`
- [My appointments](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/pages/MyAppointment.jsx): `src/pages/MyAppointment.jsx`
- [Add doctor](https://github.com/obai-khsara/doctor-appointment-frontend/blob/main/src/pages/AddDoctor.jsx): `src/pages/AddDoctor.jsx`

### Other components

- **Visitor / patient / admin**
- **Appointment backend**

## Connections

- Visitor / patient / admin → React entry: opens app (evidence: `src/main.jsx`)
- React entry → Routes and shell: renders (evidence: `src/main.jsx`)
- React entry → Auth context: provides auth (evidence: `src/main.jsx`)
- Routes and shell → Desktop navigation: renders (evidence: `src/App.jsx`)
- Routes and shell → Home page: routes to (evidence: `src/App.jsx`)
- Routes and shell → Login screen: routes to (evidence: `src/App.jsx`)
- Routes and shell → Registration screen: routes to (evidence: `src/App.jsx`)
- Routes and shell → Doctor directory: routes to (evidence: `src/App.jsx`)
- Routes and shell → Doctor details: routes to (evidence: `src/App.jsx`)
- Routes and shell → Route access guard: guards routes (evidence: `src/App.jsx`)
- Routes and shell → Add doctor: routes to (evidence: `src/App.jsx`)
- Routes and shell → Create appointment: routes to (evidence: `src/App.jsx`)
- Routes and shell → My appointments: routes to (evidence: `src/App.jsx`)
- Routes and shell → Not found page: fallback route (evidence: `src/App.jsx`)
- Routes and shell → Mobile navigation: shows conditionally (evidence: `src/App.jsx`)
- Desktop navigation → Auth context: reads session (evidence: `src/components/Navbar.jsx`)
- Mobile navigation → Auth context: reads session (evidence: `src/components/NavbarMobile.jsx`)
- Login screen → Auth context: uses auth (evidence: `src/components/Login.jsx`)
- Registration screen → Auth context: uses auth (evidence: `src/components/Register.jsx`)
- Route access guard → Auth context: checks access (evidence: `src/components/RequireAuth.jsx`)
- Home page → Hero slider: renders (evidence: `src/pages/Home.jsx`)
- Home page → Call to action: renders (evidence: `src/pages/Home.jsx`)
- Home page → About section: renders (evidence: `src/pages/Home.jsx`)
- Home page → Service statistics: renders (evidence: `src/pages/Home.jsx`)
- Home page → Department listing: renders (evidence: `src/pages/Home.jsx`)
- Home page → Doctor highlights: renders (evidence: `src/pages/Home.jsx`)
- Department listing → Department data hooks: loads data (evidence: `src/components/Departments.jsx`)
- Service statistics → Department data hooks: loads counts (evidence: `src/components/States.jsx`)
- Service statistics → Doctor data hooks: loads counts (evidence: `src/components/States.jsx`)
- Doctor highlights → Doctor data hooks: loads data (evidence: `src/components/Doctors.jsx`)
- Doctor directory → Doctor data hooks: loads doctors (evidence: `src/pages/AllDoctors.jsx`)
- Doctor details → Doctor data hooks: loads doctor (evidence: `src/pages/DoctorDetails.jsx`)
- Create appointment → Doctor data hooks: loads choices (evidence: `src/pages/AddAppointment.jsx`)
- Create appointment → Appointment data hooks: submits booking (evidence: `src/pages/AddAppointment.jsx`)
- My appointments → Appointment data hooks: manages bookings (evidence: `src/pages/MyAppointment.jsx`)
- Add doctor → Doctor data hooks: submits doctor (evidence: `src/pages/AddDoctor.jsx`)
- Doctor data hooks → Appointment backend: requests doctors (evidence: `src/hooks/useDoctor.js`)
- Department data hooks → Appointment backend: requests departments (evidence: `src/hooks/useDepartments.js`)
- Appointment data hooks → Appointment backend: manages appointments (evidence: `src/hooks/useAppointments.js`)
