# mohamad8alkhatib/med-clinic architecture

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

- Interactive diagram: https://gitdiagram.com/mohamad8alkhatib/med-clinic
- Repository: https://github.com/mohamad8alkhatib/med-clinic

## Overview

This is a Laravel clinic appointment application. Patients browse active doctors and book or cancel appointments; doctors review appointments and manage their status; administrators manage doctors and specialties and view reports. Authentication and role-based access support these workflows. The graph emphasizes sampled controller/model behavior; some routes and screens are represented by directory paths because their implementation was not sampled, so those connections are dashed and unverified.

Main entry points: [`app/Models/Doctor.php`](https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Models/Doctor.php) (Doctor records), [`app/Models/Appointment.php`](https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Models/Appointment.php) (Appointments), [`app/Models/User.php`](https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Models/User.php) (User accounts), [`app/Http/Controllers/Admin`](https://github.com/mohamad8alkhatib/med-clinic/tree/main/app/Http/Controllers/Admin) (Doctor and specialty administration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and identity"]
  node_auth["Authentication"]
  node_login_request["Login validation<br/>[LoginRequest.php]"]
  node_role_middleware["Role access control<br/>[RoleMiddleware.php]"]
  node_profile["Profile management"]
end

subgraph group_appointments["Appointment workflows"]
  node_patient_booking["Patient booking"]
  node_doctor_management["Doctor appointment management"]
  node_appointment_views["Appointment screens"]
  node_doctor_dashboard["Doctor dashboard"]
end

subgraph group_clinic["Clinic administration"]
  node_admin_management["Doctor and specialty administration"]
  node_admin_views["Admin screens and reports"]
end

subgraph group_domain["Domain and data"]
  node_user[("User accounts<br/>[User.php]")]
  node_doctor[("Doctor records<br/>[Doctor.php]")]
  node_specialty[("Specialties<br/>[Specialty.php]")]
  node_schedule[("Doctor schedules<br/>[DoctorSchedule.php]")]
  node_appointment[("Appointments<br/>[Appointment.php]")]
  node_seeders["Sample data seeding<br/>[DatabaseSeeder.php]"]
  node_patient_factory["Patient factory<br/>[PatientFactory.php]"]
end

node_patient(("Patient"))
node_doctor_actor(("Doctor"))
node_admin_actor(("Administrator"))

node_patient -.->|"books or cancels"| node_patient_booking
node_patient_booking -->|"creates and reads"| node_appointment
node_patient_booking -->|"checks availability"| node_doctor
node_patient_booking -->|"renders"| node_appointment_views
node_doctor_actor -.->|"manages appointments"| node_doctor_management
node_doctor_management -->|"reads and updates"| node_appointment
node_doctor_management -->|"renders"| node_doctor_dashboard
node_admin_actor -.->|"administers clinic"| node_admin_management
node_admin_management -->|"manages"| node_doctor
node_admin_management -->|"manages"| node_specialty
node_admin_management -->|"creates and updates"| node_user
node_admin_management -->|"reports on"| node_appointment
node_admin_management -.->|"renders"| node_admin_views
node_auth -->|"authenticates with"| node_login_request
node_auth -->|"registers users"| node_user
node_auth -->|"auth routes target"| node_user
node_profile -->|"updates account"| node_user
node_user -->|"has doctor profile"| node_doctor
node_user -->|"has patient appointments"| node_appointment
node_doctor -->|"belongs to"| node_specialty
node_doctor -->|"has schedules"| node_schedule
node_doctor -->|"has appointments"| node_appointment
node_appointment -->|"belongs to patient"| node_user
node_appointment -->|"belongs to doctor"| node_doctor
node_seeders -->|"seeds sample records"| node_appointment
node_seeders -->|"seeds sample records"| node_doctor
node_seeders -->|"seeds sample records"| node_specialty
node_seeders -->|"calls patient seeder"| node_patient_factory

click node_auth "https://github.com/mohamad8alkhatib/med-clinic/tree/main/app/Http/Controllers/Auth"
click node_login_request "https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Http/Requests/Auth/LoginRequest.php"
click node_role_middleware "https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Http/Middleware/RoleMiddleware.php"
click node_patient_booking "https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Http/Controllers/Patient/PatientController.php"
click node_doctor_management "https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Http/Controllers/Doctor/DoctorManagerController.php"
click node_appointment_views "https://github.com/mohamad8alkhatib/med-clinic/tree/main/resources/views/patient/appointments"
click node_doctor_dashboard "https://github.com/mohamad8alkhatib/med-clinic/blob/main/resources/views/doctor/dashboard.blade.php"
click node_admin_management "https://github.com/mohamad8alkhatib/med-clinic/tree/main/app/Http/Controllers/Admin"
click node_admin_views "https://github.com/mohamad8alkhatib/med-clinic/tree/main/resources/views/admin"
click node_profile "https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Http/Controllers/ProfileController.php"
click node_user "https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Models/User.php"
click node_doctor "https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Models/Doctor.php"
click node_specialty "https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Models/Specialty.php"
click node_schedule "https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Models/DoctorSchedule.php"
click node_appointment "https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Models/Appointment.php"
click node_seeders "https://github.com/mohamad8alkhatib/med-clinic/blob/main/database/seeders/DatabaseSeeder.php"
click node_patient_factory "https://github.com/mohamad8alkhatib/med-clinic/blob/main/database/factories/PatientFactory.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_auth,node_login_request,node_role_middleware,node_profile toneBlue
class node_patient_booking,node_doctor_management,node_appointment_views,node_doctor_dashboard toneAmber
class node_admin_management,node_admin_views toneMint
class node_user,node_doctor,node_specialty,node_schedule,node_appointment,node_seeders,node_patient_factory toneRose
class node_patient,node_doctor_actor,node_admin_actor toneIndigo
```

## Components

### Access and identity

- [Authentication](https://github.com/mohamad8alkhatib/med-clinic/tree/main/app/Http/Controllers/Auth): `app/Http/Controllers/Auth`
- [Login validation](https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Http/Requests/Auth/LoginRequest.php): `app/Http/Requests/Auth/LoginRequest.php`
- [Role access control](https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Http/Middleware/RoleMiddleware.php): `app/Http/Middleware/RoleMiddleware.php`
- [Profile management](https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Http/Controllers/ProfileController.php): `app/Http/Controllers/ProfileController.php`

### Appointment workflows

- [Patient booking](https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Http/Controllers/Patient/PatientController.php): `app/Http/Controllers/Patient/PatientController.php`
- [Doctor appointment management](https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Http/Controllers/Doctor/DoctorManagerController.php): `app/Http/Controllers/Doctor/DoctorManagerController.php`
- [Appointment screens](https://github.com/mohamad8alkhatib/med-clinic/tree/main/resources/views/patient/appointments): `resources/views/patient/appointments`
- [Doctor dashboard](https://github.com/mohamad8alkhatib/med-clinic/blob/main/resources/views/doctor/dashboard.blade.php): `resources/views/doctor/dashboard.blade.php`

### Clinic administration

- [Doctor and specialty administration](https://github.com/mohamad8alkhatib/med-clinic/tree/main/app/Http/Controllers/Admin): `app/Http/Controllers/Admin`
- [Admin screens and reports](https://github.com/mohamad8alkhatib/med-clinic/tree/main/resources/views/admin): `resources/views/admin`

### Domain and data

- [User accounts](https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Models/User.php): `app/Models/User.php`
- [Doctor records](https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Models/Doctor.php): `app/Models/Doctor.php`
- [Specialties](https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Models/Specialty.php): `app/Models/Specialty.php`
- [Doctor schedules](https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Models/DoctorSchedule.php): `app/Models/DoctorSchedule.php`
- [Appointments](https://github.com/mohamad8alkhatib/med-clinic/blob/main/app/Models/Appointment.php): `app/Models/Appointment.php`
- [Sample data seeding](https://github.com/mohamad8alkhatib/med-clinic/blob/main/database/seeders/DatabaseSeeder.php): `database/seeders/DatabaseSeeder.php`
- [Patient factory](https://github.com/mohamad8alkhatib/med-clinic/blob/main/database/factories/PatientFactory.php): `database/factories/PatientFactory.php`

### Other components

- **Patient**
- **Doctor**
- **Administrator**

## Connections

- Patient → Patient booking: books or cancels
- Patient booking → Appointments: creates and reads (evidence: `app/Http/Controllers/Patient/PatientController.php`)
- Patient booking → Doctor records: checks availability (evidence: `app/Http/Controllers/Patient/PatientController.php`)
- Patient booking → Appointment screens: renders (evidence: `app/Http/Controllers/Patient/PatientController.php`)
- Doctor → Doctor appointment management: manages appointments
- Doctor appointment management → Appointments: reads and updates (evidence: `app/Http/Controllers/Doctor/DoctorManagerController.php`)
- Doctor appointment management → Doctor dashboard: renders (evidence: `app/Http/Controllers/Doctor/DoctorManagerController.php`)
- Administrator → Doctor and specialty administration: administers clinic
- Doctor and specialty administration → Doctor records: manages (evidence: `app/Http/Controllers/Admin/DoctorController.php`)
- Doctor and specialty administration → Specialties: manages (evidence: `app/Http/Controllers/Admin/SpecialtyController.php`)
- Doctor and specialty administration → User accounts: creates and updates (evidence: `app/Http/Controllers/Admin/DoctorController.php`)
- Doctor and specialty administration → Appointments: reports on (evidence: `app/Http/Controllers/Admin/AdminController.php`)
- Doctor and specialty administration → Admin screens and reports: renders
- Authentication → Login validation: authenticates with (evidence: `app/Http/Controllers/Auth/AuthenticatedSessionController.php`)
- Authentication → User accounts: registers users (evidence: `app/Http/Controllers/Auth/RegisteredUserController.php`)
- Authentication → User accounts: auth routes target (evidence: `app/Http/Controllers/Auth/RegisteredUserController.php`)
- Profile management → User accounts: updates account
- User accounts → Doctor records: has doctor profile (evidence: `app/Models/User.php`)
- User accounts → Appointments: has patient appointments (evidence: `app/Models/User.php`)
- Doctor records → Specialties: belongs to (evidence: `app/Models/Doctor.php`)
- Doctor records → Doctor schedules: has schedules (evidence: `app/Models/Doctor.php`)
- Doctor records → Appointments: has appointments (evidence: `app/Models/Doctor.php`)
- Appointments → User accounts: belongs to patient (evidence: `app/Models/Appointment.php`)
- Appointments → Doctor records: belongs to doctor (evidence: `app/Models/Appointment.php`)
- Sample data seeding → Appointments: seeds sample records
- Sample data seeding → Doctor records: seeds sample records
- Sample data seeding → Specialties: seeds sample records
- Sample data seeding → Patient factory: calls patient seeder (evidence: `database/seeders/DatabaseSeeder.php`)
