# karuhun-developer/template-laravel-livewire architecture

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

- Interactive diagram: https://gitdiagram.com/karuhun-developer/template-laravel-livewire
- Repository: https://github.com/karuhun-developer/template-laravel-livewire

## Overview

##### Project type and purpose
- This is a full-stack Laravel web application (named “Waduh”) that provides a CMS/admin interface built with Livewire and Blade.
- It implements user authentication, role-based access control (Spatie Permission), API key management, settings management, and media storage.

##### File structure
- Top level directories:
- app/ – PHP code: Controllers, Livewire components, Models, Middleware, Traits
- resources/ – Front-end Blade views, Livewire view templates, CSS/JS assets managed via Vite
- routes/ – Web, API, CMS, and auth route definitions
- database/ – Migrations, factories, seeders
- config/ – Laravel and package configuration (auth, permission, media-library, sanctum, etc.)
- public/ – Entry point (index.php), static assets
- .docs/ – Project documentation pages for basic usage and management features
- Key architectural patterns:
- MVC in Laravel controllers + models
- Component-based UI via Livewire (server-driven AJAX)
- Event→Listener for sending email verification
- Trait reuse for common behaviors (API request detection, CRUD actions, filtering)
- Provider-based bootstrapping for service registration

##### README for additional insights
- Quick-start steps confirm typical Laravel + Vite build and serve
- “Folder Yang Sering Kepake” highlights the core directories: app/Http, app/Livewire, app/Models, config/, database/, resources/views/, and routes/

## Diagram (Mermaid)

```mermaid
flowchart TB
    classDef client fill:#CCE5FF,stroke:#0066CC,color:#000;
    classDef server fill:#E6F7FF,stroke:#3399FF,color:#000;
    classDef router fill:#FFF5E6,stroke:#FFB84D,color:#000;
    classDef middleware fill:#E6FFE6,stroke:#33CC33,color:#000;
    classDef backend fill:#F2E6FF,stroke:#9933FF,color:#000;
    classDef frontend fill:#FFE6F2,stroke:#FF33AA,color:#000;
    classDef database fill:#FFF0E6,stroke:#FF9933,color:#000;
    classDef storage fill:#E6F2FF,stroke:#3366CC,color:#000;
    classDef config fill:#F2F2F2,stroke:#A6A6A6,color:#000;
    classDef docs fill:#FFFFE6,stroke:#CCCC33,color:#000;
    classDef external fill:#E6FFE6,stroke:#33CC33,color:#000;

    subgraph "Client Side" 
        Browser["Browser (HTTP/S)"]:::client
    end
    subgraph "Entry Point"
        index["public/index.php"]:::server
        bootstrap["bootstrap/app.php"]:::server
    end
    subgraph "Routing Layer"
        webRoutes["routes/web.php"]:::router
        apiRoutes["routes/api.php"]:::router
        cmsIndex["routes/cms/index.php"]:::router
        cmsMgmt["routes/cms/managements.php"]:::router
        authRoutes["routes/auth/index.php"]:::router
    end
    subgraph "Middleware Layer"
        csrf["VerifyCsrfToken"]:::middleware
        apiKey["AuthApiKey"]:::middleware
        rolePerm["ValidateRolePermission"]:::middleware
        trim["TrimStrings"]:::middleware
    end
    subgraph "Controllers"
        baseController["Controller.php"]:::backend
        authControllers["app/Http/Controllers/Auth/*"]:::backend
        profileCtrl["ProfileController.php"]:::backend
    end
    subgraph "Livewire Components"
        lwBase["BaseComponent.php"]:::backend
        lwCms["app/Livewire/Cms/*"]:::backend
        lwViews["resources/views/livewire/cms/*"]:::frontend
    end
    subgraph "Models & Database"
        models["app/Models/*.php"]:::database
        migrations["database/migrations/*.php"]:::database
        seeders["database/seeders/*.php"]:::database
        Database[(Database MySQL/Postgres)]:::database
    end
    subgraph "File Storage"
        configFS["config/filesystems.php"]:::config
        configMedia["config/media-library.php"]:::config
        mediaTable["*_create_media_table.php"]:::database
        storagePublic["storage/app/public"]:::storage
    end
    subgraph "Config & Docs"
        services["config/services.php"]:::config
        mailConf["config/mail.php"]:::config
        permConf["config/permission.php"]:::config
        sanctumConf["config/sanctum.php"]:::config
        docs[".docs/"]:::docs
    end
    subgraph "Events & Listeners"
        listener["SendEmailVerificationNotification"]:::backend
    end
    subgraph "External Services"
        mailService["Mail / Notifications"]:::external
        oauth["Google OAuth"]:::external
        queueWorkers["Queue Workers (Redis)"]:::external
    end

    Browser -->|"Request"| index
    index --> bootstrap
    bootstrap --> webRoutes
    bootstrap --> apiRoutes
    bootstrap --> cmsIndex
    bootstrap --> cmsMgmt
    bootstrap --> authRoutes
    webRoutes --> csrf
    apiRoutes --> apiKey
    cmsIndex --> rolePerm
    cmsMgmt --> rolePerm
    authRoutes --> csrf
    csrf --> baseController
    apiKey --> baseController
    rolePerm --> baseController
    trim --> baseController
    authControllers --> baseController
    profileCtrl --> baseController
    baseController --> models
    lwBase --> models
    lwCms --> models
    lwViews --> lwBase
    models --> Database
    migrations --> Database
    seeders --> Database
    models --> listener
    listener --> mailService
    queueWorkers --> listener
    lwViews <-->|"AJAX"| lwBase

    click index "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/public/index.php"
    click bootstrap "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/bootstrap/app.php"
    click webRoutes "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/routes/web.php"
    click apiRoutes "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/routes/api.php"
    click cmsIndex "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/routes/cms/index.php"
    click cmsMgmt "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/routes/cms/managements.php"
    click authRoutes "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/routes/auth/index.php"
    click csrf "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/app/Http/Middleware/VerifyCsrfToken.php"
    click apiKey "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/app/Http/Middleware/AuthApiKey.php"
    click rolePerm "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/app/Http/Middleware/ValidateRolePermission.php"
    click trim "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/app/Http/Middleware/TrimStrings.php"
    click baseController "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/app/Http/Controllers/Controller.php"
    click authControllers "https://github.com/karuhun-developer/template-laravel-livewire/tree/main/app/Http/Controllers/Auth/"
    click profileCtrl "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/app/Http/Controllers/ProfileController.php"
    click lwBase "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/app/Livewire/BaseComponent.php"
    click lwCms "https://github.com/karuhun-developer/template-laravel-livewire/tree/main/app/Livewire/Cms/"
    click lwViews "https://github.com/karuhun-developer/template-laravel-livewire/tree/main/resources/views/livewire/cms/"
    click models "https://github.com/karuhun-developer/template-laravel-livewire/tree/main/app/Models/"
    click migrations "https://github.com/karuhun-developer/template-laravel-livewire/tree/main/database/migrations/"
    click seeders "https://github.com/karuhun-developer/template-laravel-livewire/tree/main/database/seeders/"
    click configFS "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/config/filesystems.php"
    click configMedia "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/config/media-library.php"
    click mediaTable "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/database/migrations/*_create_media_table.php"
    click storagePublic "https://github.com/karuhun-developer/template-laravel-livewire/tree/main/storage/app/public"
    click services "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/config/services.php"
    click mailConf "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/config/mail.php"
    click permConf "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/config/permission.php"
    click sanctumConf "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/config/sanctum.php"
    click docs "https://github.com/karuhun-developer/template-laravel-livewire/tree/main/.docs/"
    click listener "https://github.com/karuhun-developer/template-laravel-livewire/blob/main/app/Listeners/SendEmailVerificationNotification.php"
```
