# ayaennaani-cmyk/auto-ecole-app-stage architecture

> Architecture diagram of the GitHub repository ayaennaani-cmyk/auto-ecole-app-stage, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ayaennaani-cmyk/auto-ecole-app-stage
- Repository: https://github.com/ayaennaani-cmyk/auto-ecole-app-stage

## Overview

This is a single Laravel 11 monolith for driving-school operations, with a Blade/Tailwind/Alpine frontend and a MySQL-backed domain model. The app is organized around four operational roles: administrator, assistante, moniteur, and candidat.

1. Core application boundary  
The backend is a standard Laravel HTTP application: requests enter through `public/index.php`, are routed via `routes/web.php` and `routes/auth.php`, then handled by feature controllers in `app/Http/Controllers`. The UI is server-rendered with Blade views in `resources/views`.

2. Authentication and account lifecycle  
Authentication is built with the Laravel Breeze-style stack. The `Auth` controllers cover login, registration, password reset, password confirmation, and email verification. `LoginRequest` and the profile request classes handle validation, while auth views live under `resources/views/auth`. A login notification email is also part of the flow.

3. Role-based access control  
The project uses a dedicated role model in `app/Enums/UserRole.php`, a custom `CheckRole` middleware, and policies for sensitive resources (`PaiementPolicy`, `ReservationPolicy`, `UserPolicy`). This forms the main security boundary: users are authenticated first, then authorized by role and policy before reaching admin, staff, or candidate features.

4. Main domain entities  
The domain is centered on driving-school operations:
- `User` for all authenticated accounts
- `Candidat` and `Moniteur` as role-specific profiles
- `Formation` for training programs/pricing
- `Seance` for driving sessions
- `Reservation` for session booking
- `Paiement` for payments and invoices
- `ResultatExamen` for exam outcomes
- `Message` for contact/admin communication

These models are persisted in separate migrations, which indicates a normalized relational schema rather than a document or event-based design.

5. Role-specific workflows  
Each role has its own dashboard and controller set. The admin can manage users, formations, and reporting. The assistante handles scheduling, reservations, and payment tracking. The moniteur views assigned sessions and candidate lists. The candidat books sessions, follows payments, and checks progress. The dashboard views are split accordingly under `resources/views/dashboard/*`.

6. Reservation and planning flow  
A key business flow is the scheduling pipeline: sessions are created and managed by staff, candidates reserve available sessions, and reservations are validated/monitored by admin or assistante. `SeanceController` and `ReservationController` are the main orchestration points, with separate admin-oriented and candidate-oriented views showing that the same data is presented differently by role.

7. Payment and billing flow  
Payments are a separate subsystem with their own controller, policy, form views, success view, and invoice/PDF templates. The presence of `facture.blade.php` and `pdf.blade.php` suggests billing output is generated from server-side views. Candidates have a dedicated payment index, while staff likely manage or verify payment records.

8. Public-facing and contact surfaces  
The app includes public pages such as `welcome`, `apropos`, and `contact`, handled by `PublicController` and `ContactController`. This is the external entry point for anonymous visitors before authentication, distinct from the authenticated dashboard area.

9. Reporting and export subsystem  
Several modules include PDF views: users, sessions, payments, and formations. This indicates a reporting/export layer built from Blade templates rather than a separate reporting service. The admin experience likely depends on these exports for operational summaries and printable records.

10. Mail and notification boundary  
There is a dedicated mail class for login notifications. This means the app emits transactional email as part of user activity, probably after authentication or account-related events. Mail transport settings are isolated in `config/mail.php`, so email is an external integration point, not embedded in domain logic.

11. Frontend and asset pipeline  
The UI is traditional Blade rendering enhanced by Tailwind CSS and Alpine.js, with assets managed through Vite. The frontend is not a SPA; it is a multi-page server-rendered app with reusable Blade components and layout shells for app, guest, and public views.

12. Seeded operational data and setup  
The repository includes migrations, seeders for formations and sessions, and a helper script `create_db.php`. This suggests the application expects prepopulated operational data for local/demo use, especially the role-based dashboards and test accounts listed in the README.

Overall architecture: a layered Laravel MVC application with role-aware access control, a shared relational domain model, server-rendered dashboards, and auxiliary flows for booking, payment, email, and PDF generation.

Main entry points: [`app/Http/Controllers/UserController.php`](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Http/Controllers/UserController.php) (Ops controllers), [`routes/web.php`](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/routes/web.php) (Web routes), [`app/Models/User.php`](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Models/User.php) (User), [`app/Models/Seance.php`](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Models/Seance.php) (Operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_http["HTTP & UI"]
  node_n_public_index["Entry point<br/>Laravel front controller<br/>[index.php]"]
  node_n_routes_web["Web routes<br/>route definitions<br/>[web.php]"]
  node_n_public_controllers["Public pages<br/>controllers"]
  node_n_dashboard_controller["Dashboard<br/>controller"]
  node_n_core_controllers["Ops controllers<br/>[UserController.php]"]
  node_n_views_dashboard["Role dashboards<br/>views<br/>[admin.blade.php]"]
  node_n_views_business["Business views<br/>[index.blade.php]"]
  node_n_views_auth_public["Auth & public UI<br/>views<br/>[welcome.blade.php]"]
  node_n_frontend["Frontend stack<br/>Blade/Tailwind/Alpine<br/>[app.js]"]
end

subgraph group_grp_domain["Domain"]
  node_n_models_user[("User<br/>auth model<br/>[User.php]")]
  node_n_models_profiles[("Profiles<br/>domain models<br/>[Candidat.php]")]
  node_n_models_formation[("Formation<br/>training model<br/>[Formation.php]")]
  node_n_models_ops[("Operations<br/>domain models<br/>[Seance.php]")]
end

subgraph group_grp_security["Security"]
  node_n_routes_auth["Auth routes<br/>[auth.php]"]
  node_n_auth_controllers["Auth flow<br/>controllers"]
  node_n_check_role{{"Role gate<br/>middleware<br/>[CheckRole.php]"}}
  node_n_user_role(("User roles<br/>enum<br/>[UserRole.php]"))
  node_n_policies{{"Policies<br/>authorization<br/>[PaiementPolicy.php]"}}
  node_n_mail["Login mail"]
end

subgraph group_grp_data["Data & Ops"]
  node_n_migrations["Schema<br/>migrations"]
  node_n_seeders["Seed data<br/>seeders<br/>[DatabaseSeeder.php]"]
end

node_n_public_index -->|"dispatches"| node_n_routes_web
node_n_routes_web -->|"public pages"| node_n_public_controllers
node_n_routes_web -->|"dashboards"| node_n_dashboard_controller
node_n_routes_web -->|"features"| node_n_core_controllers
node_n_routes_web -->|"protects"| node_n_check_role
node_n_routes_auth -->|"auth actions"| node_n_auth_controllers
node_n_auth_controllers -->|"authenticates"| node_n_models_user
node_n_auth_controllers -->|"notifies"| node_n_mail
node_n_check_role -->|"uses"| node_n_user_role
node_n_policies -->|"authorizes"| node_n_models_user
node_n_policies -->|"authorizes"| node_n_models_ops
node_n_core_controllers -->|"manages"| node_n_models_user
node_n_core_controllers -->|"uses"| node_n_models_profiles
node_n_core_controllers -->|"manages"| node_n_models_formation
node_n_core_controllers -->|"orchestrates"| node_n_models_ops
node_n_core_controllers -->|"checks"| node_n_policies
node_n_models_user -->|"schema"| node_n_migrations
node_n_models_profiles -->|"schema"| node_n_migrations
node_n_models_formation -->|"schema"| node_n_migrations
node_n_models_ops -->|"schema"| node_n_migrations
node_n_seeders -->|"seeds"| node_n_models_formation
node_n_seeders -->|"seeds"| node_n_models_ops
node_n_views_auth_public -->|"renders with"| node_n_frontend
node_n_views_dashboard -->|"renders with"| node_n_frontend
node_n_views_business -->|"renders with"| node_n_frontend
node_n_public_controllers -->|"returns"| node_n_views_auth_public
node_n_dashboard_controller -->|"returns"| node_n_views_dashboard
node_n_core_controllers -->|"returns"| node_n_views_business

click node_n_public_index "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/public/index.php"
click node_n_routes_web "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/routes/web.php"
click node_n_routes_auth "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/routes/auth.php"
click node_n_public_controllers "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Http/Controllers/PublicController.php"
click node_n_auth_controllers "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php"
click node_n_dashboard_controller "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Http/Controllers/DashboardController.php"
click node_n_core_controllers "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Http/Controllers/UserController.php"
click node_n_check_role "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Http/Middleware/CheckRole.php"
click node_n_user_role "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Enums/UserRole.php"
click node_n_policies "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Policies/PaiementPolicy.php"
click node_n_models_user "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Models/User.php"
click node_n_models_profiles "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Models/Candidat.php"
click node_n_models_formation "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Models/Formation.php"
click node_n_models_ops "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Models/Seance.php"
click node_n_mail "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Mail/LoginNotificationMail.php"
click node_n_views_dashboard "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/resources/views/dashboard/admin.blade.php"
click node_n_views_business "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/resources/views/paiements/index.blade.php"
click node_n_views_auth_public "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/resources/views/welcome.blade.php"
click node_n_migrations "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/database/migrations/0001_01_01_000000_create_users_table.php"
click node_n_seeders "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/database/seeders/DatabaseSeeder.php"
click node_n_frontend "https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/resources/js/app.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_n_public_index,node_n_routes_web,node_n_public_controllers,node_n_dashboard_controller,node_n_core_controllers,node_n_views_dashboard,node_n_views_business,node_n_views_auth_public,node_n_frontend toneBlue
class node_n_models_user,node_n_models_profiles,node_n_models_formation,node_n_models_ops toneAmber
class node_n_routes_auth,node_n_auth_controllers,node_n_check_role,node_n_user_role,node_n_policies,node_n_mail toneMint
class node_n_migrations,node_n_seeders toneRose
```

## Components

### HTTP & UI

Laravel entrypoints, routing, controllers, views, and frontend assets.

- [Entry point](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/public/index.php): Laravel front controller · Web server entry into the Laravel application. · `public/index.php`
- [Web routes](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/routes/web.php): route definitions · Authenticated and public browser routes. · `routes/web.php`
- [Public pages](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Http/Controllers/PublicController.php): controllers · Public-facing pages and contact handling. · `app/Http/Controllers/PublicController.php`
- [Dashboard](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Http/Controllers/DashboardController.php): controller · Role-aware dashboard entry and summaries. · `app/Http/Controllers/DashboardController.php`
- [Ops controllers](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Http/Controllers/UserController.php): controllers · Main feature controllers for users, formations, sessions, reservations, payments, exams, and messages. · `app/Http/Controllers/UserController.php`
- [Role dashboards](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/resources/views/dashboard/admin.blade.php): views · Admin, assistante, moniteur, and candidat dashboard views. · `resources/views/dashboard/admin.blade.php`
- [Business views](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/resources/views/paiements/index.blade.php): views · Blade screens for formations, reservations, payments, sessions, users, and messages. · `resources/views/paiements/index.blade.php`
- [Auth & public UI](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/resources/views/welcome.blade.php): views · Guest, auth, layout, and public-facing Blade views. · `resources/views/welcome.blade.php`
- [Frontend stack](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/resources/js/app.js): Blade/Tailwind/Alpine · Server-rendered UI styling and interactivity pipeline. · `resources/js/app.js`

### Domain

Core driving-school entities and business rules.

- [User](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Models/User.php): auth model · Authenticated account record. · `app/Models/User.php`
- [Profiles](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Models/Candidat.php): domain models · Role-specific identity records for candidates and instructors. · `app/Models/Candidat.php`
- [Formation](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Models/Formation.php): training model · Training programs and pricing. · `app/Models/Formation.php`
- [Operations](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Models/Seance.php): domain models · Scheduling, booking, payment, exam, and message records. · `app/Models/Seance.php`

### Security

Authentication, roles, middleware, policies, and notifications.

- [Auth routes](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/routes/auth.php): auth routes · Login, registration, reset, and verification routes. · `routes/auth.php`
- [Auth flow](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php): controllers · Login, registration, password reset, and email verification. · `app/Http/Controllers/Auth/AuthenticatedSessionController.php`
- [Role gate](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Http/Middleware/CheckRole.php): middleware · Custom middleware enforcing role-based access. · `app/Http/Middleware/CheckRole.php`
- [User roles](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Enums/UserRole.php): enum · Application role model for administrator, assistante, moniteur, and candidat. · `app/Enums/UserRole.php`
- [Policies](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Policies/PaiementPolicy.php): authorization · Resource-level authorization for users, reservations, and payments. · `app/Policies/PaiementPolicy.php`
- [Login mail](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/app/Mail/LoginNotificationMail.php): mail · Transactional notification sent during login or account activity. · `app/Mail/LoginNotificationMail.php`

### Data & Ops

Migrations, seeders, config, and deployment/runtime wiring.

- [Schema](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/database/migrations/0001_01_01_000000_create_users_table.php): migrations · Relational schema for roles, users, profiles, training, scheduling, reservations, payments, exams, and messages. · `database/migrations/0001_01_01_000000_create_users_table.php`
- [Seed data](https://github.com/ayaennaani-cmyk/auto-ecole-app-stage/blob/main/database/seeders/DatabaseSeeder.php): seeders · Demo and operational seed data for formations and sessions. · `database/seeders/DatabaseSeeder.php`

## Connections

- Entry point → Web routes: dispatches · Incoming web requests are routed through the web route file.
- Web routes → Public pages: public pages · Routes expose public pages and contact endpoints.
- Web routes → Dashboard: dashboards · Routes expose role-specific dashboards.
- Web routes → Ops controllers: features · Routes dispatch to the main business controllers.
- Web routes → Role gate: protects · Role checks guard privileged sections.
- Auth routes → Auth flow: auth actions · Auth routes map to login and account lifecycle controllers.
- Auth flow → User: authenticates · Auth actions operate on user accounts.
- Auth flow → Login mail: notifies · Transactional email is part of account or login flow.
- Role gate → User roles: uses · Middleware evaluates the role enum.
- Policies → User: authorizes · User policy governs account access and actions.
- Policies → Operations: authorizes · Reservation and payment policies protect operational records.
- Ops controllers → User: manages · User administration and profile management.
- Ops controllers → Profiles: uses · Controllers work with candidate and instructor profiles.
- Ops controllers → Formation: manages · Training programs are created and edited here.
- Ops controllers → Operations: orchestrates · Scheduling, reservations, payments, exams, and messages flow through these controllers.
- Ops controllers → Policies: checks · Sensitive operations are policy-protected.
- User → Schema: schema · Users are defined in the relational schema.
- Profiles → Schema: schema · Profile tables are created in migrations.
- Formation → Schema: schema · Formation records are backed by migrations.
- Operations → Schema: schema · Operational tables for seances, reservations, payments, results, and messages.
- Seed data → Formation: seeds · Seeders populate formation data.
- Seed data → Operations: seeds · Seeders populate session data.
- Auth & public UI → Frontend stack: renders with · Guest, auth, and public screens are styled by the shared frontend stack.
- Role dashboards → Frontend stack: renders with · Dashboard screens use the shared Blade/Tailwind stack.
- Business views → Frontend stack: renders with · Operational screens use the shared Blade/Tailwind stack.
- Public pages → Auth & public UI: returns · Public controllers render public and contact views.
- Dashboard → Role dashboards: returns · Dashboard controller renders role-specific dashboards.
- Ops controllers → Business views: returns · Business controllers render operational views and PDFs.
