# aznida/brevet architecture

> Architecture diagram of the GitHub repository aznida/brevet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aznida/brevet
- Repository: https://github.com/aznida/brevet

## Overview

##### Project type and purpose
- This is a full-stack web application built on Laravel with Inertia.js and Vue.js.
- From the controllers (app/Http/Controllers/Admin & Participant), models (app/Models), and Vue pages (resources/js/Pages/Admin, resources/js/Pages/Participant), the app’s domain is an online exam/assessment system. Administrators can create exams, sessions, questions, import/export data, assign performance assessments and generate reports. Participants can log in, take exams (theory & practical), and view results.

##### File structure
- Top-level “app” directory holds the MVC backend: Controllers (split into Admin vs. Participant), Models, Actions (Fortify authentication logic), Imports/Exports (Excel import/export).
- “resources/js” contains the frontend: Vue single-file components under Components, Layouts (Admin, Auth, Participant), and Pages (again Admin vs. Participant areas).
- “public” holds the built assets (CSS/JS) produced by Vite (vite.config.js) and is the webroot served via public/index.php.
- “config”, “database/migrations”, “seeders” show database setup (MySQL or similar). “.env.example” configures DB, mail, cache, queues, etc.
- Laravel Fortify handles authentication. Excel import/export uses Laravel-Excel (config/excel.php).

##### Detail without over-complicating
- Middleware layer (HandleInertiaRequests, AuthParticipant).
- Vite build process as part of the asset pipeline.
- Keep it readable: focus on core components first, then add secondary services (queue, mail) as needed.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer" 
        direction TB
        Browser["Browser (Vue.js + Inertia.js SPA)"]:::frontend
        AppJS["app.js"]:::frontend
        Boot["bootstrap.js"]:::frontend
        Comps["Components"]:::frontend
        subgraph "Admin Frontend"
            direction TB
            AdminLayout["Admin Layout"]:::frontend
            AdminPages["Admin Pages"]:::frontend
        end
        subgraph "Participant Frontend"
            direction TB
            PartLayout["Participant Layout"]:::frontend
            PartPages["Participant Pages"]:::frontend
        end
    end

    %% Web Server Layer
    subgraph "Web Server"
        direction TB
        WebServer["Nginx/Apache"]:::backend
        Index["public/index.php"]:::backend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        direction TB
        Laravel["Laravel App (PHP-FPM)"]:::backend

        subgraph "Controllers"
            direction TB
            AdminC["Admin Controllers"]:::backend
            PartC["Participant Controllers"]:::backend
        end

        subgraph "Middleware"
            direction TB
            InertiaMW["HandleInertiaRequests"]:::backend
            AuthPMW["AuthParticipant"]:::backend
        end

        subgraph "Authentication"
            direction TB
            FortifyActions["Fortify Actions"]:::backend
            FortifyConfig["config/fortify.php"]:::backend
        end

        Models["Models"]:::backend

        subgraph "Import/Export"
            direction TB
            Imports["app/Imports"]:::backend
            Exports["app/Exports"]:::backend
            ExcelConfig["config/excel.php"]:::backend
        end

        subgraph "Routes"
            direction TB
            WebRoutes["routes/web.php"]:::backend
            ConsoleRoutes["routes/console.php"]:::backend
        end

        subgraph "Database Setup"
            direction TB
            DBConfig["config/database.php"]:::backend
            Migrations["database/migrations"]:::backend
        end

        QueueConfig["config/queue.php"]:::backend
    end

    %% Infrastructure Layer
    subgraph "Infrastructure"
        direction TB
        DB["Database (MySQL/PostgreSQL)"]:::infra
        subgraph "File Storage"
            direction TB
            FSConfig["config/filesystems.php"]:::infra
            StorageApp["storage/app"]:::infra
            StorageFW["storage/framework"]:::infra
        end
        Queue["Queue & Scheduler"]:::infra
        Worker["Queue Worker"]:::infra
        subgraph "Mail Service"
            direction TB
            MailConfig["config/mail.php"]:::infra
            EmailTemp["participant_notification.blade.php"]:::infra
        end
        subgraph "Assets"
            direction TB
            ViteConf["vite.config.js"]:::infra
            BuildDir["public/build"]:::infra
            CSS["public/assets/css"]:::infra
            JSDir["public/assets/js"]:::infra
        end
    end

    %% Connections
    Browser -->|loads assets| BuildDir
    Browser -->|HTTP Inertia Request| WebServer
    WebServer --> Index
    Index --> Laravel
    Laravel --> AdminC
    Laravel --> PartC
    Laravel --> InertiaMW
    Laravel --> AuthPMW
    Laravel --> FortifyActions
    Laravel --> Models
    Laravel --> DB
    Laravel --> FSConfig
    Laravel --> Imports
    Laravel --> Exports
    Laravel --> QueueConfig
    Laravel --> WebRoutes
    Laravel --> ConsoleRoutes
    Laravel --> DBConfig
    Laravel --> Migrations

    Laravel -->|dispatch| Queue
    Queue --> Worker
    Worker --> MailConfig
    Worker --> EmailTemp
    Worker --> StorageApp

    Imports --> StorageApp
    Exports --> StorageApp

    ViteConf --> BuildDir
    ViteConf --> CSS
    ViteConf --> JSDir
    WebServer -->|serves| CSS
    WebServer -->|serves| JSDir

    %% Click Events
    click AppJS "https://github.com/aznida/brevet/blob/master/resources/js/app.js"
    click Boot "https://github.com/aznida/brevet/blob/master/resources/js/bootstrap.js"
    click Comps "https://github.com/aznida/brevet/tree/master/resources/js/Components"
    click AdminLayout "https://github.com/aznida/brevet/blob/master/resources/js/Layouts/Admin.vue"
    click AdminPages "https://github.com/aznida/brevet/tree/master/resources/js/Pages/Admin"
    click PartLayout "https://github.com/aznida/brevet/blob/master/resources/js/Layouts/Participant.vue"
    click PartPages "https://github.com/aznida/brevet/tree/master/resources/js/Pages/Participant"
    click AdminC "https://github.com/aznida/brevet/tree/master/app/Http/Controllers/Admin"
    click PartC "https://github.com/aznida/brevet/tree/master/app/Http/Controllers/Participant"
    click InertiaMW "https://github.com/aznida/brevet/blob/master/app/Http/Middleware/HandleInertiaRequests.php"
    click AuthPMW "https://github.com/aznida/brevet/blob/master/app/Http/Middleware/AuthParticipant.php"
    click FortifyActions "https://github.com/aznida/brevet/tree/master/app/Actions/Fortify"
    click FortifyConfig "https://github.com/aznida/brevet/blob/master/config/fortify.php"
    click Models "https://github.com/aznida/brevet/tree/master/app/Models"
    click Imports "https://github.com/aznida/brevet/tree/master/app/Imports"
    click Exports "https://github.com/aznida/brevet/tree/master/app/Exports"
    click ExcelConfig "https://github.com/aznida/brevet/blob/master/config/excel.php"
    click ViteConf "https://github.com/aznida/brevet/blob/master/vite.config.js"
    click BuildDir "https://github.com/aznida/brevet/tree/master/public/build"
    click CSS "https://github.com/aznida/brevet/tree/master/public/assets/css"
    click JSDir "https://github.com/aznida/brevet/tree/master/public/assets/js"
    click Index "https://github.com/aznida/brevet/blob/master/public/index.php"
    click DBConfig "https://github.com/aznida/brevet/blob/master/config/database.php"
    click Migrations "https://github.com/aznida/brevet/tree/master/database/migrations"
    click QueueConfig "https://github.com/aznida/brevet/blob/master/config/queue.php"
    click MailConfig "https://github.com/aznida/brevet/blob/master/config/mail.php"
    click EmailTemp "https://github.com/aznida/brevet/blob/master/resources/views/emails/participant_notification.blade.php"
    click FSConfig "https://github.com/aznida/brevet/blob/master/config/filesystems.php"
    click StorageApp "https://github.com/aznida/brevet/tree/master/storage/app"
    click StorageFW "https://github.com/aznida/brevet/tree/master/storage/framework"
    click WebRoutes "https://github.com/aznida/brevet/blob/master/routes/web.php"
    click ConsoleRoutes "https://github.com/aznida/brevet/blob/master/routes/console.php"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,stroke-width:1px
    classDef backend fill:#DFFFE0,stroke:#28A745,stroke-width:1px
    classDef infra fill:#FFF4D0,stroke:#C69000,stroke-width:1px
```
