# vicentem325/reutilizagt architecture

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

- Interactive diagram: https://gitdiagram.com/vicentem325/reutilizagt
- Repository: https://github.com/vicentem325/reutilizagt

## Overview

##### Project type and purpose
- This is a full-stack, monolithic Laravel web application called “ReutilizaGT.”
- Purpose: Allow authenticated users to list, browse, request, and donate pre-owned items by category, with real-time chat, notifications, and role-based access (admin, moderator, public user).

##### File structure
- Top-level framework directories:
- app/ contains MVC code: Controllers, Models, Actions (Fortify, Jetstream), Notifications, Providers, View Components.
- resources/ holds front-end assets: Blade templates (views/*), CSS/JS (resources/css, resources/js), markdown policies.
- public/ serves static assets and index.php bootstrap.
- routes/ defines web (routes/web.php) and API endpoints (routes/api.php).
- config/ for environment settings (database, cache, mail, queue, auth drivers, third-party).
- database/ migrations & seeders to build schema for users, categories, products, chats, notifications.
- bootstrap/ initializes the Laravel application.
- storage/ for file cache, sessions, logs, user-uploaded files.
- tests/ covers Feature and Unit tests for authentication, API tokens, messaging, profile, etc.
- dotenv (.env.example), composer.json/lock, package.json, vite.config.js, tailwind.config.js for dependency and asset build.

##### README for additional insights
- Confirms Laravel stack, real-time features, background jobs, caching, session management, broadcasting.
- Emphasizes routing, Eloquent ORM, migrations, queue processing, and event broadcasting.

##### Diagramming conventions
→ for request/response flow
⇒ for event/job dispatch
↔ for real-time bidirectional WebSocket channels.
- Blue for external clients/services
- Green for core Laravel components
- Orange for data stores (DB, Cache, Queue)
- Purple for third-party services (Mail, Pusher).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client & Static
    subgraph "Client Layer" 
        direction TB
        Browser["Web Browser/Mobile Client"]:::blue
    end

    subgraph "CDN / Static Assets"
        direction TB
        Static["Tailwind CSS, Vite JS, Images"]:::blue
    end

    Browser -->|HTTPS| Static
    Browser -->|HTTPS| WebServer

    %% Web Server
    subgraph "Web Server"
        direction TB
        WebServer["Nginx/Apache + PHP-FPM"]:::blue
    end

    WebServer -->|forwards request| Kernel

    %% Application Layer
    subgraph "Application Layer (Laravel)"
        direction TB
        Kernel["Laravel HTTP Kernel"]:::green
        Middleware["Global & Route Middleware"]:::green
        Router["Route Dispatcher"]:::green
        subgraph "Actions"
            direction TB
            FortifyActions["Fortify Actions"]:::green
            JetstreamActions["Jetstream Actions"]:::green
        end
        Controllers["Controllers"]:::green
        Models["Eloquent Models"]:::green
        View["Blade Templates & View Components"]:::green
        Services["Notifications / Queue / Broadcasting"]:::green
        QueueWorker["Queue Worker"]:::orange
    end

    Kernel --> Middleware --> Router
    Router --> Controllers
    Controllers --> Models
    Controllers --> View
    Controllers -->|dispatchJob| QueueWorker
    QueueWorker --> Services
    Controllers --> Services

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        DB["MySQL/PostgreSQL"]:::orange
        Cache["Redis/Memcached"]:::orange
        Storage["File Storage (Local/S3)"]:::orange
    end

    Models --> DB
    Services --> Cache
    Controllers --> Storage

    %% External Services
    subgraph "External Services"
        direction TB
        MailProvider["SMTP / Mailgun"]:::purple
        RealTime["Pusher / Echo WebSockets"]:::purple
        Sanctum["Sanctum Token Auth"]:::purple
    end

    Services -->|sendEmail| MailProvider
    Services -->|broadcastEvent| RealTime
    RealTime <-->|WebSocket| Browser
    Router -->|API token| Sanctum

    %% Click events
    click FortifyActions "https://github.com/vicentem325/reutilizagt/tree/main/app/Actions/Fortify/"
    click JetstreamActions "https://github.com/vicentem325/reutilizagt/tree/main/app/Actions/Jetstream/"
    click Kernel "https://github.com/vicentem325/reutilizagt/blob/main/app/Http/Kernel.php"
    click WebServer "https://github.com/vicentem325/reutilizagt/blob/main/public/index.php"
    click Static "https://github.com/vicentem325/reutilizagt/blob/main/resources/js/app.js"
    click DB "https://github.com/vicentem325/reutilizagt/blob/main/config/database.php"
    click Cache "https://github.com/vicentem325/reutilizagt/blob/main/config/cache.php"
    click Storage "https://github.com/vicentem325/reutilizagt/blob/main/config/filesystems.php"
    click MailProvider "https://github.com/vicentem325/reutilizagt/blob/main/config/services.php"
    click RealTime "https://github.com/vicentem325/reutilizagt/blob/main/config/broadcasting.php"
    click Sanctum "https://github.com/vicentem325/reutilizagt/blob/main/config/sanctum.php"
    classDef blue fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef green fill:#D9F7BE,stroke:#237804,color:#237804;
    classDef orange fill:#FFD8BF,stroke:#CF1322,color:#CF1322;
    classDef purple fill:#F9D8FF,stroke:#531DAB,color:#531DAB;
```
