# andhikaprasetya/kumpul-sampah architecture

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

- Interactive diagram: https://gitdiagram.com/andhikaprasetya/kumpul-sampah
- Repository: https://github.com/andhikaprasetya/kumpul-sampah

## Overview

##### Project type and purpose
- This is a full-stack Laravel web application that manages users, transactions, waste categories (“sampah”), points exchange (“penukaranPoints”), withdrawals, articles, and dashboard analytics.
- It exposes both web (Blade + Livewire) and JSON APIs (Controllers under app/Http/Controllers/Api) for mobile or SPA consumption.

##### File structure
- app/Http/Controllers (MVC controllers for web and api)
- app/Models (Eloquent models representing database tables)
- app/Http/Resources (JSON transformers for API responses)
- resources/views (Blade templates split into “dashboard” for admin and “frontend” for customer)
- public/template-fe (static assets for front-end theme) and public/template (AdminLTE theme for dashboard)
- routes/web.php, routes/api.php, routes/auth.php (route definitions)
- config/*.php (framework and package settings)
- database/migrations & seeders (DB schema and initial data)
- Livewire components under app/Livewire (real-time UI bits)
- tests/ (feature and unit tests)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients
    subgraph "Clients"
        direction TB
        BrowserEndUser["End-User Frontend Browser"]:::ui
        BrowserAdmin["Admin Dashboard Browser"]:::ui
    end

    %% Web Server
    WebServer["Web Server\n(Nginx/Apache)"]:::infra

    %% Laravel Application
    subgraph "Laravel Application" 
        direction TB
        EnvConfig["Environment & Config\n(.env & config/*.php)"]:::config
        Routing["Routing & Middleware\n(routes/web.php,\nroutes/api.php,\nroutes/auth.php)"]:::app
        subgraph "Controllers"
            direction TB
            WebControllers["Web Controllers"]:::app
            APIControllers["API Controllers"]:::app
            AuthControllers["Auth Controllers"]:::app
            FrontendControllers["Frontend Controllers"]:::app
            DashboardController["DashboardController"]:::app
        end
        ServiceProviders["Service Providers"]:::app
        Services["Business Services\n(e.g., PointsService)"]:::app
        Models["Eloquent Models"]:::model
        Resources["API JSON Resources"]:::app
        subgraph "UI Layers"
            direction TB
            BladeViews["Blade Views"]:::ui
            Livewire["Livewire Components"]:::ui
        end
        AssetsBuild["Build Tools\n(Vite, NPM)\n→ public/js & public/css"]:::infra
    end

    %% Data Layer
    subgraph "Data & Storage"
        direction TB
        Database["Database\n(MySQL/PostgreSQL)"]:::infra
        StorageFiles["File Storage\n(storage/app)"]:::infra
        CacheSession["Cache & Session Store\n(Redis or file)"]:::infra
    end

    %% External Services
    subgraph "External Services"
        direction TB
        MailService["Mail Service"]:::infra
        QueueWorker["Queue Workers"]:::infra
    end

    %% Static Assets
    subgraph "Static Assets"
        direction TB
        FrontTheme["Frontend Theme Assets"]:::infra
        AdminTheme["AdminLTE Theme Assets"]:::infra
    end

    %% Relationships
    BrowserEndUser -->|"HTTPS Request"| WebServer
    BrowserAdmin -->|"HTTPS Request"| WebServer
    WebServer -->|"index.php"| Routing
    Routing -->|"resolve controller"| WebControllers
    Routing -->|"resolve API"| APIControllers
    Routing -->|"resolve auth"| AuthControllers
    Routing -->|"resolve frontend"| FrontendControllers
    Routing -->|"resolve dashboard"| DashboardController
    WebControllers -->|"use Services & Models"| Services
    APIControllers -->|"use Services & Models"| Services
    AuthControllers -->|"use Models"| Models
    FrontendControllers -->|"return Blade Views"| BladeViews
    DashboardController -->|"return Blade Views"| BladeViews
    APIControllers -->|"return JSON via Resources"| Resources
    WebControllers -->|"dispatch jobs"| QueueWorker
    Services -->|"interact with"| Models
    Models -->|"CRUD"| Database
    Models -->|"file uploads"| StorageFiles
    Services -->|"cache/session"| CacheSession
    Livewire -->|"AJAX/WebSocket"| Routing
    BladeViews -->|"render UI"| BrowserEndUser
    BladeViews -->|"render UI"| BrowserAdmin
    AssetsBuild -->|"serves"| FrontTheme
    AssetsBuild -->|"serves"| AdminTheme
    QueueWorker -->|"process jobs"| Database
    QueueWorker -->|"send mail"| MailService

    %% Click Events
    click WebControllers "https://github.com/andhikaprasetya/kumpul-sampah/tree/main/app/Http/Controllers"
    click APIControllers "https://github.com/andhikaprasetya/kumpul-sampah/tree/main/app/Http/Controllers/Api"
    click AuthControllers "https://github.com/andhikaprasetya/kumpul-sampah/tree/main/app/Http/Controllers/Auth"
    click FrontendControllers "https://github.com/andhikaprasetya/kumpul-sampah/tree/main/app/Http/Controllers/Frontend"
    click DashboardController "https://github.com/andhikaprasetya/kumpul-sampah/blob/main/app/Http/Controllers/DashboardController.php"
    click Models "https://github.com/andhikaprasetya/kumpul-sampah/tree/main/app/Models"
    click Resources "https://github.com/andhikaprasetya/kumpul-sampah/tree/main/app/Http/Resources"
    click Livewire "https://github.com/andhikaprasetya/kumpul-sampah/tree/main/app/Livewire"
    click BladeViews "https://github.com/andhikaprasetya/kumpul-sampah/tree/main/resources/views"
    click FrontTheme "https://github.com/andhikaprasetya/kumpul-sampah/tree/main/public/template-fe"
    click AdminTheme "https://github.com/andhikaprasetya/kumpul-sampah/tree/main/public/template"
    click Routing "https://github.com/andhikaprasetya/kumpul-sampah/blob/main/routes/web.php"
    click EnvConfig "https://github.com/andhikaprasetya/kumpul-sampah/tree/main/config/"
    click ServiceProviders "https://github.com/andhikaprasetya/kumpul-sampah/tree/main/app/Providers"
    click Database "https://github.com/andhikaprasetya/kumpul-sampah/tree/main/database/migrations"
    click StorageFiles "https://github.com/andhikaprasetya/kumpul-sampah/tree/main/storage/app"

    %% Styles
    classDef ui fill:#f9f,stroke:#333,stroke-width:1px
    classDef app fill:#afa,stroke:#333,stroke-width:1px
    classDef model fill:#8ef,stroke:#333,stroke-width:1px
    classDef infra fill:#eef,stroke:#333,stroke-width:1px
    classDef config fill:#fea,stroke:#333,stroke-width:1px
```
