# lavalite/cms architecture

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

- Interactive diagram: https://gitdiagram.com/lavalite/cms
- Repository: https://github.com/lavalite/cms

## Overview

##### Project type and purpose
- This is Lavalite, an open‐source Content Management System (CMS) built on the Laravel PHP framework.
- It’s a monolithic, full-stack web application that serves both dynamic HTML (Blade) views and JSON APIs, manages content, assets, user authentication, background jobs, and more.

##### File structure
- public/
- web root (index.php) and static assets (CSS/JS/images/themes)
- routes/
- route definitions (web.php, api.php, auth.php, channels.php, console.php)
- app/
- Http/Controllers (MVC controllers split by Auth, API, Public, Resources)
- Models (Eloquent ORM classes)
- Middleware (authentication, CSRF, trimming, etc.)
- Console (Artisan commands, scheduled tasks)
- Providers (service container registrations, event, route, broadcast providers)
- resources/
- views (Blade templates), CSS/JS source (compiled by Vite)
- database/
- migrations, seeders, factories
- config/
- Laravel configuration (database, cache, mail, queue, services, theme, etc.)
- storage/
- uploaded files, cache, sessions, logs, compiled views
- packages/
- modular plugins/extensions for the CMS
- bootstrap/
- application bootstrap, cached classes
- tests/
- Feature and Unit tests (PHPUnit)
- composer.json, vite.config.js, .env.example, artisan, phpunit.xml

##### README
- Confirms Laravel stack, MIT license, CMS functionality, live demo and docs.

##### Detail
- Every major Laravel layer (middleware, routing, service providers).
- Both synchronous HTTP paths and asynchronous background workflows.
- Vite build process if front-end asset delivery is critical to your deployment.
- Environment/config (via .env) as influencing database/queue/service endpoints.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    Client["Client\n(Browser/API)"]:::client

    %% Web Server Layer
    WebServer["Web Server\n(Nginx/Apache + PHP-FPM)"]:::server

    %% Laravel Application
    subgraph "Laravel Application"
        direction TB

        subgraph "Bootstrap"
            direction TB
            Index["public/index.php"]:::init
            Bootstrap["bootstrap/app.php"]:::init
        end

        subgraph "HTTP Layer"
            direction TB
            Kernel["HTTP Kernel\napp/Http/Kernel.php"]:::kernel
            Middleware["Middleware\napp/Http/Middleware/"]:::middleware
            Router["Router\nroutes/web.php\nroutes/api.php\nroutes/auth.php\nroutes/channels.php\nroutes/console.php"]:::router
        end

        subgraph "Controllers & Services"
            direction TB
            Controllers["Controllers\napp/Http/Controllers/"]:::controller
        end

        subgraph "Models & ORM"
            direction TB
            Models["Models\napp/Models/"]:::model
        end

        subgraph "Blade View Engine"
            direction TB
            Views["Blade Views\nresources/views/"]:::view
        end

        subgraph "Console & Queue"
            direction TB
            Console["Console Kernel\napp/Console/Kernel.php"]:::console
            QueueConf["Queue Config\nconfig/queue.php"]:::queue
            QueueWorker["Queue Workers\nartisan queue:work"]:::worker
        end
    end

    %% Data Stores Layer
    subgraph "Data Stores"
        direction TB
        DB["Database\n(MySQL/Postgres)"]:::db
        Cache["Cache Store\nRedis"]:::cache
        QueueStore["Queue Store\nRedis/DB"]:::queue
        Storage["File Storage\nstorage/app/public"]:::storage
    end

    %% Asset Build Pipeline
    subgraph "Asset Pipeline"
        direction TB
        Vite["Vite Pipeline\nvite.config.js"]:::asset
        Resources["resources/js/app.js\nresources/js/bootstrap.js\nresources/css/app.css"]:::asset
        PublicAssets["public/assets"]:::asset
    end

    %% External Services
    subgraph "External Services"
        direction TB
        Mail["Mail Services\nconfig/mail.php"]:::external
        Broadcast["Broadcast Services\nconfig/broadcasting.php"]:::external
    end

    %% Cron
    Cron["Cron (schedule:run)"]:::cron

    %% Connections
    Client -->|"HTTP/HTTPS"| WebServer
    WebServer --> Index
    Index --> Bootstrap
    Bootstrap --> Kernel
    Kernel --> Middleware
    Middleware --> Router
    Router --> Controllers
    Controllers --> Models
    Models --> DB
    Models --> Cache
    Controllers --> Views
    Views --> Client
    Router -->|"JSON API"| Client

    Cron --> Console
    Console --> Controllers

    Controllers --> QueueStore
    QueueStore --> QueueWorker
    QueueWorker --> Mail
    QueueWorker --> Broadcast

    Resources --> Vite
    Vite --> PublicAssets
    PublicAssets --> Client

    %% Click Events
    click Index "https://github.com/lavalite/cms/blob/master/public/index.php"
    click Bootstrap "https://github.com/lavalite/cms/blob/master/bootstrap/app.php"
    click Kernel "https://github.com/lavalite/cms/blob/master/app/Http/Kernel.php"
    click Middleware "https://github.com/lavalite/cms/tree/master/app/Http/Middleware/"
    click Router "https://github.com/lavalite/cms/blob/master/routes/web.php"
    click Controllers "https://github.com/lavalite/cms/tree/master/app/Http/Controllers/"
    click Models "https://github.com/lavalite/cms/tree/master/app/Models/"
    click Views "https://github.com/lavalite/cms/tree/master/resources/views/"
    click Console "https://github.com/lavalite/cms/blob/master/app/Console/Kernel.php"
    click QueueConf "https://github.com/lavalite/cms/blob/master/config/queue.php"
    click DB "https://github.com/lavalite/cms/blob/master/config/database.php"
    click Cache "https://github.com/lavalite/cms/blob/master/config/cache.php"
    click Storage "https://github.com/lavalite/cms/tree/master/storage/app/public/"
    click Vite "https://github.com/lavalite/cms/blob/master/vite.config.js"
    click Resources "https://github.com/lavalite/cms/blob/master/resources/js/app.js"
    click Mail "https://github.com/lavalite/cms/blob/master/config/mail.php"
    click Broadcast "https://github.com/lavalite/cms/blob/master/config/broadcasting.php"

    %% Styles
    classDef client fill:#c6f1ff,stroke:#1aafcc,stroke-width:2px
    classDef server fill:#ffe29a,stroke:#d18e00,stroke-width:2px
    classDef init fill:#e0e0e0,stroke:#555,stroke-width:1px
    classDef kernel fill:#f9e79f,stroke:#b7950b,stroke-width:2px
    classDef middleware fill:#fadbd8,stroke:#c0392b,stroke-width:2px
    classDef router fill:#d6eaf8,stroke:#1b4f72,stroke-width:2px
    classDef controller fill:#d5f5e3,stroke:#117a65,stroke-width:2px
    classDef model fill:#fdebd0,stroke:#a04000,stroke-width:2px
    classDef view fill:#ebdef0,stroke:#6c3483,stroke-width:2px
    classDef console fill:#d1f2eb,stroke:#117864,stroke-width:2px
    classDef queue fill:#f5cba7,stroke:#943126,stroke-width:2px
    classDef worker fill:#fad7a0,stroke:#b9770e,stroke-width:2px
    classDef db fill:#aed6f1,stroke:#21618c,stroke-width:2px
    classDef cache fill:#a3e4d7,stroke:#0e6655,stroke-width:2px
    classDef storage fill:#f9e79f,stroke:#b7950b,stroke-width:2px
    classDef asset fill:#d2b4de,stroke:#6c3483,stroke-width:2px
    classDef external fill:#f5b7b1,stroke:#922b21,stroke-width:2px
    classDef cron fill:#fbeee0,stroke:#6e2c00,stroke-width:2px
```
