# kacperkicior/healthcare-webapp architecture

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

- Interactive diagram: https://gitdiagram.com/kacperkicior/healthcare-webapp
- Repository: https://github.com/kacperkicior/healthcare-webapp

## Overview

This is a patient appointment and clinic administration web app. Patients register with personal and medical details, then request an appointment; administrators use an OTP-gated dashboard to review requests and schedule or cancel visits, triggering SMS notifications. The graph separates patient intake, appointment handling, and administration, with Appwrite and SMS services as external dependencies. Relationships reflect the supplied source excerpts, SOURCE INDEX references, or README; unsampled internals are not inferred.

Main entry points: [`lib/actions/appointment.actions.ts`](https://github.com/kacperkicior/healthcare-webapp/blob/main/lib/actions/appointment.actions.ts) (Appointment actions), [`app/admin/page.tsx`](https://github.com/kacperkicior/healthcare-webapp/blob/main/app/admin/page.tsx) (Admin dashboard), [`lib/actions/patient.actions.ts`](https://github.com/kacperkicior/healthcare-webapp/blob/main/lib/actions/patient.actions.ts) (Patient actions), [`components/forms/RegisterForm.tsx`](https://github.com/kacperkicior/healthcare-webapp/blob/main/components/forms/RegisterForm.tsx) (Patient registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry points"]
  node_home["Home page<br/>[page.tsx]"]
  node_registration["Registration page<br/>[page.tsx]"]
  node_requestpage["Appointment page<br/>[page.tsx]"]
  node_success["Confirmation page<br/>[page.tsx]"]
  node_adminpage["Admin dashboard<br/>[page.tsx]"]
end

subgraph group_patient["Patient intake"]
  node_registerform["Patient registration<br/>[RegisterForm.tsx]"]
  node_patientform["Patient details<br/>[PatientForm.tsx]"]
  node_patientactions["Patient actions<br/>[patient.actions.ts]"]
  node_fileupload["ID document upload<br/>[FileUploader.tsx]"]
  node_patientsdb[("Patient database")]
  node_validation["Form validation<br/>[validation.ts]"]
end

subgraph group_appointments["Appointments"]
  node_appointmentform["Appointment form"]
  node_appointmentactions["Appointment actions"]
  node_appointmentsdb[("Appointments database")]
end

subgraph group_admin["Administration and UI"]
  node_passkey["OTP gate<br/>[PasskeyModal.tsx]"]
  node_datatable["Appointment table<br/>[DataTable.tsx]"]
  node_columns["Appointment actions UI<br/>[columns.tsx]"]
  node_modal["Schedule or cancel"]
end

node_visitor(("Patient"))
node_staff(("Administrator"))
node_appwrite[("Appwrite services")]
node_sms["SMS notifications"]

node_visitor -->|"opens"| node_home
node_home -->|"renders"| node_patientform
node_home -.->|"opens"| node_passkey
node_visitor -->|"opens"| node_registration
node_registration -->|"renders"| node_registerform
node_registerform -->|"registers patient"| node_patientactions
node_registerform -->|"uses"| node_fileupload
node_registerform -->|"validates with"| node_validation
node_patientform -->|"saves details"| node_patientactions
node_requestpage -->|"renders"| node_patientform
node_requestpage -->|"renders"| node_appointmentform
node_appointmentform -->|"validates with"| node_validation
node_appointmentform -->|"creates or updates"| node_appointmentactions
node_success -->|"loads appointment"| node_appointmentactions
node_staff -->|"opens"| node_adminpage
node_adminpage -.->|"requires OTP"| node_passkey
node_adminpage -->|"loads appointments"| node_appointmentactions
node_adminpage -->|"renders"| node_datatable
node_adminpage -->|"configures"| node_columns
node_columns -->|"opens"| node_modal
node_modal -->|"renders"| node_appointmentform
node_appointmentactions -->|"reads and writes"| node_appointmentsdb
node_patientactions -->|"reads and writes"| node_patientsdb
node_appointmentactions -->|"uses"| node_appwrite
node_patientactions -->|"uses"| node_appwrite
node_appointmentactions -->|"gets patient"| node_patientactions
node_appointmentactions -->|"sends notification"| node_sms

click node_home "https://github.com/kacperkicior/healthcare-webapp/blob/main/app/page.tsx"
click node_registration "https://github.com/kacperkicior/healthcare-webapp/blob/main/app/patients/%5BuserId%5D/register/page.tsx"
click node_requestpage "https://github.com/kacperkicior/healthcare-webapp/blob/main/app/patients/%5BuserId%5D/new-appointment/page.tsx"
click node_success "https://github.com/kacperkicior/healthcare-webapp/blob/main/app/patients/%5BuserId%5D/new-appointment/success/page.tsx"
click node_adminpage "https://github.com/kacperkicior/healthcare-webapp/blob/main/app/admin/page.tsx"
click node_registerform "https://github.com/kacperkicior/healthcare-webapp/blob/main/components/forms/RegisterForm.tsx"
click node_patientform "https://github.com/kacperkicior/healthcare-webapp/blob/main/components/forms/PatientForm.tsx"
click node_patientactions "https://github.com/kacperkicior/healthcare-webapp/blob/main/lib/actions/patient.actions.ts"
click node_fileupload "https://github.com/kacperkicior/healthcare-webapp/blob/main/components/FileUploader.tsx"
click node_appointmentform "https://github.com/kacperkicior/healthcare-webapp/blob/main/components/forms/AppointmentForm.tsx"
click node_appointmentactions "https://github.com/kacperkicior/healthcare-webapp/blob/main/lib/actions/appointment.actions.ts"
click node_passkey "https://github.com/kacperkicior/healthcare-webapp/blob/main/components/PasskeyModal.tsx"
click node_datatable "https://github.com/kacperkicior/healthcare-webapp/blob/main/components/table/DataTable.tsx"
click node_columns "https://github.com/kacperkicior/healthcare-webapp/blob/main/components/table/columns.tsx"
click node_modal "https://github.com/kacperkicior/healthcare-webapp/blob/main/components/AppointmentModal.tsx"
click node_validation "https://github.com/kacperkicior/healthcare-webapp/blob/main/lib/validation.ts"

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_registration,node_requestpage,node_success,node_adminpage toneBlue
class node_registerform,node_patientform,node_patientactions,node_fileupload,node_patientsdb,node_validation,node_appwrite toneAmber
class node_appointmentform,node_appointmentactions,node_appointmentsdb toneMint
class node_passkey,node_datatable,node_columns,node_modal toneRose
class node_visitor,node_staff,node_sms toneIndigo
```

## Components

### Web entry points

- [Home page](https://github.com/kacperkicior/healthcare-webapp/blob/main/app/page.tsx): `app/page.tsx`
- [Registration page](https://github.com/kacperkicior/healthcare-webapp/blob/main/app/patients/%5BuserId%5D/register/page.tsx): `app/patients/[userId]/register/page.tsx`
- [Appointment page](https://github.com/kacperkicior/healthcare-webapp/blob/main/app/patients/%5BuserId%5D/new-appointment/page.tsx): `app/patients/[userId]/new-appointment/page.tsx`
- [Confirmation page](https://github.com/kacperkicior/healthcare-webapp/blob/main/app/patients/%5BuserId%5D/new-appointment/success/page.tsx): `app/patients/[userId]/new-appointment/success/page.tsx`
- [Admin dashboard](https://github.com/kacperkicior/healthcare-webapp/blob/main/app/admin/page.tsx): `app/admin/page.tsx`

### Patient intake

- [Patient registration](https://github.com/kacperkicior/healthcare-webapp/blob/main/components/forms/RegisterForm.tsx): `components/forms/RegisterForm.tsx`
- [Patient details](https://github.com/kacperkicior/healthcare-webapp/blob/main/components/forms/PatientForm.tsx): `components/forms/PatientForm.tsx`
- [Patient actions](https://github.com/kacperkicior/healthcare-webapp/blob/main/lib/actions/patient.actions.ts): `lib/actions/patient.actions.ts`
- [ID document upload](https://github.com/kacperkicior/healthcare-webapp/blob/main/components/FileUploader.tsx): `components/FileUploader.tsx`
- **Patient database**
- [Form validation](https://github.com/kacperkicior/healthcare-webapp/blob/main/lib/validation.ts): `lib/validation.ts`

### Appointments

- [Appointment form](https://github.com/kacperkicior/healthcare-webapp/blob/main/components/forms/AppointmentForm.tsx): `components/forms/AppointmentForm.tsx`
- [Appointment actions](https://github.com/kacperkicior/healthcare-webapp/blob/main/lib/actions/appointment.actions.ts): `lib/actions/appointment.actions.ts`
- **Appointments database**

### Administration and UI

- [OTP gate](https://github.com/kacperkicior/healthcare-webapp/blob/main/components/PasskeyModal.tsx): `components/PasskeyModal.tsx`
- [Appointment table](https://github.com/kacperkicior/healthcare-webapp/blob/main/components/table/DataTable.tsx): `components/table/DataTable.tsx`
- [Appointment actions UI](https://github.com/kacperkicior/healthcare-webapp/blob/main/components/table/columns.tsx): `components/table/columns.tsx`
- [Schedule or cancel](https://github.com/kacperkicior/healthcare-webapp/blob/main/components/AppointmentModal.tsx): `components/AppointmentModal.tsx`

### Other components

- **Patient**
- **Administrator**
- **Appwrite services**
- **SMS notifications**

## Connections

- Patient → Home page: opens (evidence: `app/page.tsx`)
- Home page → Patient details: renders (evidence: `app/page.tsx`)
- Home page → OTP gate: opens (evidence: `app/page.tsx`)
- Patient → Registration page: opens (evidence: `app/patients/[userId]/register/page.tsx`)
- Registration page → Patient registration: renders (evidence: `app/patients/[userId]/register/page.tsx`)
- Patient registration → Patient actions: registers patient (evidence: `components/forms/RegisterForm.tsx`)
- Patient registration → ID document upload: uses (evidence: `components/forms/RegisterForm.tsx`)
- Patient registration → Form validation: validates with (evidence: `lib/validation.ts`)
- Patient details → Patient actions: saves details (evidence: `components/forms/PatientForm.tsx`)
- Appointment page → Patient details: renders (evidence: `app/patients/[userId]/new-appointment/page.tsx`)
- Appointment page → Appointment form: renders (evidence: `app/patients/[userId]/new-appointment/page.tsx`)
- Appointment form → Form validation: validates with (evidence: `components/forms/AppointmentForm.tsx`)
- Appointment form → Appointment actions: creates or updates (evidence: `components/forms/AppointmentForm.tsx`)
- Confirmation page → Appointment actions: loads appointment (evidence: `app/patients/[userId]/new-appointment/success/page.tsx`)
- Administrator → Admin dashboard: opens (evidence: `README.md`)
- Admin dashboard → OTP gate: requires OTP
- Admin dashboard → Appointment actions: loads appointments (evidence: `app/admin/page.tsx`)
- Admin dashboard → Appointment table: renders (evidence: `app/admin/page.tsx`)
- Admin dashboard → Appointment actions UI: configures (evidence: `app/admin/page.tsx`)
- Appointment actions UI → Schedule or cancel: opens (evidence: `components/table/columns.tsx`)
- Schedule or cancel → Appointment form: renders (evidence: `components/AppointmentModal.tsx`)
- Appointment actions → Appointments database: reads and writes (evidence: `lib/actions/appointment.actions.ts`)
- Patient actions → Patient database: reads and writes (evidence: `lib/actions/patient.actions.ts`)
- Appointment actions → Appwrite services: uses (evidence: `lib/actions/appointment.actions.ts`)
- Patient actions → Appwrite services: uses (evidence: `lib/actions/patient.actions.ts`)
- Appointment actions → Patient actions: gets patient (evidence: `lib/actions/appointment.actions.ts`)
- Appointment actions → SMS notifications: sends notification (evidence: `lib/actions/appointment.actions.ts`)
