# albertpf/tickets architecture

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

- Interactive diagram: https://gitdiagram.com/albertpf/tickets
- Repository: https://github.com/albertpf/tickets

## Overview

##### Project type and purpose
- This is a monolithic, full-stack Laravel web application (“tickets”) that provides an internal ticketing/support system.
- It exposes two main user interfaces:
- An Admin dashboard (Blade templates under resources/views/admin).
- A public/portal interface (under public/portal).
- Back-end responsibilities include user/auth management, ticket/assignment workflows, activity logs, background jobs, and database migrations/seeders.

##### File structure
- Top-level directories:
- app/ → Core Laravel MVC code (Controllers, Models, Jobs, Middleware, Exceptions, Helpers)
- resources/views/ → Blade templates, split into admin, auth, layout, and portal index files.
- public/, public/portal → Served assets (CSS/JS/fonts/images) and entry points (index.php, portal main).
- routes/ → web.php, api.php, console.php, channels.php define HTTP/API/CLI routes.
- database/ → Migrations, factories, seeders for tables: users, tickets, soportes, actividades, bitacora, etc.
- config/ → Laravel configuration for auth, database, cache, mail, queue, CORS, sanctum, etc.
- bootstrap/, vendor/ → Framework bootstrap and dependencies.
- Uses Laravel’s MVC pattern and Eloquent ORM, background queue jobs (`app/Jobs`), middleware stack (`app/Http/Middleware`), service providers for bootstrapping (`app/Providers`).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        Admin["Admin Dashboard UI"]:::presentation
        Portal["Public Portal UI"]:::presentation
    end

    %% Web Server Layer
    subgraph "Web Server Layer"
        Server["Nginx + PHP-FPM\n(public/index.php)"]:::infra
    end

    %% Application Layer
    subgraph "Laravel Application"
        Kernel["HTTP Kernel & Middleware"]:::application
        Middleware["Custom Middleware\nAuthAdministrador"]:::application
        RoutesWeb["Web Routes"]:::application
        RoutesAPI["API Routes"]:::application
        RoutesConsole["Console Commands"]:::application
        RoutesChannels["Broadcasting Channels"]:::application
        Controllers["Controllers"]:::application
        Models["Eloquent Models"]:::application
        Jobs["Background Jobs & Queues"]:::application
        Helpers["Helpers & Utilities"]:::application
        Providers["Service Providers"]:::application
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        DB["Relational Database\n(MySQL/PostgreSQL)"]:::data
    end

    %% External Services
    subgraph "External Services"
        Mail["Mail Server (SMTP)"]:::infra
        Cache["Cache/Session Store\n(Redis)"]:::infra
        Storage["Storage (S3/Local)"]:::infra
        RealTime["Real-time Broadcaster"]:::infra
    end

    %% Build/Asset Pipeline
    subgraph "Build/Asset Pipeline"
        Vite["Node.js/Vite"]:::infra
        FrontAssets["Public Assets\n(public/assets)"]:::infra
    end

    %% Client to Server
    Admin -->|HTTP/HTTPS| Server
    Portal -->|HTTP/HTTPS| Server

    %% Server to Application
    Server --> Kernel

    %% Middleware and Routing
    Kernel --> Middleware
    Middleware --> RoutesWeb
    Middleware --> RoutesAPI
    Kernel --> RoutesConsole
    Kernel --> RoutesChannels

    RoutesWeb --> Controllers
    RoutesAPI --> Controllers
    RoutesConsole --> Controllers
    RoutesChannels --> Controllers

    %% Controllers to other components
    Controllers --> Models
    Controllers -->|reads/writes| DB
    Controllers --> Jobs
    Controllers -->|broadcast| RealTime

    %% Models and DB
    Models --> DB

    %% Jobs and External Services
    Jobs --> Mail
    Jobs --> Storage
    Jobs -->|cache/store sessions| Cache

    %% Build pipeline to frontends
    Vite --> FrontAssets
    FrontAssets --> Admin
    FrontAssets --> Portal

    %% Helpers and Providers
    Providers --> Kernel
    Helpers --> Controllers

    %% Click Events
    click Admin "https://github.com/albertpf/tickets/tree/main/resources/views/admin"
    click Portal "https://github.com/albertpf/tickets/tree/main/public/portal"
    click Server "https://github.com/albertpf/tickets/blob/main/public/index.php"
    click Kernel "https://github.com/albertpf/tickets/blob/main/app/Http/Kernel.php"
    click Middleware "https://github.com/albertpf/tickets/blob/main/app/Http/Middleware/AuthAdministrador.php"
    click RoutesWeb "https://github.com/albertpf/tickets/blob/main/routes/web.php"
    click RoutesAPI "https://github.com/albertpf/tickets/blob/main/routes/api.php"
    click RoutesConsole "https://github.com/albertpf/tickets/blob/main/routes/console.php"
    click RoutesChannels "https://github.com/albertpf/tickets/blob/main/routes/channels.php"
    click Controllers "https://github.com/albertpf/tickets/blob/main/app/Http/Controllers/TicketsController.php"
    click Models "https://github.com/albertpf/tickets/blob/main/app/Models/Ticket.php"
    click Jobs "https://github.com/albertpf/tickets/blob/main/app/Jobs/ActualizarEstadoPerOficJob.php"
    click Helpers "https://github.com/albertpf/tickets/blob/main/app/Helpers/helpers.php"
    click Providers "https://github.com/albertpf/tickets/blob/main/app/Providers/AppServiceProvider.php"
    click Vite "https://github.com/albertpf/tickets/blob/main/vite.config.js"
    click FrontAssets "https://github.com/albertpf/tickets/tree/main/public/assets"

    %% Styles
    classDef presentation fill:#E3F2FD,stroke:#2196F3,color:#0D47A1,stroke-width:1px;
    classDef application fill:#E8F5E9,stroke:#43A047,color:#1B5E20,stroke-width:1px;
    classDef data fill:#FFF3E0,stroke:#FB8C00,color:#E65100,stroke-width:1px;
    classDef infra fill:#ECEFF1,stroke:#607D8B,color:#263238,stroke-width:1px;
```
