# ing-fabiansuarez/butget_laravel architecture

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

- Interactive diagram: https://gitdiagram.com/ing-fabiansuarez/butget_laravel
- Repository: https://github.com/ing-fabiansuarez/butget_laravel

## Overview

##### Project type and purpose
- This is an open-source, self-hosted full-stack web application (“Budget”) built on Laravel (PHP 8.1+). It provides a user interface (Blade + Vue + Livewire) for managing personal finances, backed by MySQL, with background jobs (queues & scheduler) for imports, recurring transactions, conversion rates, and weekly email reports.

##### File structure
- Top-level directories:
- app/: contains Models, Controllers (HTTP & API), Actions (service layer), Repositories, Jobs, Events, Mail, Policies, Middleware, Console commands.
- resources/: front-end assets (Tailwind CSS, Vue components, JS, SASS), Blade views, translations.
- public/: web root (index.php, static assets).
- database/: migrations, factories, seeders.
- tests/: PHPUnit + Dusk (browser) tests.
- docker/: container configs, Dockerfile, cron, supervisord.
- Architectural patterns: MVC in Laravel, service-action layer, repository pattern, event-driven (Events & Listeners), queued jobs, scheduled tasks (cron → artisan schedule:run).

##### README for additional insights
- Confirms core features (transactions, tags, imports, reports, multi-currency, i18n, emails).
- Deployment options: self-hosted with PHP/Apache or NGINX + Composer + Node + MySQL, or Docker Compose stack.
- Background processing requirements: cron for scheduler and queue workers (Supervisor).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients
    subgraph "Clients" 
        Browser("Browser & Mobile"):::client
    end

    %% Web Server Layer
    subgraph "Web Server"
        NGINX("NGINX/Apache"):::server
        PHPFPM("PHP-FPM"):::server
    end

    %% Laravel Application
    subgraph "Application (Laravel)"
        subgraph "Routing"
            Router("Laravel Router"):::router
        end

        subgraph "Presentation Layer"
            Blade("Blade Views"):::presentation
            Vue("Vue Components"):::presentation
            Livewire("Livewire Components"):::presentation
        end

        subgraph "API Layer"
            APIControllers("API Controllers"):::api
            APIRoutes("routes/api.php"):::api
        end

        subgraph "Web Controllers"
            WebControllers("HTTP Controllers"):::controllers
            WebRoutes("routes/web.php"):::controllers
        end

        subgraph "Service Layer"
            Actions("Actions"):::service
        end

        subgraph "Repositories"
            Repos("Repositories"):::repository
        end

        subgraph "Models"
            Models("Eloquent Models"):::model
        end

        subgraph "Event-Driven"
            Events("Events"):::event
            EventProvider("EventServiceProvider"):::event
        end

        subgraph "Mail Notifications"
            Mail("Mail Notifications"):::mail
        end

        subgraph "Console & Scheduling"
            Scheduler("Scheduler Tasks (Kernel)"):::scheduler
            Cron("docker/cron.conf"):::scheduler
        end

        subgraph "Queues"
            QueueConfig("config/queue.php"):::queue
            Jobs("Jobs & Workers"):::job
        end
    end

    %% Database
    subgraph "Database"
        MySQL("MySQL DB"):::db
        Migrations("Migrations & Seeders"):::db
    end

    %% Asset Pipeline
    subgraph "Asset Build Pipeline"
        Package("package.json & Configs"):::asset
        Assets("resources/assets/js/"):::asset
    end

    %% Docker & Infrastructure
    subgraph "Docker & Infrastructure"
        Compose("docker-compose.yml"):::infra
        Dockerfile("docker/Dockerfile"):::infra
        NginxConf("docker/nginx.conf"):::infra
        Supervisor("supervisord.conf"):::infra
        EnvDocker(".env.docker"):::infra
        entry("docker/entrypoint.sh"):::infra
    end

    %% External Services
    subgraph "External Services"
        SMTP("SMTP / Email Provider"):::external
        CurrencyAPI("Currency Rate API"):::external
    end

    %% Connections
    Browser -->|HTTP| NGINX
    NGINX --> PHPFPM
    PHPFPM --> Router

    Router -->|web routes| WebControllers
    Router -->|api routes| APIControllers

    WebControllers --> Actions
    APIControllers --> Actions

    Actions --> Repos
    Repos --> Models
    Models --> MySQL

    WebControllers -->|renders| Blade
    WebControllers -->|renders| Livewire
    WebControllers -->|serves| Vue
    APIControllers -->|returns JSON| Browser

    Blade -->|HTML| Browser
    Vue -->|SPA| Browser
    Livewire -->|interactive| Browser

    Scheduler -->|dispatch jobs| Jobs
    Cron --> Scheduler
    Jobs --> QueueConfig
    QueueConfig --> Jobs
    Jobs --> Actions
    Jobs --> Events
    Events --> Mail
    Jobs --> MySQL
    Mail --> SMTP

    Assets -->|build| Package
    Package -->|output| NGINX

    Compose --> NGINX
    Compose --> PHPFPM
    Compose --> MySQL
    Compose --> Jobs
    Compose --> entry

    Supervisor --> Jobs

    %% Click Events
    click Blade "https://github.com/ing-fabiansuarez/butget_laravel/tree/master/resources/views/"
    click Vue "https://github.com/ing-fabiansuarez/butget_laravel/tree/master/resources/assets/js/components/"
    click Livewire "https://github.com/ing-fabiansuarez/butget_laravel/tree/master/app/Http/Livewire/"
    click APIControllers "https://github.com/ing-fabiansuarez/butget_laravel/tree/master/app/Http/Controllers/Api/"
    click APIRoutes "https://github.com/ing-fabiansuarez/butget_laravel/blob/master/routes/api.php"
    click WebControllers "https://github.com/ing-fabiansuarez/butget_laravel/tree/master/app/Http/Controllers/"
    click WebRoutes "https://github.com/ing-fabiansuarez/butget_laravel/blob/master/routes/web.php"
    click Actions "https://github.com/ing-fabiansuarez/butget_laravel/tree/master/app/Actions/"
    click Repos "https://github.com/ing-fabiansuarez/butget_laravel/tree/master/app/Repositories/"
    click Models "https://github.com/ing-fabiansuarez/butget_laravel/tree/master/app/Models/"
    click Events "https://github.com/ing-fabiansuarez/butget_laravel/tree/master/app/Events/"
    click EventProvider "https://github.com/ing-fabiansuarez/butget_laravel/blob/master/app/Providers/EventServiceProvider.php"
    click Mail "https://github.com/ing-fabiansuarez/butget_laravel/tree/master/app/Mail/"
    click Mail "https://github.com/ing-fabiansuarez/butget_laravel/tree/master/resources/views/emails/"
    click Scheduler "https://github.com/ing-fabiansuarez/butget_laravel/blob/master/app/Console/Kernel.php"
    click Cron "https://github.com/ing-fabiansuarez/butget_laravel/blob/master/docker/cron.conf"
    click QueueConfig "https://github.com/ing-fabiansuarez/butget_laravel/blob/master/config/queue.php"
    click Jobs "https://github.com/ing-fabiansuarez/butget_laravel/tree/master/app/Jobs/"
    click Migrations "https://github.com/ing-fabiansuarez/butget_laravel/tree/master/database/migrations/"
    click Package "https://github.com/ing-fabiansuarez/butget_laravel/blob/master/package.json"
    click Assets "https://github.com/ing-fabiansuarez/butget_laravel/tree/master/resources/assets/js/"
    click Compose "https://github.com/ing-fabiansuarez/butget_laravel/blob/master/docker-compose.yml"
    click Dockerfile "https://github.com/ing-fabiansuarez/butget_laravel/tree/master/docker/Dockerfile"
    click NginxConf "https://github.com/ing-fabiansuarez/butget_laravel/blob/master/docker/nginx.conf"
    click Supervisor "https://github.com/ing-fabiansuarez/butget_laravel/blob/master/docker/supervisord.conf"
    click EnvDocker "https://github.com/ing-fabiansuarez/butget_laravel/blob/master/.env.docker"
    click entry "https://github.com/ing-fabiansuarez/butget_laravel/blob/master/docker/entrypoint.sh"

    %% Styles
    classDef client fill:#B3E5FC,stroke:#0288D1,color:#01579B;
    classDef server fill:#C8E6C9,stroke:#2E7D32,color:#1B5E20;
    classDef router fill:#FFF9C4,stroke:#F9A825,color:#F57F17;
    classDef presentation fill:#E1BEE7,stroke:#8E24AA,color:#6A1B9A;
    classDef api fill:#FFCCBC,stroke:#D84315,color:#BF360C;
    classDef controllers fill:#D1C4E9,stroke:#512DA8,color:#311B92;
    classDef service fill:#FFE0B2,stroke:#FB8C00,color:#E65100;
    classDef repository fill:#BBDEFB,stroke:#1976D2,color:#0D47A1;
    classDef model fill:#DCEDC8,stroke:#689F38,color:#33691E;
    classDef event fill:#F0F4C3,stroke:#AFB42B,color:#827717;
    classDef mail fill:#F8BBD0,stroke:#C2185B,color:#880E4F;
    classDef scheduler fill:#CFD8DC,stroke:#455A64,color:#263238;
    classDef queue fill:#F3E5F5,stroke:#8E24AA,color:#6A1B9A;
    classDef job fill:#FFECB3,stroke:#FFA000,color:#FF6F00;
    classDef db fill:#FFE5EC,stroke:#C2185B,color:#880E4F;
    classDef asset fill:#FFF3E0,stroke:#FB8C00,color:#E65100;
    classDef infra fill:#E0E0E0,stroke:#424242,color:#212121;
    classDef external fill:#E8F5E9,stroke:#43A047,color:#1B5E20;
```
