# jeffersongoncalves/filakit architecture

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

- Interactive diagram: https://gitdiagram.com/jeffersongoncalves/filakit
- Repository: https://github.com/jeffersongoncalves/filakit

## Overview

##### Project Type and Purpose
- This is a full-stack Laravel 12.x + Filament 3.x starter kit.
- It delivers a monolithic MVC web application with three pre-configured panels:
- Admin Panel at `/admin` (Admin guard)
- App Panel at `/app` (User guard)
- Public Panel at `/` (visitor-facing frontend)

##### File Structure
- Top-level directories:
- `app/` contains Models, Observers, HTTP Middleware, Filament Resources & Pages, Service Providers
- `config/filakit.php` centralizes panel routes, middleware, branding
- `resources/` and `public/` hold CSS/JS (Tailwind, Vite, PNPM) and Blade views
- `database/` has migrations, seeders, factories
- `docker-compose.yml` and Sail support containerized MySQL, Redis, Mailpit
- `routes/web.php` and `routes/console.php` define HTTP & CLI entry points
- Key patterns: MVC, multi-guard authentication, event observers, queue/job pipeline

##### Extract Insights from README
- Three panels configured via Service Providers under `app/Providers/Filament/`
- Multi-guard auth with `Admin` and `User` models
- Asset pipeline driven by Vite/PNPM and Tailwind
- Optional Docker/Sail environment for MySQL, Redis, Mailpit

##### Main Components & Their Relationships
A. Presentation Layer
- Clients: Admin User, Authenticated App User, Public Visitor
- HTTP(S) → Nginx/Apache or Artisan serve → Laravel front controller (`public/index.php`)
- Vite dev server (PNPM) for live-reloading assets in development
B. Application Layer
- Laravel Router & Middleware (including ProtectFromImpersonation, auth guards)
- Service Providers (AdminPanelProvider, AppPanelProvider, PublicPanelProvider) initialize Filament panels
- Filament Resources & Pages (CRUD UIs for Admins/Users)
- Controllers / Livewire components for dynamic UIs
- Event System & Observers (AdminObserver, UserObserver)
- Queue Workers (via Redis) for background jobs
C. Data Layer
- Primary RDBMS: MySQL (managed by Laravel’s Eloquent)
- Cache & Queue store: Redis
- File Storage: local disk (or S3 if extended)
- Mail Transport: Mailpit or SMTP
D. Infrastructure / DevOps
- Docker Compose (MySQL, Redis, Mailpit, Laravel Sail)
- CI/CD Workflows (.github/workflows) for code style, static analysis, changelog updates
- Environment config via `.env` and `config/*.php`

##### Architectural Patterns & Design Principles
- MVC: clear separation between Models, Views (Blade/Livewire), Controllers/Pages
- Provider-based modularity: each panel is a self-contained module
- Multi-guard authentication and authorization
- Event-Driven: Observers respond to model events
- Dependency Injection & Service Container
- Single monolith with logical modules rather than microservices

## Diagram (Mermaid)

```mermaid
graph TB
    %% Presentation Layer
    subgraph "Presentation" 
        direction TB
        AdminClient["Admin User"]:::presentation
        AppClient["Authenticated App User"]:::presentation
        PublicClient["Public Visitor"]:::presentation
        ViteDev["Vite Dev Server"]:::presentation
    end

    %% Application Layer
    subgraph "Application" 
        direction TB
        WebServer["Web Server + PHP-FPM"]:::compute
        subgraph "Laravel Application"
            direction TB
            RouterMiddleware["Router & Middleware"]:::compute
            PanelProviders["Service Providers"]:::compute
            subgraph "PanelProviders"
                direction TB
                AdminPanel["AdminPanelProvider"]:::compute
                AppPanel["AppPanelProvider"]:::compute
                PublicPanel["PublicPanelProvider"]:::compute
            end
            FilamentResources["Filament Resources & Pages"]:::compute
            ControllersLivewire["Controllers / Livewire"]:::compute
            ModelsObservers["Models & Observers"]:::compute
            QueueWorker["Queue Worker"]:::compute
        end
    end

    %% Data Layer
    subgraph "Data" 
        direction TB
        MySQL["MySQL Database"]:::datastore
        RedisStore["Redis (Cache & Queue)"]:::datastore
        Storage["File Storage"]:::datastore
        MailService["Mailpit / SMTP"]:::external
    end

    %% Infrastructure Layer
    subgraph "Infrastructure"
        direction TB
        DockerCompose["Docker Compose / Sail"]:::external
        CICD["CI/CD Workflows"]:::external
    end

    %% Connections
    AdminClient -->|HTTP| WebServer
    AppClient -->|HTTP| WebServer
    PublicClient -->|HTTP| WebServer
    ViteDev -->|Hot Reload| PublicClient

    WebServer -->|forwards| RouterMiddleware
    RouterMiddleware -->|initializes| PanelProviders
    PanelProviders --> AdminPanel
    PanelProviders --> AppPanel
    PanelProviders --> PublicPanel
    RouterMiddleware -->|routes to| FilamentResources
    RouterMiddleware -->|dispatches| ControllersLivewire
    ControllersLivewire -->|uses| ModelsObservers
    ModelsObservers -->|emits events| QueueWorker
    QueueWorker -->|reads/writes| RedisStore
    ControllersLivewire -->|DB queries| MySQL
    ControllersLivewire -->|cache| RedisStore
    ControllersLivewire -->|uploads| Storage
    ControllersLivewire -->|sends mail| MailService

    DockerCompose --> MySQL
    DockerCompose --> RedisStore
    DockerCompose --> MailService
    CICD -->|runs on push| DockerCompose

    %% Click Events
    click AdminPanel "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Providers/Filament/AdminPanelProvider.php"
    click AppPanel "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Providers/Filament/AppPanelProvider.php"
    click PublicPanel "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Providers/Filament/PublicPanelProvider.php"
    click AdminPanel "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Filament/Resources/AdminResource.php"
    click FilamentResources "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Filament/Resources/AdminResource/Pages/CreateAdmin.php"
    click FilamentResources "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Filament/Resources/AdminResource/Pages/EditAdmin.php"
    click FilamentResources "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Filament/Resources/AdminResource/Pages/ListAdmins.php"
    click FilamentResources "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Filament/Resources/AdminResource/Pages/ViewAdmin.php"
    click FilamentResources "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Filament/Resources/UserResource.php"
    click FilamentResources "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Filament/Resources/UserResource/Pages/CreateUser.php"
    click FilamentResources "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Filament/Resources/UserResource/Pages/EditUser.php"
    click FilamentResources "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Filament/Resources/UserResource/Pages/ListUsers.php"
    click FilamentResources "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Filament/Resources/UserResource/Pages/ViewUser.php"
    click ModelsObservers "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Models/Admin.php"
    click ModelsObservers "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Models/User.php"
    click ModelsObservers "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Observers/AdminObserver.php"
    click ModelsObservers "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Observers/UserObserver.php"
    click RouterMiddleware "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Http/Middleware/ProtectFromImpersonation.php"
    click PanelProviders "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Providers/FilamentServiceProvider.php"
    click PanelProviders "https://github.com/jeffersongoncalves/filakit/blob/3.x/app/Providers/AppServiceProvider.php"
    click RouterMiddleware "https://github.com/jeffersongoncalves/filakit/blob/3.x/bootstrap/app.php"
    click MySQL "https://github.com/jeffersongoncalves/filakit/tree/3.x/database/migrations/"
    click MySQL "https://github.com/jeffersongoncalves/filakit/blob/3.x/database/factories/UserFactory.php"
    click MySQL "https://github.com/jeffersongoncalves/filakit/blob/3.x/database/seeders/DatabaseSeeder.php"
    click DockerCompose "https://github.com/jeffersongoncalves/filakit/blob/3.x/docker-compose.yml"
    click CICD "https://github.com/jeffersongoncalves/filakit/tree/3.x/.github/workflows/"
    click RouterMiddleware "https://github.com/jeffersongoncalves/filakit/blob/3.x/routes/web.php"
    click ControllersLivewire "https://github.com/jeffersongoncalves/filakit/blob/3.x/routes/console.php"

    %% Styles
    classDef presentation fill:#D2E5FF,stroke:#0052CC;
    classDef compute fill:#E6FFDA,stroke:#237804;
    classDef datastore fill:#FFF1B8,stroke:#D48806;
    classDef external fill:#F0F0F0,stroke:#8C8C8C;
```
