# aronmero/skills-canarias-2024 architecture

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

- Interactive diagram: https://gitdiagram.com/aronmero/skills-canarias-2024
- Repository: https://github.com/aronmero/skills-canarias-2024

## Overview

##### Project Type & Key Purpose
- This is a full-stack application with a clear separation between a Laravel-based PHP backend (API) and a Vue.js frontend.
- The application enables clients to reserve hotel dining areas (salas) and, optionally, specific tables with a given number of seats.
- The README and file tree indicate that the solution adheres to the MVC model on the backend and uses modern frontend practices (with Vite and Vue components).

##### Main Architectural Components
a. Frontend (Client)
– Built with Vue.js; located in the “Frontend” directory.
– Consists of SPA components, views, a router (for navigation), and a centralized API module (“Frontend/src/Api/api.js”) to interact with the backend.
– Styles are managed via Tailwind CSS (configured with tailwind.config.js) and additional SASS.

b. Backend (API Server)
– Developed with PHP and Laravel (located in “Backend”).
– Implements an MVC structure with Controllers (e.g., apiAuthController, apiEventosController, etc.), Models (e.g., evento, reserva, sala, etc.), and Routes defined under “routes/api.php” and “routes/web.php”.
– Uses Middleware (e.g., Authenticate, CSRF protection) to handle security, authentication, and request processing.
– Contains configuration files, environment examples, and artisan commands for development.

c. Database Layer
– Managed via Laravel’s migration and seeder files under “database/migrations” and “database/seeders”.
– Implements tables for users, events, reservations, images, salas, etc.

d. External Testing Tools
– The project includes a file for Insomnia API requests (“peticionesApiInsomnia.json”) to facilitate testing of the API endpoints between the frontend and backend. This indicates a clear dependency on external testing for verifying interactions.

##### Relationships and Data Flow
- The Frontend (Vue.js SPA) sends API requests (typically RESTful calls) to the Backend.
- The Backend (Laravel API) processes incoming requests, applying business logic via Controllers and returning JSON responses.
- Controllers communicate with Models to interact with the Database (CRUD operations) and execute validation using Request classes.
- Middleware in the backend ensures request security (authentication, CSRF) and proper routing.
- Insomnia can simulate these HTTP requests for testing and debugging purposes.

##### Architectural Patterns & Key Design Principles
- MVC Architecture: The Laravel backend follows the Model-View-Controller pattern to separate concerns (business logic, data access, and HTTP handling).
- REST API Design: The backend exposes RESTful endpoints for user authentication, event management, reservations, and room (sala) handling.
- SPA Principles: The Vue.js frontend handles routing, state management, and asynchronous interactions with the REST API provided by Laravel.
- Clear Separation of Concerns: Each layer in the application (Frontend, Backend, Database) has clearly defined responsibilities and connectivity.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend"
        F1["Vue.js SPA"]:::frontend
        F2["Router"]:::frontend
        F3["Components (Auth,Eventos,Reservas,Salas)"]:::frontend
        F4["API Utility Module"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend"
        subgraph "Controllers"
            B1["ApiAuthController"]:::backend
            B2["apiEventosController"]:::backend
            B3["apiReservasController"]:::backend
            B4["apiSalasController"]:::backend
            B5["apiUsersController"]:::backend
        end
        subgraph "Middleware"
            BM1["Authenticate/VerifyCsrfToken"]:::backend
        end
        subgraph "Models"
            BM2["User,evento,reserva,sala,imagen"]:::backend
        end
        subgraph "HTTP Routes"
            BR1["Routes (api.php&web.php)"]:::backend
        end
        B6["Configurations"]:::backend
    end

    %% Database Layer
    subgraph "Database"
        D1["Tables (Users,Eventos,Reservas,Salas,Imagenes)"]:::database
        D2["Migrations"]:::database
        D3["Seeders"]:::database
    end

    %% External Testing Tool
    E1["Insomnia API Testing"]:::external

    %% Connections within Frontend
    F1 -->|"uses"| F3
    F2 -->|"navigates"| F3
    F4 -->|"API_call"| BR1

    %% Frontend to Backend connections
    BR1 -->|"routesTo"| B1
    BR1 -->|"routesTo"| BM1

    %% Backend internal flow
    B1 -->|"invokes"| BM2
    BM2 -->|"ORM_interaction"| D1
    B6 -->|"configures"| BR1

    %% External Testing tool connection
    E1 -->|"tests"| BR1

    %% Click Events
    click F1 "https://github.com/aronmero/skills-canarias-2024/tree/main/Frontend/"
    click F2 "https://github.com/aronmero/skills-canarias-2024/blob/main/Frontend/src/router/index.js"
    click F4 "https://github.com/aronmero/skills-canarias-2024/blob/main/Frontend/src/Api/api.js"
    click B1 "https://github.com/aronmero/skills-canarias-2024/tree/main/Backend/app/Http/Controllers"
    click BM1 "https://github.com/aronmero/skills-canarias-2024/tree/main/Backend/app/Http/Middleware"
    click BM2 "https://github.com/aronmero/skills-canarias-2024/tree/main/Backend/app/Models"
    click BR1 "https://github.com/aronmero/skills-canarias-2024/tree/main/Backend/routes"
    click D2 "https://github.com/aronmero/skills-canarias-2024/tree/main/Backend/database/migrations"
    click D3 "https://github.com/aronmero/skills-canarias-2024/tree/main/Backend/database/seeders"
    click E1 "https://github.com/aronmero/skills-canarias-2024/blob/main/peticionesApiInsomnia.json"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef backend fill:#A9DFBF,stroke:#145A32,stroke-width:2px;
    classDef database fill:#F9E79F,stroke:#7D6608,stroke-width:2px;
    classDef external fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
```
