# artu2410/agenda-kareh architecture

> Architecture diagram of the GitHub repository artu2410/agenda-kareh, 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/artu2410/agenda-kareh
- Repository: https://github.com/artu2410/agenda-kareh

## Overview

Agenda Kareh is a clinical-practice SaaS for managing appointments, patients, clinical histories, documents, cashflow, billing and operational metrics. The principal workflow runs from staff using the web application, through its HTTP client and Express API, into domain controllers and PostgreSQL-backed records. The graph includes major README capabilities, authentication and file storage as distinct branches. Evidence is limited to the README and sampled/indexed references; unsampled feature internals are represented at their exact page or directory paths without speculative call chains.

Main entry points: [`client/src/App.jsx`](https://github.com/artu2410/agenda-kareh/blob/main/client/src/App.jsx) (Application shell), [`client/src/services/api.js`](https://github.com/artu2410/agenda-kareh/blob/main/client/src/services/api.js) (HTTP client), [`server/server.js`](https://github.com/artu2410/agenda-kareh/blob/main/server/server.js) (Express application), [`server/src/routes/appointments.routes.js`](https://github.com/artu2410/agenda-kareh/blob/main/server/src/routes/appointments.routes.js) (Appointment endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Application shell<br/>[App.jsx]"]
  node_api["HTTP client<br/>[api.js]"]
end

subgraph group_care["Clinical operations"]
  node_appointments_ui["Appointment workflow"]
  node_patients_ui["Patient management<br/>[PatientsPage.jsx]"]
  node_history_ui["Clinical history"]
  node_patient_docs["Patient documents"]
end

subgraph group_business["Practice management"]
  node_cashflow_ui["Cashflow management<br/>[CashflowPage.jsx]"]
  node_billing_ui["Billing<br/>[BillingPage.jsx]"]
  node_capacity_ui["Capacity metrics<br/>[CapacityPage.jsx]"]
end

subgraph group_backend["API and domains"]
  node_agenda_api["Appointment endpoints"]
  node_appointment_logic["Appointment operations"]
  node_scheduling["Scheduling rules"]
  node_clinical_api["History endpoints"]
  node_patient_api["Patient endpoints<br/>[patient.routes.js]"]
  node_metrics_logic["Capacity analysis"]
  node_server["Express application<br/>[server.js]"]
end

subgraph group_platform["Identity and infrastructure"]
  node_auth_ui["Authentication bootstrap<br/>[authBootstrap.js]"]
  node_session["Session management<br/>[sessionManager.js]"]
  node_auth_middleware["Authentication guard<br/>[authMiddleware.js]"]
  node_file_api["Upload endpoints<br/>[upload.routes.js]"]
  node_storage["File storage<br/>[storage.js]"]
  node_database[("PostgreSQL")]
end

node_staff(("Practice staff"))

node_staff -->|"uses"| node_app
node_app -->|"bootstraps session"| node_auth_ui
node_app -->|"routes to"| node_appointments_ui
node_app -->|"routes to"| node_cashflow_ui
node_app -->|"routes to"| node_billing_ui
node_app -->|"routes to"| node_capacity_ui
node_appointments_ui -->|"calls"| node_api
node_history_ui -->|"calls"| node_api
node_api -.->|"sends requests"| node_server
node_server -->|"mounts routes"| node_agenda_api
node_server -->|"mounts routes"| node_clinical_api
node_server -->|"mounts routes"| node_patient_api
node_agenda_api -->|"guards requests"| node_auth_middleware
node_agenda_api -->|"dispatches to"| node_appointment_logic
node_appointment_logic -->|"uses scheduling"| node_scheduling
node_clinical_api -->|"checks roles"| node_auth_middleware
node_clinical_api -->|"reads and writes"| node_database
node_capacity_ui -.->|"requests metrics"| node_api
node_metrics_logic -.->|"analyzes records"| node_database
node_auth_ui -->|"restores session"| node_api
node_session -->|"persists sessions"| node_database
node_auth_middleware -->|"validates identity"| node_session
node_file_api -->|"stores uploads"| node_storage
node_storage -.->|"stores file metadata"| node_database
node_patient_docs -.->|"supports records"| node_history_ui

click node_app "https://github.com/artu2410/agenda-kareh/blob/main/client/src/App.jsx"
click node_api "https://github.com/artu2410/agenda-kareh/blob/main/client/src/services/api.js"
click node_appointments_ui "https://github.com/artu2410/agenda-kareh/blob/main/client/src/hooks/useAppointmentForm.js"
click node_patients_ui "https://github.com/artu2410/agenda-kareh/blob/main/client/src/features/patients/pages/PatientsPage.jsx"
click node_history_ui "https://github.com/artu2410/agenda-kareh/blob/main/client/src/pages/ClinicalHistoryPage.jsx"
click node_patient_docs "https://github.com/artu2410/agenda-kareh/tree/main/client/src/components/documents"
click node_agenda_api "https://github.com/artu2410/agenda-kareh/blob/main/server/src/routes/appointments.routes.js"
click node_appointment_logic "https://github.com/artu2410/agenda-kareh/blob/main/server/src/controllers/AppointmentController.js"
click node_scheduling "https://github.com/artu2410/agenda-kareh/blob/main/server/src/domain/appointments/scheduling.service.js"
click node_clinical_api "https://github.com/artu2410/agenda-kareh/blob/main/server/src/routes/clinicalHistory.routes.js"
click node_patient_api "https://github.com/artu2410/agenda-kareh/blob/main/server/src/routes/patient.routes.js"
click node_cashflow_ui "https://github.com/artu2410/agenda-kareh/blob/main/client/src/pages/CashflowPage.jsx"
click node_billing_ui "https://github.com/artu2410/agenda-kareh/blob/main/client/src/features/billing/pages/BillingPage.jsx"
click node_capacity_ui "https://github.com/artu2410/agenda-kareh/blob/main/client/src/pages/CapacityPage.jsx"
click node_metrics_logic "https://github.com/artu2410/agenda-kareh/blob/main/server/src/domain/metrics/capacity.service.js"
click node_auth_ui "https://github.com/artu2410/agenda-kareh/blob/main/client/src/services/authBootstrap.js"
click node_session "https://github.com/artu2410/agenda-kareh/blob/main/server/src/utils/sessionManager.js"
click node_auth_middleware "https://github.com/artu2410/agenda-kareh/blob/main/server/src/middlewares/authMiddleware.js"
click node_file_api "https://github.com/artu2410/agenda-kareh/blob/main/server/src/routes/upload.routes.js"
click node_storage "https://github.com/artu2410/agenda-kareh/blob/main/server/src/services/storage.js"
click node_server "https://github.com/artu2410/agenda-kareh/blob/main/server/server.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_app,node_api toneBlue
class node_appointments_ui,node_patients_ui,node_history_ui,node_patient_docs toneAmber
class node_cashflow_ui,node_billing_ui,node_capacity_ui toneMint
class node_agenda_api,node_appointment_logic,node_scheduling,node_clinical_api,node_patient_api,node_metrics_logic,node_server toneRose
class node_auth_ui,node_session,node_auth_middleware,node_file_api,node_storage,node_database,node_staff toneIndigo
```

## Components

### Web application

- [Application shell](https://github.com/artu2410/agenda-kareh/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [HTTP client](https://github.com/artu2410/agenda-kareh/blob/main/client/src/services/api.js): `client/src/services/api.js`

### Clinical operations

- [Appointment workflow](https://github.com/artu2410/agenda-kareh/blob/main/client/src/hooks/useAppointmentForm.js): `client/src/hooks/useAppointmentForm.js`
- [Patient management](https://github.com/artu2410/agenda-kareh/blob/main/client/src/features/patients/pages/PatientsPage.jsx): `client/src/features/patients/pages/PatientsPage.jsx`
- [Clinical history](https://github.com/artu2410/agenda-kareh/blob/main/client/src/pages/ClinicalHistoryPage.jsx): `client/src/pages/ClinicalHistoryPage.jsx`
- [Patient documents](https://github.com/artu2410/agenda-kareh/tree/main/client/src/components/documents): `client/src/components/documents`

### Practice management

- [Cashflow management](https://github.com/artu2410/agenda-kareh/blob/main/client/src/pages/CashflowPage.jsx): `client/src/pages/CashflowPage.jsx`
- [Billing](https://github.com/artu2410/agenda-kareh/blob/main/client/src/features/billing/pages/BillingPage.jsx): `client/src/features/billing/pages/BillingPage.jsx`
- [Capacity metrics](https://github.com/artu2410/agenda-kareh/blob/main/client/src/pages/CapacityPage.jsx): `client/src/pages/CapacityPage.jsx`

### API and domains

- [Appointment endpoints](https://github.com/artu2410/agenda-kareh/blob/main/server/src/routes/appointments.routes.js): `server/src/routes/appointments.routes.js`
- [Appointment operations](https://github.com/artu2410/agenda-kareh/blob/main/server/src/controllers/AppointmentController.js): `server/src/controllers/AppointmentController.js`
- [Scheduling rules](https://github.com/artu2410/agenda-kareh/blob/main/server/src/domain/appointments/scheduling.service.js): `server/src/domain/appointments/scheduling.service.js`
- [History endpoints](https://github.com/artu2410/agenda-kareh/blob/main/server/src/routes/clinicalHistory.routes.js): `server/src/routes/clinicalHistory.routes.js`
- [Patient endpoints](https://github.com/artu2410/agenda-kareh/blob/main/server/src/routes/patient.routes.js): `server/src/routes/patient.routes.js`
- [Capacity analysis](https://github.com/artu2410/agenda-kareh/blob/main/server/src/domain/metrics/capacity.service.js): `server/src/domain/metrics/capacity.service.js`
- [Express application](https://github.com/artu2410/agenda-kareh/blob/main/server/server.js): `server/server.js`

### Identity and infrastructure

- [Authentication bootstrap](https://github.com/artu2410/agenda-kareh/blob/main/client/src/services/authBootstrap.js): `client/src/services/authBootstrap.js`
- [Session management](https://github.com/artu2410/agenda-kareh/blob/main/server/src/utils/sessionManager.js): `server/src/utils/sessionManager.js`
- [Authentication guard](https://github.com/artu2410/agenda-kareh/blob/main/server/src/middlewares/authMiddleware.js): `server/src/middlewares/authMiddleware.js`
- [Upload endpoints](https://github.com/artu2410/agenda-kareh/blob/main/server/src/routes/upload.routes.js): `server/src/routes/upload.routes.js`
- [File storage](https://github.com/artu2410/agenda-kareh/blob/main/server/src/services/storage.js): `server/src/services/storage.js`
- **PostgreSQL**

### Other components

- **Practice staff**

## Connections

- Practice staff → Application shell: uses
- Application shell → Authentication bootstrap: bootstraps session (evidence: `client/src/App.jsx`)
- Application shell → Appointment workflow: routes to (evidence: `client/src/App.jsx`)
- Application shell → Cashflow management: routes to (evidence: `client/src/App.jsx`)
- Application shell → Billing: routes to (evidence: `client/src/App.jsx`)
- Application shell → Capacity metrics: routes to (evidence: `client/src/App.jsx`)
- Appointment workflow → HTTP client: calls (evidence: `client/src/hooks/useAppointmentForm.js`)
- Clinical history → HTTP client: calls (evidence: `client/src/pages/ClinicalHistoryPage.jsx`)
- HTTP client → Express application: sends requests
- Express application → Appointment endpoints: mounts routes (evidence: `server/server.js`)
- Express application → History endpoints: mounts routes (evidence: `server/server.js`)
- Express application → Patient endpoints: mounts routes (evidence: `server/server.js`)
- Appointment endpoints → Authentication guard: guards requests (evidence: `server/src/routes/appointments.routes.js`)
- Appointment endpoints → Appointment operations: dispatches to (evidence: `server/src/routes/appointments.routes.js`)
- Appointment operations → Scheduling rules: uses scheduling (evidence: `server/src/controllers/AppointmentController.js`)
- History endpoints → Authentication guard: checks roles (evidence: `server/src/routes/clinicalHistory.routes.js`)
- History endpoints → PostgreSQL: reads and writes (evidence: `server/src/routes/clinicalHistory.routes.js`)
- Capacity metrics → HTTP client: requests metrics
- Capacity analysis → PostgreSQL: analyzes records
- Authentication bootstrap → HTTP client: restores session (evidence: `client/src/services/authBootstrap.js`)
- Session management → PostgreSQL: persists sessions
- Authentication guard → Session management: validates identity (evidence: `server/src/middlewares/authMiddleware.js`)
- Upload endpoints → File storage: stores uploads (evidence: `server/src/routes/upload.routes.js`)
- File storage → PostgreSQL: stores file metadata
- Patient documents → Clinical history: supports records (evidence: `client/src/pages/ClinicalHistoryPage.jsx`)
