# luigicarl/klinika-web architecture

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

- Interactive diagram: https://gitdiagram.com/luigicarl/klinika-web
- Repository: https://github.com/luigicarl/klinika-web

## Overview

Klinikaly is a Laravel clinic-operations application centered on safe appointment booking: patients find doctors and request a slot; the system checks availability, reserves time, and creates a pending appointment for staff review. Receptionists manage the appointment lifecycle and triage queue; administrators manage doctors, schedules, settings, analytics, and audits. The booking service, availability checks, and reservation records form the key internal integrity layer. The README documents major UI capabilities whose component-level wiring is not shown in the excerpts, so those links are cited to the README rather than inferred from unsampled code.

Main entry points: [`app/Services/BookingService.php`](https://github.com/luigicarl/klinika-web/blob/main/app/Services/BookingService.php) (Booking engine), [`resources/views/pages/admin/⚡dashboard.blade.php`](https://github.com/luigicarl/klinika-web/blob/main/resources/views/pages/admin/%E2%9A%A1dashboard.blade.php) (Admin operations), [`app/Mail/AppointmentRequested.php`](https://github.com/luigicarl/klinika-web/blob/main/app/Mail/AppointmentRequested.php) (Appointment email), [`resources/views/pages/receptionist/⚡pending.blade.php`](https://github.com/luigicarl/klinika-web/blob/main/resources/views/pages/receptionist/%E2%9A%A1pending.blade.php) (Reception triage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web and access"]
  node_web_routes["Web routes<br/>[web.php]"]
  node_demo_login["Demo access"]
  node_user["Accounts and roles<br/>[User.php]"]
end

subgraph group_booking["Patient booking"]
  node_views_patient["Patient booking UI<br/>[⚡book.blade.php]"]
  node_directory["Doctor directory<br/>[⚡index.blade.php]"]
  node_booking_service["Booking engine<br/>[BookingService.php]"]
  node_availability["Availability checks"]
  node_rate_limit["Booking rate limit"]
  node_conflict["Booking conflict"]
end

subgraph group_operations["Clinic operations"]
  node_reception["Reception triage<br/>[⚡pending.blade.php]"]
  node_schedules["Doctor schedules"]
  node_admin["Admin operations"]
  node_analytics["Clinic analytics"]
  node_audits[("Audit history")]
end

subgraph group_domain["Appointment domain"]
  node_reservation[("Slot reservations")]
  node_appointment[("Appointment records<br/>[Appointment.php]")]
  node_status["Lifecycle states"]
  node_transition["Lifecycle transitions"]
  node_reschedule["Rescheduling"]
  node_models[("Clinic domain models")]
end

subgraph group_messaging["Notifications"]
  node_mail["Appointment email"]
  node_reminders["Scheduled reminders"]
  node_calendar["Calendar invites<br/>[IcsGenerator.php]"]
end

node_browser(("Clinic users"))

node_browser -->|"opens app"| node_web_routes
node_web_routes -->|"routes demo login"| node_demo_login
node_demo_login -->|"resolves account"| node_user
node_browser -->|"searches doctors"| node_directory
node_directory -.->|"starts booking"| node_views_patient
node_browser -->|"selects slot"| node_views_patient
node_views_patient -.->|"requests appointment"| node_booking_service
node_booking_service -->|"checks bookability"| node_availability
node_booking_service -->|"checks rate limit"| node_rate_limit
node_booking_service -->|"creates reservations"| node_reservation
node_booking_service -->|"creates appointment"| node_appointment
node_booking_service -->|"translates conflicts"| node_conflict
node_booking_service -->|"sends request email"| node_mail
node_booking_service -->|"sets pending state"| node_status
node_appointment -->|"records domain relations"| node_models
node_browser -->|"triages queue"| node_reception
node_reception -.->|"manages lifecycle"| node_transition
node_reception -.->|"reschedules bookings"| node_reschedule
node_browser -->|"manages clinic"| node_admin
node_admin -.->|"updates schedules"| node_schedules
node_admin -->|"views metrics"| node_analytics
node_admin -->|"reviews audit history"| node_audits
node_transition -->|"updates status"| node_appointment
node_transition -->|"notifies parties"| node_mail
node_schedules -->|"writes audit"| node_audits
node_reminders -.->|"sends reminders"| node_mail
node_mail -->|"attaches invite"| node_calendar

click node_web_routes "https://github.com/luigicarl/klinika-web/blob/main/routes/web.php"
click node_demo_login "https://github.com/luigicarl/klinika-web/blob/main/app/Http/Controllers/Auth/DemoLoginController.php"
click node_user "https://github.com/luigicarl/klinika-web/blob/main/app/Models/User.php"
click node_views_patient "https://github.com/luigicarl/klinika-web/blob/main/resources/views/pages/patient/%E2%9A%A1book.blade.php"
click node_directory "https://github.com/luigicarl/klinika-web/blob/main/resources/views/pages/doctors/%E2%9A%A1index.blade.php"
click node_booking_service "https://github.com/luigicarl/klinika-web/blob/main/app/Services/BookingService.php"
click node_availability "https://github.com/luigicarl/klinika-web/blob/main/app/Services/AvailabilityService.php"
click node_rate_limit "https://github.com/luigicarl/klinika-web/blob/main/app/Services/UserActionRateLimiter.php"
click node_reservation "https://github.com/luigicarl/klinika-web/blob/main/app/Models/DoctorSlotReservation.php"
click node_appointment "https://github.com/luigicarl/klinika-web/blob/main/app/Models/Appointment.php"
click node_status "https://github.com/luigicarl/klinika-web/blob/main/app/AppointmentStatus.php"
click node_transition "https://github.com/luigicarl/klinika-web/blob/main/app/Services/AppointmentTransitionService.php"
click node_reschedule "https://github.com/luigicarl/klinika-web/blob/main/app/Services/AppointmentRescheduleService.php"
click node_reception "https://github.com/luigicarl/klinika-web/blob/main/resources/views/pages/receptionist/%E2%9A%A1pending.blade.php"
click node_schedules "https://github.com/luigicarl/klinika-web/blob/main/app/Services/DoctorScheduleService.php"
click node_admin "https://github.com/luigicarl/klinika-web/blob/main/resources/views/pages/admin/%E2%9A%A1dashboard.blade.php"
click node_analytics "https://github.com/luigicarl/klinika-web/blob/main/resources/views/pages/admin/%E2%9A%A1analytics.blade.php"
click node_audits "https://github.com/luigicarl/klinika-web/blob/main/app/Models/AdministrativeAudit.php"
click node_models "https://github.com/luigicarl/klinika-web/tree/main/app/Models"
click node_mail "https://github.com/luigicarl/klinika-web/blob/main/app/Mail/AppointmentRequested.php"
click node_reminders "https://github.com/luigicarl/klinika-web/blob/main/app/Console/Commands/SendAppointmentReminders.php"
click node_calendar "https://github.com/luigicarl/klinika-web/blob/main/app/Services/IcsGenerator.php"
click node_conflict "https://github.com/luigicarl/klinika-web/blob/main/app/Exceptions/BookingConflictException.php"

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_web_routes,node_demo_login,node_user,node_browser toneBlue
class node_views_patient,node_directory,node_booking_service,node_availability,node_rate_limit,node_conflict toneAmber
class node_reception,node_schedules,node_admin,node_analytics,node_audits toneMint
class node_reservation,node_appointment,node_status,node_transition,node_reschedule,node_models toneRose
class node_mail,node_reminders,node_calendar toneIndigo
```

## Components

### Web and access

- [Web routes](https://github.com/luigicarl/klinika-web/blob/main/routes/web.php): `routes/web.php`
- [Demo access](https://github.com/luigicarl/klinika-web/blob/main/app/Http/Controllers/Auth/DemoLoginController.php): `app/Http/Controllers/Auth/DemoLoginController.php`
- [Accounts and roles](https://github.com/luigicarl/klinika-web/blob/main/app/Models/User.php): `app/Models/User.php`

### Patient booking

- [Patient booking UI](https://github.com/luigicarl/klinika-web/blob/main/resources/views/pages/patient/%E2%9A%A1book.blade.php): `resources/views/pages/patient/⚡book.blade.php`
- [Doctor directory](https://github.com/luigicarl/klinika-web/blob/main/resources/views/pages/doctors/%E2%9A%A1index.blade.php): `resources/views/pages/doctors/⚡index.blade.php`
- [Booking engine](https://github.com/luigicarl/klinika-web/blob/main/app/Services/BookingService.php): `app/Services/BookingService.php`
- [Availability checks](https://github.com/luigicarl/klinika-web/blob/main/app/Services/AvailabilityService.php): `app/Services/AvailabilityService.php`
- [Booking rate limit](https://github.com/luigicarl/klinika-web/blob/main/app/Services/UserActionRateLimiter.php): `app/Services/UserActionRateLimiter.php`
- [Booking conflict](https://github.com/luigicarl/klinika-web/blob/main/app/Exceptions/BookingConflictException.php): `app/Exceptions/BookingConflictException.php`

### Clinic operations

- [Reception triage](https://github.com/luigicarl/klinika-web/blob/main/resources/views/pages/receptionist/%E2%9A%A1pending.blade.php): `resources/views/pages/receptionist/⚡pending.blade.php`
- [Doctor schedules](https://github.com/luigicarl/klinika-web/blob/main/app/Services/DoctorScheduleService.php): `app/Services/DoctorScheduleService.php`
- [Admin operations](https://github.com/luigicarl/klinika-web/blob/main/resources/views/pages/admin/%E2%9A%A1dashboard.blade.php): `resources/views/pages/admin/⚡dashboard.blade.php`
- [Clinic analytics](https://github.com/luigicarl/klinika-web/blob/main/resources/views/pages/admin/%E2%9A%A1analytics.blade.php): `resources/views/pages/admin/⚡analytics.blade.php`
- [Audit history](https://github.com/luigicarl/klinika-web/blob/main/app/Models/AdministrativeAudit.php): `app/Models/AdministrativeAudit.php`

### Appointment domain

- [Slot reservations](https://github.com/luigicarl/klinika-web/blob/main/app/Models/DoctorSlotReservation.php): `app/Models/DoctorSlotReservation.php`
- [Appointment records](https://github.com/luigicarl/klinika-web/blob/main/app/Models/Appointment.php): `app/Models/Appointment.php`
- [Lifecycle states](https://github.com/luigicarl/klinika-web/blob/main/app/AppointmentStatus.php): `app/AppointmentStatus.php`
- [Lifecycle transitions](https://github.com/luigicarl/klinika-web/blob/main/app/Services/AppointmentTransitionService.php): `app/Services/AppointmentTransitionService.php`
- [Rescheduling](https://github.com/luigicarl/klinika-web/blob/main/app/Services/AppointmentRescheduleService.php): `app/Services/AppointmentRescheduleService.php`
- [Clinic domain models](https://github.com/luigicarl/klinika-web/tree/main/app/Models): `app/Models`

### Notifications

- [Appointment email](https://github.com/luigicarl/klinika-web/blob/main/app/Mail/AppointmentRequested.php): `app/Mail/AppointmentRequested.php`
- [Scheduled reminders](https://github.com/luigicarl/klinika-web/blob/main/app/Console/Commands/SendAppointmentReminders.php): `app/Console/Commands/SendAppointmentReminders.php`
- [Calendar invites](https://github.com/luigicarl/klinika-web/blob/main/app/Services/IcsGenerator.php): `app/Services/IcsGenerator.php`

### Other components

- **Clinic users**

## Connections

- Clinic users → Web routes: opens app (evidence: `README.md`)
- Web routes → Demo access: routes demo login (evidence: `routes/web.php`)
- Demo access → Accounts and roles: resolves account (evidence: `app/Http/Controllers/Auth/DemoLoginController.php`)
- Clinic users → Doctor directory: searches doctors (evidence: `README.md`)
- Doctor directory → Patient booking UI: starts booking
- Clinic users → Patient booking UI: selects slot (evidence: `README.md`)
- Patient booking UI → Booking engine: requests appointment
- Booking engine → Availability checks: checks bookability (evidence: `app/Services/BookingService.php`)
- Booking engine → Booking rate limit: checks rate limit (evidence: `app/Services/BookingService.php`)
- Booking engine → Slot reservations: creates reservations (evidence: `app/Services/BookingService.php`)
- Booking engine → Appointment records: creates appointment (evidence: `app/Services/BookingService.php`)
- Booking engine → Booking conflict: translates conflicts (evidence: `app/Services/BookingService.php`)
- Booking engine → Appointment email: sends request email (evidence: `app/Services/BookingService.php`)
- Booking engine → Lifecycle states: sets pending state (evidence: `app/Services/BookingService.php`)
- Appointment records → Clinic domain models: records domain relations (evidence: `app/Models/Appointment.php`)
- Clinic users → Reception triage: triages queue (evidence: `README.md`)
- Reception triage → Lifecycle transitions: manages lifecycle
- Reception triage → Rescheduling: reschedules bookings
- Clinic users → Admin operations: manages clinic (evidence: `README.md`)
- Admin operations → Doctor schedules: updates schedules
- Admin operations → Clinic analytics: views metrics (evidence: `README.md`)
- Admin operations → Audit history: reviews audit history (evidence: `README.md`)
- Lifecycle transitions → Appointment records: updates status (evidence: `app/Services/AppointmentTransitionService.php`)
- Lifecycle transitions → Appointment email: notifies parties (evidence: `app/Services/AppointmentTransitionService.php`)
- Doctor schedules → Audit history: writes audit (evidence: `app/Services/DoctorScheduleService.php`)
- Scheduled reminders → Appointment email: sends reminders
- Appointment email → Calendar invites: attaches invite
