# muhamadafghan/dukung-lokal architecture

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

- Interactive diagram: https://gitdiagram.com/muhamadafghan/dukung-lokal
- Repository: https://github.com/muhamadafghan/dukung-lokal

## Overview

##### Project type and purpose
- This is a full-stack web application. The frontend is built with Next.js (React) and Tailwind CSS. The backend is a Laravel API (PHP) exposing RESTful endpoints, handling authentication (Laravel Sanctum), geocoding, product/vendor/position/report management, and persistence into a relational database.

##### File structure
- Top-level directories:
- backend/ – a Laravel project following the standard MVC layout.
- frontend/ – a Next.js project with an app/ directory (Next 13+), components/, hooks/, lib/, store/, public assets, and Tailwind configuration.
- The backend contains Controllers (in app/Http/Controllers), Models, Middleware, Requests, Notifications, database migrations & seeders, configuration files, and a public entry point (public/index.php).
- The frontend has Next.js routes (src/app), reusable UI components (src/components/ui), custom hooks (src/hook), an Axios client wrapper (src/lib/axios.js), and global state stores (src/store).

##### README
- The README simply points to the deployed URL, confirming this is a user-facing “data-umkm” (small business) dashboard with mapping, ranking, and reporting features.

##### Elements
– Blue for frontend-side components
– Green for backend-side components
– Orange for external systems (geocoding, map tiles)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend (Next.js)" 
        direction TB
        Browser["Browser"] 
        NextJS["Next.js Server"] 
        UIComponents["React UI Components"] 
        Hooks["Custom React Hooks"] 
        MapComponent["Map Component"] 
        Modal["Location Permission Modal"] 
        StateStore["Global State Stores (Zustand)"] 
        Axios["Axios HTTP Client Wrapper"] 
        TailwindConfig["Tailwind CSS Config"] 
    end

    %% Backend Layer
    subgraph "Backend (Laravel API)" 
        direction TB
        PublicEntryPoint["Public Web Entry Point"] 
        ApiRoutes["API Routes (api.php)"] 
        AuthMiddleware["Auth Middleware (Email Verification)"] 
        subgraph "Controllers"
            direction TB
            AuthControllers["Authentication Controllers"] 
            GeocodeController["Geocoding Controller"] 
            PositionController["Position Management Controller"] 
            VendorController["Vendor Management Controller"] 
            ProductController["Product Management Controller"] 
            ReportController["Report Management Controller"] 
            ReportProductController["Report-Product Association Controller"] 
            UserController["User Management Controller"] 
        end
        Requests["Request Validation Classes"] 
        ApiFormatter["API Response Formatter Helper"] 
        Models["Eloquent Models"] 
        MigrationsSeeders["DB Migrations, Seeders & Factories"] 
        SanctumConfig["Sanctum Configuration"] 
    end

    %% Database
    DB["MySQL/PostgreSQL"]:::db

    %% External Services
    subgraph "External Services"
        direction TB
        ExternalGeocodeAPI["Geocoding API Service"] 
        MapTileProvider["Map Tile Provider"] 
    end

    %% Frontend Flow
    Browser --> NextJS
    NextJS --> UIComponents
    UIComponents --> Hooks
    UIComponents --> MapComponent
    UIComponents --> Modal
    UIComponents --> StateStore
    UIComponents --> Axios
    NextJS --> TailwindConfig
    Axios --> ApiRoutes

    %% Backend Flow
    PublicEntryPoint --> ApiRoutes
    ApiRoutes --> AuthMiddleware
    AuthMiddleware --> AuthControllers
    AuthMiddleware --> UserController
    AuthMiddleware --> SanctumConfig
    AuthControllers --> ApiFormatter
    AuthControllers --> Models
    GeocodeController --> ApiFormatter
    GeocodeController --> Models
    GeocodeController --> ExternalGeocodeAPI
    PositionController --> ApiFormatter
    PositionController --> Models
    VendorController --> ApiFormatter
    VendorController --> Models
    ProductController --> ApiFormatter
    ProductController --> Models
    ReportController --> ApiFormatter
    ReportController --> Models
    ReportProductController --> ApiFormatter
    ReportProductController --> Models
    UserController --> ApiFormatter
    UserController --> Models
    ApiFormatter --> Models
    Models --> DB
    MigrationsSeeders --> DB

    %% Frontend to External
    MapComponent --> MapTileProvider

    %% Click Events
    click Browser "https://github.com/muhamadafghan/dukung-lokal/tree/main/frontend/src/app"
    click UIComponents "https://github.com/muhamadafghan/dukung-lokal/tree/main/frontend/src/components/ui"
    click MapComponent "https://github.com/muhamadafghan/dukung-lokal/blob/main/frontend/src/components/Map/index.js"
    click Modal "https://github.com/muhamadafghan/dukung-lokal/blob/main/frontend/src/components/ModalLocationPermission/index.js"
    click Hooks "https://github.com/muhamadafghan/dukung-lokal/tree/main/frontend/src/hook"
    click Axios "https://github.com/muhamadafghan/dukung-lokal/blob/main/frontend/src/lib/axios.js"
    click StateStore "https://github.com/muhamadafghan/dukung-lokal/tree/main/frontend/src/store"
    click TailwindConfig "https://github.com/muhamadafghan/dukung-lokal/blob/main/frontend/tailwind.config.js"
    click ApiRoutes "https://github.com/muhamadafghan/dukung-lokal/blob/main/backend/routes/api.php"
    click AuthControllers "https://github.com/muhamadafghan/dukung-lokal/tree/main/backend/app/Http/Controllers/Auth"
    click GeocodeController "https://github.com/muhamadafghan/dukung-lokal/blob/main/backend/app/Http/Controllers/GeocodeController.php"
    click PositionController "https://github.com/muhamadafghan/dukung-lokal/blob/main/backend/app/Http/Controllers/PositionController.php"
    click VendorController "https://github.com/muhamadafghan/dukung-lokal/blob/main/backend/app/Http/Controllers/VendorController.php"
    click ProductController "https://github.com/muhamadafghan/dukung-lokal/blob/main/backend/app/Http/Controllers/ProductController.php"
    click ReportController "https://github.com/muhamadafghan/dukung-lokal/blob/main/backend/app/Http/Controllers/ReportController.php"
    click ReportProductController "https://github.com/muhamadafghan/dukung-lokal/blob/main/backend/app/Http/Controllers/ReportProductController.php"
    click UserController "https://github.com/muhamadafghan/dukung-lokal/blob/main/backend/app/Http/Controllers/UserController.php"
    click Requests "https://github.com/muhamadafghan/dukung-lokal/tree/main/backend/app/Http/Requests"
    click ApiFormatter "https://github.com/muhamadafghan/dukung-lokal/blob/main/backend/app/Helpers/ApiFormatter.php"
    click Models "https://github.com/muhamadafghan/dukung-lokal/tree/main/backend/app/Models"
    click MigrationsSeeders "https://github.com/muhamadafghan/dukung-lokal/tree/main/backend/database/migrations"
    click SanctumConfig "https://github.com/muhamadafghan/dukung-lokal/blob/main/backend/config/sanctum.php"
    click PublicEntryPoint "https://github.com/muhamadafghan/dukung-lokal/blob/main/backend/public/index.php"
    click TailwindConfig "https://github.com/muhamadafghan/dukung-lokal/blob/main/backend/tailwind.config.js"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#333,stroke-width:1px
    classDef backend fill:#D0FFD8,stroke:#333,stroke-width:1px
    classDef external fill:#FFE0B2,stroke:#333,stroke-width:1px
    classDef db fill:#E0E0E0,stroke:#333,stroke-width:1px

    class Browser,NextJS,UIComponents,Hooks,MapComponent,Modal,StateStore,Axios,TailwindConfig frontend
    class PublicEntryPoint,ApiRoutes,AuthMiddleware,AuthControllers,GeocodeController,PositionController,VendorController,ProductController,ReportController,ReportProductController,UserController,Requests,ApiFormatter,Models,MigrationsSeeders,SanctumConfig backend
    class ExternalGeocodeAPI,MapTileProvider external
    class DB db
```
