# medicore-project/medicore-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/medicore-project/medicore-frontend
- Repository: https://github.com/medicore-project/medicore-frontend

## Overview

This is a clinic-management web application for staff and patients. Staff authenticate to reach role-protected workflows for appointments and schedules, patient records, clinic administration, and reporting. Patients can use public booking: identify themselves, choose an appointment, and join or review a waitlist. The frontend pages and booking flow invoke API modules, which share an HTTP client for backend requests. The README is only a Vite template, so product capabilities are inferred from the source tree and index; unsampled page details and backend behavior are not established here.

Main entry points: [`src/api/client.ts`](https://github.com/medicore-project/medicore-frontend/blob/main/src/api/client.ts) (API HTTP client), [`src/App.tsx`](https://github.com/medicore-project/medicore-frontend/blob/main/src/App.tsx) (Route application), [`src/components/booking/BookingFlow.tsx`](https://github.com/medicore-project/medicore-frontend/blob/main/src/components/booking/BookingFlow.tsx) (Public booking flow), [`src/api/appointments.ts`](https://github.com/medicore-project/medicore-frontend/blob/main/src/api/appointments.ts) (Appointment services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_app["Route application<br/>[App.tsx]"]
end

subgraph group_identity["Identity and access"]
  node_auth["Authentication state<br/>[AuthContext.tsx]"]
  node_protected["Role guard<br/>[ProtectedRoute.tsx]"]
  node_http["API HTTP client<br/>[client.ts]"]
end

subgraph group_booking["Booking and scheduling"]
  node_bookingflow["Public booking flow<br/>[BookingFlow.tsx]"]
  node_bookingapi["Booking services<br/>[booking.ts]"]
  node_bookingtoken["Booking token<br/>[bookingToken.ts]"]
  node_appointmentspage["Appointments and schedules"]
  node_appointmentapi["Appointment services<br/>[appointments.ts]"]
  node_waitlistapi["Waitlist services<br/>[waitlist.ts]"]
end

subgraph group_care["Patient care"]
  node_patientsearch["Patient search"]
  node_patientapi["Patient services<br/>[patients.ts]"]
  node_prescriptionform["Prescription editing"]
  node_patientcarepages["Records and patient pages"]
end

subgraph group_operations["Clinic operations"]
  node_dashboard["Dashboard data"]
  node_dashboardlogic["Dashboard calculations<br/>[dashboard.ts]"]
  node_tariffs["Service tariffs"]
  node_tariffapi["Tariff services<br/>[serviceTariffs.ts]"]
  node_reports["Reports and administration"]
end

node_user(("Staff or patient"))
node_backend{{"Clinic backend"}}

node_user -->|"opens"| node_app
node_app -->|"protects routes"| node_protected
node_protected -->|"checks identity"| node_auth
node_app -->|"routes to"| node_bookingflow
node_app -->|"routes to"| node_appointmentspage
node_auth -->|"authenticates through"| node_http
node_http -->|"sends requests"| node_backend
node_bookingflow -->|"calls"| node_bookingapi
node_bookingflow -->|"calls"| node_appointmentapi
node_bookingflow -->|"calls"| node_waitlistapi
node_bookingflow -->|"uses"| node_bookingtoken
node_bookingapi -->|"requests through"| node_http
node_appointmentapi -->|"requests through"| node_http
node_waitlistapi -->|"requests through"| node_http
node_appointmentspage -->|"loads schedules"| node_appointmentapi
node_dashboard -->|"loads appointments"| node_appointmentapi
node_dashboard -->|"loads waitlist"| node_waitlistapi
node_dashboard -->|"plans dashboard"| node_dashboardlogic
node_patientsearch -->|"searches patients"| node_patientapi
node_patientapi -->|"requests through"| node_http
node_prescriptionform -.->|"supports patient care"| node_patientcarepages
node_tariffs -->|"manages tariffs"| node_tariffapi
node_tariffapi -->|"requests through"| node_http
node_app -->|"routes to"| node_patientcarepages
node_app -->|"routes to"| node_reports

click node_app "https://github.com/medicore-project/medicore-frontend/blob/main/src/App.tsx"
click node_auth "https://github.com/medicore-project/medicore-frontend/blob/main/src/contexts/AuthContext.tsx"
click node_protected "https://github.com/medicore-project/medicore-frontend/blob/main/src/routes/ProtectedRoute.tsx"
click node_http "https://github.com/medicore-project/medicore-frontend/blob/main/src/api/client.ts"
click node_bookingflow "https://github.com/medicore-project/medicore-frontend/blob/main/src/components/booking/BookingFlow.tsx"
click node_bookingapi "https://github.com/medicore-project/medicore-frontend/blob/main/src/api/booking.ts"
click node_bookingtoken "https://github.com/medicore-project/medicore-frontend/blob/main/src/api/bookingToken.ts"
click node_appointmentspage "https://github.com/medicore-project/medicore-frontend/blob/main/src/pages/AppointmentsPage.tsx"
click node_appointmentapi "https://github.com/medicore-project/medicore-frontend/blob/main/src/api/appointments.ts"
click node_waitlistapi "https://github.com/medicore-project/medicore-frontend/blob/main/src/api/waitlist.ts"
click node_dashboard "https://github.com/medicore-project/medicore-frontend/blob/main/src/hooks/useDashboardData.ts"
click node_dashboardlogic "https://github.com/medicore-project/medicore-frontend/blob/main/src/utils/dashboard.ts"
click node_patientsearch "https://github.com/medicore-project/medicore-frontend/blob/main/src/pages/PatientSearchPage.tsx"
click node_patientapi "https://github.com/medicore-project/medicore-frontend/blob/main/src/api/patients.ts"
click node_prescriptionform "https://github.com/medicore-project/medicore-frontend/blob/main/src/components/patients/PrescriptionFormModal.tsx"
click node_patientcarepages "https://github.com/medicore-project/medicore-frontend/tree/main/src/pages"
click node_tariffs "https://github.com/medicore-project/medicore-frontend/blob/main/src/pages/ServiceTariffsPage.tsx"
click node_tariffapi "https://github.com/medicore-project/medicore-frontend/blob/main/src/api/serviceTariffs.ts"
click node_reports "https://github.com/medicore-project/medicore-frontend/tree/main/src/pages"

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_app toneBlue
class node_auth,node_protected,node_http toneAmber
class node_bookingflow,node_bookingapi,node_bookingtoken,node_appointmentspage,node_appointmentapi,node_waitlistapi toneMint
class node_patientsearch,node_patientapi,node_prescriptionform,node_patientcarepages toneRose
class node_dashboard,node_dashboardlogic,node_tariffs,node_tariffapi,node_reports,node_user,node_backend toneIndigo
```

## Components

### Application entry

- [Route application](https://github.com/medicore-project/medicore-frontend/blob/main/src/App.tsx): `src/App.tsx`

### Identity and access

- [Authentication state](https://github.com/medicore-project/medicore-frontend/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Role guard](https://github.com/medicore-project/medicore-frontend/blob/main/src/routes/ProtectedRoute.tsx): `src/routes/ProtectedRoute.tsx`
- [API HTTP client](https://github.com/medicore-project/medicore-frontend/blob/main/src/api/client.ts): `src/api/client.ts`

### Booking and scheduling

- [Public booking flow](https://github.com/medicore-project/medicore-frontend/blob/main/src/components/booking/BookingFlow.tsx): `src/components/booking/BookingFlow.tsx`
- [Booking services](https://github.com/medicore-project/medicore-frontend/blob/main/src/api/booking.ts): `src/api/booking.ts`
- [Booking token](https://github.com/medicore-project/medicore-frontend/blob/main/src/api/bookingToken.ts): `src/api/bookingToken.ts`
- [Appointments and schedules](https://github.com/medicore-project/medicore-frontend/blob/main/src/pages/AppointmentsPage.tsx): `src/pages/AppointmentsPage.tsx`
- [Appointment services](https://github.com/medicore-project/medicore-frontend/blob/main/src/api/appointments.ts): `src/api/appointments.ts`
- [Waitlist services](https://github.com/medicore-project/medicore-frontend/blob/main/src/api/waitlist.ts): `src/api/waitlist.ts`

### Patient care

- [Patient search](https://github.com/medicore-project/medicore-frontend/blob/main/src/pages/PatientSearchPage.tsx): `src/pages/PatientSearchPage.tsx`
- [Patient services](https://github.com/medicore-project/medicore-frontend/blob/main/src/api/patients.ts): `src/api/patients.ts`
- [Prescription editing](https://github.com/medicore-project/medicore-frontend/blob/main/src/components/patients/PrescriptionFormModal.tsx): `src/components/patients/PrescriptionFormModal.tsx`
- [Records and patient pages](https://github.com/medicore-project/medicore-frontend/tree/main/src/pages): `src/pages`

### Clinic operations

- [Dashboard data](https://github.com/medicore-project/medicore-frontend/blob/main/src/hooks/useDashboardData.ts): `src/hooks/useDashboardData.ts`
- [Dashboard calculations](https://github.com/medicore-project/medicore-frontend/blob/main/src/utils/dashboard.ts): `src/utils/dashboard.ts`
- [Service tariffs](https://github.com/medicore-project/medicore-frontend/blob/main/src/pages/ServiceTariffsPage.tsx): `src/pages/ServiceTariffsPage.tsx`
- [Tariff services](https://github.com/medicore-project/medicore-frontend/blob/main/src/api/serviceTariffs.ts): `src/api/serviceTariffs.ts`
- [Reports and administration](https://github.com/medicore-project/medicore-frontend/tree/main/src/pages): `src/pages`

### Other components

- **Staff or patient**
- **Clinic backend**

## Connections

- Staff or patient → Route application: opens (evidence: `src/App.tsx`)
- Route application → Role guard: protects routes (evidence: `src/App.tsx`)
- Role guard → Authentication state: checks identity (evidence: `src/routes/ProtectedRoute.tsx`)
- Route application → Public booking flow: routes to (evidence: `src/App.tsx`)
- Route application → Appointments and schedules: routes to (evidence: `src/App.tsx`)
- Authentication state → API HTTP client: authenticates through (evidence: `src/contexts/AuthContext.tsx`)
- API HTTP client → Clinic backend: sends requests (evidence: `src/api/client.ts`)
- Public booking flow → Booking services: calls (evidence: `src/components/booking/BookingFlow.tsx`)
- Public booking flow → Appointment services: calls (evidence: `src/components/booking/BookingFlow.tsx`)
- Public booking flow → Waitlist services: calls (evidence: `src/components/booking/BookingFlow.tsx`)
- Public booking flow → Booking token: uses (evidence: `src/components/booking/BookingFlow.tsx`)
- Booking services → API HTTP client: requests through (evidence: `src/api/booking.ts`)
- Appointment services → API HTTP client: requests through (evidence: `src/api/appointments.ts`)
- Waitlist services → API HTTP client: requests through (evidence: `src/api/waitlist.ts`)
- Appointments and schedules → Appointment services: loads schedules (evidence: `src/pages/AppointmentsPage.tsx`)
- Dashboard data → Appointment services: loads appointments (evidence: `src/hooks/useDashboardData.ts`)
- Dashboard data → Waitlist services: loads waitlist (evidence: `src/hooks/useDashboardData.ts`)
- Dashboard data → Dashboard calculations: plans dashboard (evidence: `src/hooks/useDashboardData.ts`)
- Patient search → Patient services: searches patients (evidence: `src/pages/PatientSearchPage.tsx`)
- Patient services → API HTTP client: requests through (evidence: `src/api/patients.ts`)
- Prescription editing → Records and patient pages: supports patient care
- Service tariffs → Tariff services: manages tariffs (evidence: `src/pages/ServiceTariffsPage.tsx`)
- Tariff services → API HTTP client: requests through (evidence: `src/api/serviceTariffs.ts`)
- Route application → Records and patient pages: routes to (evidence: `src/App.tsx`)
- Route application → Reports and administration: routes to (evidence: `src/App.tsx`)
