# fajarghifar/inventory-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/fajarghifar/inventory-management-system
- Repository: https://github.com/fajarghifar/inventory-management-system

## Overview

##### Project type and purpose
- This is a full-stack web application (“Inventory Management System”) built on Laravel 10 with a Blade/Livewire frontend and MySQL backend.
- Its primary functions are POS operations, order management, purchasing, product/customer/supplier records, and reporting.

##### File structure
- Top-level directories:
- app – business logic (Models, Controllers, Enums, Helpers, Livewire components, Console commands, Exceptions)
- resources – views (Blade templates & Livewire includes), frontend assets (CSS/JS)
- public – compiled assets, third-party libraries, entry point (index.php)
- database – migrations, seeders, factories
- config – environment and service configuration
- routes – HTTP/web, API, console, channels
- tests – Feature and Unit tests
- Dockerfile/docker-compose.yml – containerization

- Architectural hints:
- MVC pattern in app/Http (Controllers, Requests, Middleware) and app/Models
- Livewire SPA components under app/Livewire for reactive UIs
- API versioning (app/Http/Controllers/API/V1)
- Service providers and event broadcasting (app/Providers)

##### README for additional insights
- Confirms Laravel + MySQL stack
- Highlights Docker support for both app and DB
- Describes key features: POS, order/purchase workflows, product/customer/supplier management

##### Detail
- Core modules: Authentication, Products, Orders, Purchases, Quotation, Cart, Reporting.
- Livewire modules as sub-components of the application layer.
- Docker network layer (bridge) if relevant for deployment.
- Don’t omit the asset pipeline (npm/Vite → public/dist) if this is important for performance or caching.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    subgraph "Client (Browser)" 
        direction TB
        Views["Blade Templates\n(resources/views)"]:::ui
        JS["JS Entry\n(resources/js/app.js)"]:::ui
        CSS["CSS Entry\n(resources/css/app.css)"]:::ui
        ViteDist["Compiled Assets\n(public/dist)"]:::ui
        Assets["Static Assets\n(public/assets)"]:::ui
    end

    Browser["Browser"]:::ui
    Browser -->|loads assets| Views
    Browser --> ViteDist
    Browser --> Assets
    Browser --> JS
    Browser --> CSS

    %% Docker and Server
    subgraph "Docker Environment"
        direction TB
        AppContainer["App Container\n(docker-compose.yml)"]:::app
        DBContainer["MySQL Container"]:::db
    end

    Browser -->|HTTP Request| AppContainer
    AppContainer -->|serves via| Nginx["Nginx/Apache\n(PHP-FPM)"]:::app
    Nginx --> PHPFPM["PHP-FPM"]:::app
    PHPFPM --> Index["Front Controller\n(public/index.php)"]:::app

    %% Application Layer
    subgraph "Laravel Application" 
        direction TB
        Kernel["HTTP Kernel\n(app/Http/Kernel.php)"]:::app
        Middleware["Middleware\n(app/Http/Middleware)"]:::app
        Router["Router\n(routes/web.php, routes/api.php)"]:::app
        Controllers["Controllers\n(app/Http/Controllers)"]:::app
        APIController["API V1 Controllers\n(app/Http/Controllers/API/V1)"]:::app
        Requests["Form Requests\n(app/Http/Requests)"]:::app
        Livewire["Livewire Components\n(app/Livewire)"]:::app
        LWViews["Livewire Views\n(resources/views/livewire)"]:::ui
        Models["Eloquent Models\n(app/Models)"]:::app
        Providers["Service Providers\n(app/Providers)"]:::app
        ConfigApp["App Config\n(config/app.php)"]:::app
    end

    Index --> Kernel
    Kernel --> Middleware
    Middleware --> Router
    Router --> Controllers
    Router --> APIController
    Router --> Livewire
    Livewire --> LWViews
    Controllers --> Requests
    Controllers --> Models
    APIController --> Models
    Livewire --> Models

    %% Data Stores
    subgraph "Data Stores" 
        direction TB
        MySQL["MySQL Database"]:::db
        Migrations["Migrations\n(database/migrations)"]:::db
        Seeders["Seeders\n(database/seeders)"]:::db
        Factories["Factories\n(database/factories)"]:::db
        DBConfig["DB Config\n(config/database.php)"]:::db
        Redis["Redis Cache/Queue"]:::db_ext
        CacheCfg["Cache Config\n(config/cache.php)"]:::db
        QueueCfg["Queue Config\n(config/queue.php)"]:::db
        StorageLocal["Local Storage\n(storage/app)"]:::db
        InvoiceAssets["Invoice Templates\n(public/assets/invoice)"]:::db
        FSConfig["Filesystem Config\n(config/filesystems.php)"]:::db
    end

    Models --> MySQL
    Migrations --> MySQL
    Seeders --> MySQL
    Factories --> MySQL
    DBConfig --- MySQL
    Controllers --> Redis
    Redis --> QueueCfg
    Redis --> CacheCfg
    Livewire --> StorageLocal
    StorageLocal --> InvoiceAssets
    FSConfig --- StorageLocal

    %% External Services
    subgraph "External Services" 
        direction TB
        Mail["SMTP Service"]:::ext
        Broadcast["Pusher/Echo"]:::ext
        ServicesCfg["Third-party Services\n(config/services.php)"]:::app
    end

    Controllers -->|sends mail| Mail
    Controllers -->|broadcast events| Broadcast
    ServicesCfg --- Mail
    ServicesCfg --- Broadcast

    %% Testing
    subgraph "Testing Suite"
        direction TB
        TestsFeature["Feature Tests\n(tests/Feature)"]:::app
        TestsUnit["Unit Tests\n(tests/Unit)"]:::app
        PHPUnitCfg["phpunit.xml"]:::app
        BaseTest["Base TestCase\n(tests/TestCase.php)"]:::app
    end
    TestsFeature --> BaseTest
    TestsUnit --> BaseTest
    PHPUnitCfg --- TestsFeature
    PHPUnitCfg --- TestsUnit

    %% Connections between Containers
    AppContainer --> DBContainer
    AppContainer -->|networks| Redis

    %% Click Events
    click Views "https://github.com/fajarghifar/inventory-management-system/tree/main/resources/views"
    click JS "https://github.com/fajarghifar/inventory-management-system/blob/main/resources/js/app.js"
    click CSS "https://github.com/fajarghifar/inventory-management-system/blob/main/resources/css/app.css"
    click ViteDist "https://github.com/fajarghifar/inventory-management-system/tree/main/public/dist"
    click Assets "https://github.com/fajarghifar/inventory-management-system/tree/main/public/assets"
    click AppContainer "https://github.com/fajarghifar/inventory-management-system/blob/main/docker-compose.yml"
    click Index "https://github.com/fajarghifar/inventory-management-system/blob/main/public/index.php"
    click Router "https://github.com/fajarghifar/inventory-management-system/blob/main/routes/web.php"
    click APIController "https://github.com/fajarghifar/inventory-management-system/blob/main/app/Http/Controllers/API/V1/ProductController.php"
    click Middleware "https://github.com/fajarghifar/inventory-management-system/blob/main/app/Http/Middleware/Authenticate.php"
    click Controllers "https://github.com/fajarghifar/inventory-management-system/blob/main/app/Http/Controllers/CategoryController.php"
    click Requests "https://github.com/fajarghifar/inventory-management-system/blob/main/app/Http/Requests/StoreProductRequest.php"
    click Livewire "https://github.com/fajarghifar/inventory-management-system/blob/main/app/Livewire/OrderForm.php"
    click LWViews "https://github.com/fajarghifar/inventory-management-system/tree/main/resources/views/livewire"
    click Models "https://github.com/fajarghifar/inventory-management-system/blob/main/app/Models/Product.php"
    click Providers "https://github.com/fajarghifar/inventory-management-system/blob/main/app/Providers/AppServiceProvider.php"
    click ConfigApp "https://github.com/fajarghifar/inventory-management-system/blob/main/config/app.php"
    click Migrations "https://github.com/fajarghifar/inventory-management-system/tree/main/database/migrations"
    click Seeders "https://github.com/fajarghifar/inventory-management-system/blob/main/database/seeders/DatabaseSeeder.php"
    click Factories "https://github.com/fajarghifar/inventory-management-system/blob/main/database/factories/ProductFactory.php"
    click DBConfig "https://github.com/fajarghifar/inventory-management-system/blob/main/config/database.php"
    click CacheCfg "https://github.com/fajarghifar/inventory-management-system/blob/main/config/cache.php"
    click QueueCfg "https://github.com/fajarghifar/inventory-management-system/blob/main/config/queue.php"
    click FSConfig "https://github.com/fajarghifar/inventory-management-system/blob/main/config/filesystems.php"
    click StorageLocal "https://github.com/fajarghifar/inventory-management-system/tree/main/storage/app"
    click InvoiceAssets "https://github.com/fajarghifar/inventory-management-system/tree/main/public/assets/invoice"
    click ServicesCfg "https://github.com/fajarghifar/inventory-management-system/blob/main/config/services.php"
    click TestsFeature "https://github.com/fajarghifar/inventory-management-system/tree/main/tests/Feature"
    click TestsUnit "https://github.com/fajarghifar/inventory-management-system/tree/main/tests/Unit"
    click PHPUnitCfg "https://github.com/fajarghifar/inventory-management-system/blob/main/phpunit.xml"
    click BaseTest "https://github.com/fajarghifar/inventory-management-system/blob/main/tests/TestCase.php"

    %% Styles
    classDef ui fill:lightgreen,stroke:#333,stroke-width:1px
    classDef app fill:lightblue,stroke:#333,stroke-width:1px
    classDef db fill:lightcoral,stroke:#333,stroke-width:1px
    classDef ext stroke-dasharray: 5 5,stroke:gray
    classDef db_ext stroke-dasharray:5 5,stroke:gray,fill:lightcoral
```
