# alejandro-echavarria/maet architecture

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

- Interactive diagram: https://gitdiagram.com/alejandro-echavarria/maet
- Repository: https://github.com/alejandro-echavarria/maet

## Overview

##### Main Components
- Frontend Layer:
- Consists of Vue components and pages located in resources/js, which include separate directories for Admin and Public pages.
- Layout components and reusable UI helpers (e.g., buttons, modals, forms) are part of this layer.
- Backend Layer:
- Controllers: Organized under app/Http/Controllers with separate subdirectories for Admin and Public functionality.
- Actions and service providers (found in app/Actions, app/Providers) which encapsulate the business logic related to Fortify (authentication) and Jetstream (user management).
- Middleware: Implements authentication, CSRF protection, and other request handling (located in app/Http/Middleware).
- Routes: Defined in routes/web.php, routes/api.php, routes/admin.php, etc. These act as the entry points directing traffic to the controllers.
- Domain/Data Layer:
- Models: Found in app/Models; these use Laravel’s Eloquent ORM to interact with the database and represent entities such as Category, Client, Job, Company, etc.
- Migrations and Seeders: In the database folder, these files establish the schema and initial data for tables (e.g., jobs, companies, educations).
- Policies: In app/Policies to manage authorization logic.
- Infrastructure & Configuration:
- Configuration files (stored in the config directory) that dictate settings for app behavior, caching, sessions, logging, and external services.
- Artisan and bootstrap files which initiate the application.
- Public assets (in public/) that are served directly to end users (images, CSS, JavaScript).
- Testing: Tests are present in tests/Feature and tests/Unit ensuring quality and function.
- External Dependencies and Packages:
- Laravel core features, plus the Fortify and Jetstream packages that extend authentication and UI scaffolding.
- Other helper integrations like mail (in app/Mail) and job processing (queues mentioned in config/queue.php).

##### Relationships and Data Flows
- User requests (from the browser) initiate via the public frontend layer. These requests are directed through the routes defined (web, admin, api).
- The routing layer forwards requests to the appropriate controllers (Admin controllers for admin functionalities, Public controllers for general user access).
- Controllers interact with business logic encapsulated in the app/Actions files or directly use Eloquent models for CRUD operations.
- Data persistence occurs via interactions with the database, with schemas defined in the migrations and seeders.
- Cross-cutting concerns (authentication, session management, etc.) are handled by middleware.
- View rendering: The backend returns views (blade files in resources/views) or JSON responses (API endpoints) which are processed by Vue.js on the client side.

##### Architectural Patterns and Technology Stack
- MVC Pattern: The typical separation of concerns is clear with Models, Views, and Controllers structured in the app and resources directories.
- Service Providers and Actions: Contribute to the dependency injection and business logic separation.
- Use of Laravel’s Routing and Middleware: Directs request handling with built-in protection and session management.
- Integration of Frontend (Vue.js) with Laravel via Inertia (suggested by the structure in resources/js and layout components).
- Database: Managed via migrations and seeders using Laravel’s Eloquent ORM.
- External packages: Fortify and Jetstream streamline authentication and user management, integrated in app/Actions and app/Providers.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Level Request
    UR["User Request (Browser)"]:::infra

    %% Infrastructure & Configuration Layer
    subgraph "Infrastructure & Configuration"
        Rweb["Routes (web.php)"]:::infra
        Radmin["Routes (admin.php)"]:::infra
        Rapi["Routes (api.php)"]:::infra
        Config["Config Files"]:::infra
        SP["Service Providers"]:::infra
        Assets["Public Assets"]:::infra
        Tfeat["Testing (Feature)"]:::infra
        Tunit["Testing (Unit)"]:::infra
    end

    %% Backend/Application Layer
    subgraph "Backend/Application Layer"
        MW["Middleware"]:::backend
        AC["Admin Controllers"]:::backend
        PC["Public Controllers"]:::backend
        FA["Actions: Fortify"]:::backend
        JA["Actions: Jetstream"]:::backend
    end

    %% Domain/Data Layer
    subgraph "Domain/Data Layer"
        Models["Eloquent Models"]:::domain
        Migrations["Database Migrations"]:::domain
        Seeders["Database Seeders"]:::domain
        Policies["Authorization Policies"]:::domain
    end

    %% Frontend/UI Layer
    subgraph "Frontend/UI Layer"
        VAUI["Vue Admin UI"]:::frontend
        VPUI["Vue Public UI"]:::frontend
        VAPages["Vue Admin Pages"]:::frontend
        VPPages["Vue Public Pages"]:::frontend
    end

    %% External Dependencies
    subgraph "External Dependencies"
        FSP["Fortify Service Provider"]:::external
        JSP["Jetstream Service Provider"]:::external
    end

    %% Connections
    UR -->|"triggers"| Rweb
    UR -->|"triggers"| Radmin
    UR -->|"triggers"| Rapi

    Rweb -->|"passes through"| MW
    Radmin -->|"passes through"| MW
    Rapi -->|"passes through"| MW

    MW -->|"routes to"| AC
    MW -->|"routes to"| PC

    AC -->|"invokes"| FA
    PC -->|"invokes"| JA

    AC -->|"interacts with"| Models
    PC -->|"interacts with"| Models

    Models -->|"defined by"| Migrations
    Models -->|"seeded by"| Seeders
    Models -->|"protected by"| Policies

    AC -->|"renders"| VAPages
    PC -->|"renders"| VPPages

    %% External dependency interactions
    FA -->|"integrates with"| FSP
    JA -->|"integrates with"| JSP
    SP -->|"includes"| FSP
    SP -->|"includes"| JSP

    %% Class Definitions (Colors)
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#FFA500,stroke:#000,stroke-width:2px;
    classDef domain fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef infra fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef external fill:#FFB6C1,stroke:#000,stroke-width:2px;

    %% Click Events
    click VAUI "https://github.com/alejandro-echavarria/maet/tree/main/resources/js/Components/Main/Admin"
    click VPUI "https://github.com/alejandro-echavarria/maet/tree/main/resources/js/Components/Main/Public"
    click VAPages "https://github.com/alejandro-echavarria/maet/tree/main/resources/js/Pages/Admin"
    click VPPages "https://github.com/alejandro-echavarria/maet/tree/main/resources/js/Pages/Public"
    click AC "https://github.com/alejandro-echavarria/maet/tree/main/app/Http/Controllers/Admin"
    click PC "https://github.com/alejandro-echavarria/maet/tree/main/app/Http/Controllers/Public"
    click FA "https://github.com/alejandro-echavarria/maet/tree/main/app/Actions/Fortify"
    click JA "https://github.com/alejandro-echavarria/maet/tree/main/app/Actions/Jetstream"
    click MW "https://github.com/alejandro-echavarria/maet/tree/main/app/Http/Middleware"
    click Rweb "https://github.com/alejandro-echavarria/maet/blob/main/routes/web.php"
    click Radmin "https://github.com/alejandro-echavarria/maet/blob/main/routes/admin.php"
    click Rapi "https://github.com/alejandro-echavarria/maet/blob/main/routes/api.php"
    click Models "https://github.com/alejandro-echavarria/maet/tree/main/app/Models"
    click Migrations "https://github.com/alejandro-echavarria/maet/tree/main/database/migrations"
    click Seeders "https://github.com/alejandro-echavarria/maet/tree/main/database/seeders"
    click Policies "https://github.com/alejandro-echavarria/maet/tree/main/app/Policies"
    click Config "https://github.com/alejandro-echavarria/maet/tree/main/config"
    click SP "https://github.com/alejandro-echavarria/maet/tree/main/app/Providers"
    click Assets "https://github.com/alejandro-echavarria/maet/tree/main/public/"
    click Tfeat "https://github.com/alejandro-echavarria/maet/tree/main/tests/Feature"
    click Tunit "https://github.com/alejandro-echavarria/maet/tree/main/tests/Unit"
    click FSP "https://github.com/alejandro-echavarria/maet/blob/main/app/Providers/FortifyServiceProvider.php"
    click JSP "https://github.com/alejandro-echavarria/maet/blob/main/app/Providers/JetstreamServiceProvider.php"
```
