# khalidlh/fssm-new-app architecture

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

- Interactive diagram: https://gitdiagram.com/khalidlh/fssm-new-app
- Repository: https://github.com/khalidlh/fssm-new-app

## Overview

1. **System type and runtime**
   - This is a **Laravel monolith** for managing university enrollment requests.
   - The app is server-rendered with **Blade** views and uses **Livewire** for interactive multi-step forms and dashboards.
   - Persistence is via Laravel’s database layer; the repo strongly implies a relational DB such as **MySQL/MariaDB** through the standard Laravel `config/database.php` setup.

2. **Core business domain**
   - The central domain object is the **demande** (enrollment request).
   - Around it are supporting entities for student identity, school background, requested program, uploaded documents, validation status, announcements, complaints, and reference data such as years, semesters, cities, countries, institutions, baccalaureate series/mentions, and demand types.

3. **Main user-facing subsystems**
   - There are four distinct application areas:
     - **Étudiant**: submits a request and tracks its status.
     - **Scolarité**: handles requests from new baccalaureate students.
     - **Coordinateur de filière**: reviews higher-education-related requests such as equivalence, transfer, and international cases.
     - **Administrateur**: manages users, settings, announcements, and global reporting.
   - Each area has its own layout and view set under `resources/views/layout/...` and corresponding controllers/components.

4. **Request submission flow**
   - The student journey is driven by a **multi-step registration/request form** implemented with Livewire (`app/Livewire/Forminscription.php` and step views under `resources/views/livewire/forminscription-parties`).
   - Input is validated by dedicated Laravel Form Requests such as `UserRequest`, `InfopersonnelRequest`, `InfoscolaireRequest`, `AnneesRequest`, and `SemestresRequest`.
   - Submitted data is persisted into the `users`, `demandes`, and related profile/reference tables, with file uploads stored under Laravel’s storage layer.

5. **Document and file handling boundary**
   - Supporting documents are first-class in the architecture:
     - `documents`, `documentfiles`, and `document_type_demandes` model the file catalog and the per-demand attachments.
   - The public storage directory is used for uploaded files, while the `ImageController`, `DocumentdemandeController`, and `PDFDownlodController` expose retrieval/export actions.
   - This is a key boundary between the browser-facing form workflow and back-office validation workflows.

6. **Validation and decision workflow**
   - Requests move through status states represented by models such as `Etat_validation` and the demand-specific status fields.
   - Operational controllers are split by role:
     - `app/Http/Controllers/Coordonateur/*` for faculty coordinators.
     - `app/Http/Controllers/Admin/*` for administrative processing.
   - Livewire dashboard components under `app/Livewire/admin` and `app/Livewire/coordonateur` provide filtered queues such as new requests, favorable requests, incomplete requests, and refusals.

7. **Authentication and role boundaries**
   - Authentication is role-aware and enforced with custom middleware:
     - `loginadmin`, `logincoordonateur`, `loginscolarite`, and `loginuser`.
   - Additional middleware handles locale selection, registration date constraints, and UI behavior like statistics cookies.
   - The repo also includes authorization policy support (`AdminPolicy`) and standard Laravel auth controllers for activation, password reset, and language switching.

8. **Admin and coordination back office**
   - The admin area is not just CRUD; it acts as a supervisory control plane:
     - user management, coordinator management, announcements, reclamation management, parameter/configuration screens, and exports.
   - Coordinator and admin dashboards both rely on Livewire components and dedicated controllers/services, but operate on different subsets of the request pipeline and different permission scopes.

9. **Service layer as business orchestration**
   - The `app/Services` directory is the main business-logic boundary between controllers/components and persistence.
   - Notable service groups include:
     - `DemandeService` and role-specific demand data services.
     - `ReclamationService` for complaint handling.
     - `UserRegistrationService` for onboarding and activation.
     - `GestionAdminsServive` / `GestionCoordonateursService` for role management.
   - This suggests the controllers are mostly thin orchestration layers, with the services doing the actual domain work.

10. **Communication and notifications**
   - Email is used for activation, contact handling, password recovery, and demand-status updates via classes in `app/Mail`.
   - The `messages` views indicate templated mail content for these notifications.
   - This creates an asynchronous user-feedback loop around important state changes like account activation and request decisions.

11. **Reporting and exports**
   - The app supports downloadable reports through export classes in `app/Exports`.
   - There is explicit support for **CSV/PDF-style administrative reporting** in the README and controller/view structure.
   - `config/dompdf.php` and the PDF controller indicate server-side document generation for printable request summaries or exports.

12. **Reference data and seeding**
   - The application depends on a rich catalog of reference tables: filières, years, semesters, cities, countries, institutions, bac series/mentions, demand types, and validation states.
   - Seeders populate this baseline data, which is important because the request forms and filtering logic depend on these lookup tables being present.

13. **Front-end structure**
   - The UI is organized into multiple theme bundles under `public/assets` for homepage, admin, student, and form flows.
   - The application is Blade-first, but the interactive request builder and dashboards rely on Livewire rather than a separate SPA frontend.
   - `resources/js/livewire-custom.js` and `vite.config.js` suggest standard Laravel asset bundling.

14. **Operational data flow in one line**
   - Browser request → role-based middleware/auth → controller or Livewire component → validation request/service layer → database + file storage → optional email/PDF/export side effect → updated dashboard/status views.

15. **Architecture diagram boundaries to show**
   - A good diagram should separate:
     - **Presentation layer**: public site, student portal, coordinator portal, admin portal.
     - **Application layer**: controllers, Livewire components, services, requests, middleware.
     - **Domain/persistence layer**: models, migrations, seeders, storage.
     - **Outbound services**: email, PDF generation, exports/downloads.
   - The key architectural concept is a **role-separated monolith** centered on the request lifecycle.

Main entry points: [`routes/web.php`](https://github.com/khalidlh/fssm-new-app/blob/master/routes/web.php) (Routes), [`app/Services/DemandeService.php`](https://github.com/khalidlh/fssm-new-app/blob/master/app/Services/DemandeService.php) (Services), [`app/Http/Controllers/InscriptionController.php`](https://github.com/khalidlh/fssm-new-app/blob/master/app/Http/Controllers/InscriptionController.php) (Inscription), [`app/Livewire/Forminscription.php`](https://github.com/khalidlh/fssm-new-app/blob/master/app/Livewire/Forminscription.php) (Form wizard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Presentation"]
  node_homepage["Homepage<br/>Blade public UI<br/>[homepage.blade.php]"]
  node_student_portal["Étudiant<br/>Blade portal<br/>[etudiant.blade.php]"]
  node_student_form["Request form<br/>Livewire form"]
  node_coord_portal["Coordonateur<br/>Blade portal"]
  node_admin_portal["Admin portal<br/>Blade portal<br/>[admin.blade.php]"]
  node_auth_ui["Auth screens<br/>Blade auth<br/>[auth.blade.php]"]
end

subgraph group_application["Application"]
  node_role_middleware{{"Role gates<br/>Middleware<br/>[loginuser.php]"}}
  node_auth_controllers["Auth flow<br/>Controllers"]
  node_inscription_controller["Inscription<br/>Controller"]
  node_admin_controllers["Admin ops<br/>Controllers"]
  node_coord_controllers["Coord ops<br/>Controllers"]
  node_livewire_form(("Form wizard<br/>Livewire component"))
  node_livewire_dashboards(("Dashboards<br/>Livewire components<br/>[Newdemande.php]"))
  node_request_validation{{"Form requests<br/>Validation<br/>[UserRequest.php]"}}
  node_services["Services<br/>Business orchestration<br/>[DemandeService.php]"]
end

subgraph group_domain["Domain"]
  node_models[("Models<br/>Eloquent domain<br/>[demande.php]")]
  node_migrations_seeders["Schema & seeds<br/>Database setup"]
  node_storage[("File storage<br/>Uploaded files<br/>[.gitignore]")]
end

subgraph group_outbound["Outbound"]
  node_mailers["Mailers<br/>Notifications"]
  node_exports_pdf["Exports & PDF<br/>Reports<br/>[DemandesExport.php]"]
  node_controllers_docs["Docs download<br/>Controller"]
end

subgraph group_infrastructure["Infrastructure"]
  node_routes["Routes<br/>Routing<br/>[web.php]"]
  node_config["Config<br/>[database.php]"]
  node_assets["Assets<br/>[app.js]"]
end

node_routes -->|"auth endpoints"| node_auth_controllers
node_routes -->|"request flow"| node_inscription_controller
node_routes -->|"admin routes"| node_admin_controllers
node_routes -->|"coord routes"| node_coord_controllers
node_routes -->|"download routes"| node_controllers_docs
node_routes -->|"livewire pages"| node_student_form
node_role_middleware -.->|"gates access"| node_auth_controllers
node_auth_ui -->|"renders actions"| node_auth_controllers
node_student_form -->|"drives wizard"| node_livewire_form
node_livewire_form -->|"validates steps"| node_request_validation
node_livewire_form -->|"persists request"| node_services
node_inscription_controller -->|"validates input"| node_request_validation
node_inscription_controller -->|"orchestrates"| node_services
node_admin_controllers -->|"feeds queues"| node_livewire_dashboards
node_coord_controllers -->|"reviews queues"| node_livewire_dashboards
node_services -->|"writes domain"| node_models
node_models -.->|"schema mapping"| node_migrations_seeders
node_migrations_seeders -.->|"database setup"| node_config
node_services -->|"stores uploads"| node_storage
node_controllers_docs -->|"serves files"| node_storage
node_services -->|"sends notifications"| node_mailers
node_services -->|"generates reports"| node_exports_pdf
node_admin_portal -->|"admin UI"| node_admin_controllers
node_coord_portal -->|"coord UI"| node_coord_controllers
node_student_portal -->|"submits demandes"| node_inscription_controller
node_homepage -.->|"navigation"| node_routes
node_assets -.->|"styles ui"| node_student_form
node_assets -.->|"styles ui"| node_admin_portal

click node_homepage "https://github.com/khalidlh/fssm-new-app/blob/master/resources/views/layout/layout-homepage/homepage.blade.php"
click node_student_portal "https://github.com/khalidlh/fssm-new-app/blob/master/resources/views/layout/layout-etudiant/etudiant.blade.php"
click node_student_form "https://github.com/khalidlh/fssm-new-app/blob/master/resources/views/livewire/forminscription.blade.php"
click node_coord_portal "https://github.com/khalidlh/fssm-new-app/blob/master/resources/views/layout/layout-cordonateur-filiere/coordonateur.blade.php"
click node_admin_portal "https://github.com/khalidlh/fssm-new-app/blob/master/resources/views/layout/layout-admin/admin.blade.php"
click node_auth_ui "https://github.com/khalidlh/fssm-new-app/blob/master/resources/views/layout/authentification/auth.blade.php"
click node_role_middleware "https://github.com/khalidlh/fssm-new-app/blob/master/app/Http/Middleware/loginuser.php"
click node_auth_controllers "https://github.com/khalidlh/fssm-new-app/blob/master/app/Http/Controllers/Auth/AuthentificationController.php"
click node_inscription_controller "https://github.com/khalidlh/fssm-new-app/blob/master/app/Http/Controllers/InscriptionController.php"
click node_admin_controllers "https://github.com/khalidlh/fssm-new-app/blob/master/app/Http/Controllers/Admin/AdminController.php"
click node_coord_controllers "https://github.com/khalidlh/fssm-new-app/blob/master/app/Http/Controllers/Coordonateur/CoordonateurController.php"
click node_livewire_form "https://github.com/khalidlh/fssm-new-app/blob/master/app/Livewire/Forminscription.php"
click node_livewire_dashboards "https://github.com/khalidlh/fssm-new-app/blob/master/app/Livewire/admin/Newdemande.php"
click node_request_validation "https://github.com/khalidlh/fssm-new-app/blob/master/app/Http/Requests/UserRequest.php"
click node_services "https://github.com/khalidlh/fssm-new-app/blob/master/app/Services/DemandeService.php"
click node_models "https://github.com/khalidlh/fssm-new-app/blob/master/app/Models/demande.php"
click node_migrations_seeders "https://github.com/khalidlh/fssm-new-app/blob/master/database/migrations/2024_03_26_135118_create_demandes_table.php"
click node_storage "https://github.com/khalidlh/fssm-new-app/blob/master/storage/app/public/.gitignore"
click node_mailers "https://github.com/khalidlh/fssm-new-app/blob/master/app/Mail/DemandeEtatMail.php"
click node_exports_pdf "https://github.com/khalidlh/fssm-new-app/blob/master/app/Exports/DemandesExport.php"
click node_controllers_docs "https://github.com/khalidlh/fssm-new-app/blob/master/app/Http/Controllers/DocumentdemandeController.php"
click node_routes "https://github.com/khalidlh/fssm-new-app/blob/master/routes/web.php"
click node_config "https://github.com/khalidlh/fssm-new-app/blob/master/config/database.php"
click node_assets "https://github.com/khalidlh/fssm-new-app/blob/master/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_homepage,node_student_portal,node_student_form,node_coord_portal,node_admin_portal,node_auth_ui toneBlue
class node_role_middleware,node_auth_controllers,node_inscription_controller,node_admin_controllers,node_coord_controllers,node_livewire_form,node_livewire_dashboards,node_request_validation,node_services toneAmber
class node_models,node_migrations_seeders,node_storage toneMint
class node_mailers,node_exports_pdf,node_controllers_docs toneRose
class node_routes,node_config,node_assets toneIndigo
```

## Components

### Presentation

Blade layouts, Livewire screens, and role-specific portals.

- [Homepage](https://github.com/khalidlh/fssm-new-app/blob/master/resources/views/layout/layout-homepage/homepage.blade.php): Blade public UI · Public landing pages and announcement entry points. · `resources/views/layout/layout-homepage/homepage.blade.php`
- [Étudiant](https://github.com/khalidlh/fssm-new-app/blob/master/resources/views/layout/layout-etudiant/etudiant.blade.php): Blade portal · Student-facing profile, validation, reclamation, and request tracking screens. · `resources/views/layout/layout-etudiant/etudiant.blade.php`
- [Request form](https://github.com/khalidlh/fssm-new-app/blob/master/resources/views/livewire/forminscription.blade.php): Livewire form · Multi-step enrollment request UI and step partials. · `resources/views/livewire/forminscription.blade.php`
- [Coordonateur](https://github.com/khalidlh/fssm-new-app/blob/master/resources/views/layout/layout-cordonateur-filiere/coordonateur.blade.php): Blade portal · Coordinator dashboard and request review screens. · `resources/views/layout/layout-cordonateur-filiere/coordonateur.blade.php`
- [Admin portal](https://github.com/khalidlh/fssm-new-app/blob/master/resources/views/layout/layout-admin/admin.blade.php): Blade portal · Administrative dashboard, user management, parameters, and reclamation screens. · `resources/views/layout/layout-admin/admin.blade.php`
- [Auth screens](https://github.com/khalidlh/fssm-new-app/blob/master/resources/views/layout/authentification/auth.blade.php): Blade auth · Login, activation, password reset, and inscription views. · `resources/views/layout/authentification/auth.blade.php`

### Application

Controllers, middleware, form requests, Livewire components, and services.

- [Role gates](https://github.com/khalidlh/fssm-new-app/blob/master/app/Http/Middleware/loginuser.php): Middleware · Role-aware login, locale, registration-date, and UI-state guards. · `app/Http/Middleware/loginuser.php`
- [Auth flow](https://github.com/khalidlh/fssm-new-app/blob/master/app/Http/Controllers/Auth/AuthentificationController.php): Controllers · Authentication, activation, language switching, and password recovery endpoints. · `app/Http/Controllers/Auth/AuthentificationController.php`
- [Inscription](https://github.com/khalidlh/fssm-new-app/blob/master/app/Http/Controllers/InscriptionController.php): Controller · Student registration and request submission orchestration. · `app/Http/Controllers/InscriptionController.php`
- [Admin ops](https://github.com/khalidlh/fssm-new-app/blob/master/app/Http/Controllers/Admin/AdminController.php): Controllers · Admin request queues, users, announcements, parameters, and reclamations. · `app/Http/Controllers/Admin/AdminController.php`
- [Coord ops](https://github.com/khalidlh/fssm-new-app/blob/master/app/Http/Controllers/Coordonateur/CoordonateurController.php): Controllers · Coordinator request processing endpoints. · `app/Http/Controllers/Coordonateur/CoordonateurController.php`
- [Form wizard](https://github.com/khalidlh/fssm-new-app/blob/master/app/Livewire/Forminscription.php): Livewire component · Interactive enrollment form wizard and step management. · `app/Livewire/Forminscription.php`
- [Dashboards](https://github.com/khalidlh/fssm-new-app/blob/master/app/Livewire/admin/Newdemande.php): Livewire components · Filtered request queues and role dashboards for admin and coordinator. · `app/Livewire/admin/Newdemande.php`
- [Form requests](https://github.com/khalidlh/fssm-new-app/blob/master/app/Http/Requests/UserRequest.php): Validation · Dedicated Laravel request validators for student and school form steps. · `app/Http/Requests/UserRequest.php`
- [Services](https://github.com/khalidlh/fssm-new-app/blob/master/app/Services/DemandeService.php): Business orchestration · Domain services for demandes, users, admins, coordinators, and reclamations. · `app/Services/DemandeService.php`

### Domain

Core models, migrations, seeders, and stored documents.

- [Models](https://github.com/khalidlh/fssm-new-app/blob/master/app/Models/demande.php): Eloquent domain · Core entities for demandes, users, documents, validation states, and reference data. · `app/Models/demande.php`
- [Schema & seeds](https://github.com/khalidlh/fssm-new-app/blob/master/database/migrations/2024_03_26_135118_create_demandes_table.php): Database setup · Migrations and seeders for request lifecycle, lookup tables, and roles. · `database/migrations/2024_03_26_135118_create_demandes_table.php`
- [File storage](https://github.com/khalidlh/fssm-new-app/blob/master/storage/app/public/.gitignore): Uploaded files · Persistent storage for demand attachments and generated assets. · `storage/app/public/.gitignore`

### Outbound

Mail, PDF generation, exports, and file delivery.

- [Mailers](https://github.com/khalidlh/fssm-new-app/blob/master/app/Mail/DemandeEtatMail.php): Notifications · Activation, contact, password reset, and demande-status email messages. · `app/Mail/DemandeEtatMail.php`
- [Exports & PDF](https://github.com/khalidlh/fssm-new-app/blob/master/app/Exports/DemandesExport.php): Reports · CSV/PDF exports and downloadable request summaries. · `app/Exports/DemandesExport.php`
- [Docs download](https://github.com/khalidlh/fssm-new-app/blob/master/app/Http/Controllers/DocumentdemandeController.php): Controller · Document, image, and PDF retrieval/export endpoints. · `app/Http/Controllers/DocumentdemandeController.php`

### Infrastructure

Routes, config, frontend assets, and framework bootstrap.

- [Routes](https://github.com/khalidlh/fssm-new-app/blob/master/routes/web.php): Routing · Web and API route entry points wiring the monolith together. · `routes/web.php`
- [Config](https://github.com/khalidlh/fssm-new-app/blob/master/config/database.php): Laravel config · Database, mail, storage, auth, DOMPDF, and app configuration. · `config/database.php`
- [Assets](https://github.com/khalidlh/fssm-new-app/blob/master/resources/js/app.js): Frontend assets · Theme bundles and compiled frontend resources for public, student, admin, and form experiences. · `resources/js/app.js`

## Connections

- Routes → Auth flow: auth endpoints
- Routes → Inscription: request flow
- Routes → Admin ops: admin routes
- Routes → Coord ops: coord routes
- Routes → Docs download: download routes
- Routes → Request form: livewire pages
- Role gates → Auth flow: gates access
- Auth screens → Auth flow: renders actions
- Request form → Form wizard: drives wizard
- Form wizard → Form requests: validates steps
- Form wizard → Services: persists request
- Inscription → Form requests: validates input
- Inscription → Services: orchestrates
- Admin ops → Dashboards: feeds queues
- Coord ops → Dashboards: reviews queues
- Services → Models: writes domain
- Models → Schema & seeds: schema mapping
- Schema & seeds → Config: database setup
- Services → File storage: stores uploads
- Docs download → File storage: serves files
- Services → Mailers: sends notifications
- Services → Exports & PDF: generates reports
- Admin portal → Admin ops: admin UI
- Coordonateur → Coord ops: coord UI
- Étudiant → Inscription: submits demandes
- Homepage → Routes: navigation
- Assets → Request form: styles ui
- Assets → Admin portal: styles ui
