# guihallmann/internship-test architecture

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

- Interactive diagram: https://gitdiagram.com/guihallmann/internship-test
- Repository: https://github.com/guihallmann/internship-test

## Overview

##### Main Components
- Frontend Client: Represent the user interface built in Vue 3. Note the separation of pages (found in the resources/js/Pages directory) such as Audit, Auth (Login), Department, FollowUp, Person, Protocol, and User components.
- Backend Application: The Laravel layer is organized in app/* directories with controllers, middleware, models, policies, and service providers. Highlight controllers (e.g., AuditController, Auth/LoginController, etc.), middleware (for authentication, CSRF, etc.), and request validations.
- Database: The migrations and seeders directories specify the database schema (users, protocols, departments, follow-ups, audits, attachments, etc.). This represents persistent storage.
- API & Routing Layer: The routes directory (web.php, api.php, etc.) configures the endpoints for both client navigation (via InertiaJS) and potential API access.
- External Services / Files: Indicate components such as file upload handling, PDF downloads, and auditing logs that capture operations – these can be shown as auxiliary modules or service connectors.
- Configuration & Infrastructure: Mention configuration files that define authentication, caching, broadcasting, etc., which influence overall behavior. These are not “modules” per se but are critical to note in the system’s backbone.

##### Relationships and Interactions
- Backend Processing: Controllers receive requests, validate them (using the Form Request classes in app/Http/Requests), enforce business logic, and then interact with models representing the underlying database.
- Data Persistence: Show a direct connection between Laravel’s Eloquent models and the database (as defined in the migrations). Highlight that operations such as user authentication, protocol entries, or file attachments involve CRUD operations on the database.
- Middleware and Security: Illustrate the middleware set-up (like Authenticate, VerifyCsrfToken) that intercepts requests for checking authentication, managing sessions, and handling security.
- External Dependencies: Optionally, include external libraries or services (for PDF generation, dynamic validations with Precognition, etc.), indicating how these integrate with Laravel.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The project neatly separates frontend (UI components and pages) from backend (API endpoints, business logic, and data storage).
- Layered Architecture: Indicate layers – presentation (Vue), application logic (Laravel controllers, middleware, service providers), and data (database via migrations and models).
- Security and Authorization: Note that specific middleware and policies (e.g., UserPolicy) manage access control, ensuring that only allowed users can perform certain operations.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        FE_Main["Vue 3 Frontend\n(resources/js/Pages)"]:::frontend
        FE_Audit["Audit Page"]:::frontend
        FE_Auth["Auth (Frontend)"]:::frontend
        FE_Dept["Department (Frontend)"]:::frontend
        FE_FollowUp["FollowUp (Frontend)"]:::frontend
        FE_Person["Person (Frontend)"]:::frontend
        FE_Protocol["Protocol (Frontend)"]:::frontend
        FE_User["User (Frontend)"]:::frontend
        FE_Main --> FE_Audit
        FE_Main --> FE_Auth
        FE_Main --> FE_Dept
        FE_Main --> FE_FollowUp
        FE_Main --> FE_Person
        FE_Main --> FE_Protocol
        FE_Main --> FE_User
    end

    %% Backend Layer
    subgraph "Backend Layer"
        RT["API & Routing\n(routes/web.php, routes/api.php)"]:::backend
        CT_Audit["AuditController"]:::backend
        CT_Auth["LoginController (Auth)"]:::backend
        CT_Dept["DepartmentController"]:::backend
        CT_Follow["FollowUpController"]:::backend
        CT_Person["PersonController"]:::backend
        CT_Protocol["ProtocolController"]:::backend
        CT_User["UserController"]:::backend
        MW["Middleware\n(Authentication,CSRF)"]:::backend
        MD["Eloquent Models"]:::backend
    end

    %% Database Layer
    DB["Database\n(migrations, seeders)"]:::database

    %% External Services
    subgraph "External Services"
        Ext_AttReq["StoreAttachmentRequest"]:::external
        Ext_AttModel["Attachment Model"]:::external
        Ext_FileConfig["Filesystems Config"]:::config
    end

    %% Configuration & Infrastructure
    ConfigNode["Configuration\n(config files)"]:::config

    %% Connections between Frontend and Backend
    FE_Main -->|"InertiaJS"| RT
    FE_Audit -->|"calls"| CT_Audit
    FE_Auth -->|"calls"| CT_Auth
    FE_Dept -->|"calls"| CT_Dept
    FE_FollowUp -->|"calls"| CT_Follow
    FE_Person -->|"calls"| CT_Person
    FE_Protocol -->|"calls"| CT_Protocol
    FE_User -->|"calls"| CT_User

    %% Routes to Controllers and Middleware
    RT --> CT_Audit
    RT --> CT_Auth
    RT --> CT_Dept
    RT --> CT_Follow
    RT --> CT_Person
    RT --> CT_Protocol
    RT --> CT_User
    RT --> MW

    %% Controllers to Models and Database
    CT_Audit --> MD
    CT_Auth --> MD
    CT_Dept --> MD
    CT_Follow --> MD
    CT_Person --> MD
    CT_Protocol --> MD
    CT_User --> MD
    MD --> DB

    %% External Services integration (e.g., File Upload Handling)
    CT_Protocol -->|"validates"| Ext_AttReq
    Ext_AttReq -->|"updates"| Ext_AttModel
    Ext_AttModel -->|"persists"| DB

    %% Configuration influence
    RT -->|"configuredBy"| ConfigNode

    %% Click Events
    click FE_Main "https://github.com/guihallmann/internship-test/tree/main/resources/js/Pages"
    click FE_Audit "https://github.com/guihallmann/internship-test/tree/main/resources/js/Pages/Audit"
    click FE_Auth "https://github.com/guihallmann/internship-test/tree/main/resources/js/Pages/Auth"
    click CT_Auth "https://github.com/guihallmann/internship-test/blob/main/app/Http/Controllers/Auth/LoginController.php"
    click FE_Dept "https://github.com/guihallmann/internship-test/tree/main/resources/js/Pages/Department"
    click CT_Dept "https://github.com/guihallmann/internship-test/blob/main/app/Http/Controllers/DepartmentController.php"
    click FE_FollowUp "https://github.com/guihallmann/internship-test/tree/main/resources/js/Pages/FollowUp"
    click CT_Follow "https://github.com/guihallmann/internship-test/blob/main/app/Http/Controllers/FollowUpController.php"
    click FE_Person "https://github.com/guihallmann/internship-test/tree/main/resources/js/Pages/Person"
    click CT_Person "https://github.com/guihallmann/internship-test/blob/main/app/Http/Controllers/PersonController.php"
    click FE_Protocol "https://github.com/guihallmann/internship-test/tree/main/resources/js/Pages/Protocol"
    click CT_Protocol "https://github.com/guihallmann/internship-test/blob/main/app/Http/Controllers/ProtocolController.php"
    click FE_User "https://github.com/guihallmann/internship-test/tree/main/resources/js/Pages/User"
    click CT_User "https://github.com/guihallmann/internship-test/blob/main/app/Http/Controllers/UserController.php"
    click Ext_AttReq "https://github.com/guihallmann/internship-test/blob/main/app/Http/Requests/StoreAttachmentRequest.php"
    click Ext_AttModel "https://github.com/guihallmann/internship-test/blob/main/app/Models/Attachment.php"
    click Ext_FileConfig "https://github.com/guihallmann/internship-test/blob/main/config/filesystems.php"
    click ConfigNode "https://github.com/guihallmann/internship-test/tree/main/config"
    click RT "https://github.com/guihallmann/internship-test/blob/main/routes/web.php"
    click DB "https://github.com/guihallmann/internship-test/tree/main/database/migrations"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef database fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef external fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef config fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
