# ekramasif/inventory_management_system architecture

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

- Interactive diagram: https://gitdiagram.com/ekramasif/inventory_management_system
- Repository: https://github.com/ekramasif/inventory_management_system

## Overview

##### Main System Components

a) Frontend Layer:
- Two distinct frontend interfaces:
- Admin Dashboard (/public/backend)
- Customer/Public Interface (/public/frontend)

b) Application Layer:
- Controllers (app/Http/Controllers)
- Product Management
- Customer Management
- Order Management
- Invoice Management
- Authentication
- Middleware Layer (app/Http/Middleware)
- Models (app/Models)

c) Database Layer:
- Core Tables:
- Products
- Customers
- Orders
- Invoices
- Users

##### Component Relationships

- User requests → Middleware → Controllers
- Controllers → Models → Database
- Controllers → Views (resources/views)
- Authentication flow between components

##### Architectural Pattern Representation

- Models (app/Models)
- Views (resources/views)
- Controllers (app/Http/Controllers)

##### Specific Implementation Details

Elements:
**┌─────────────────────────────────────────────┐**
- Client Layer                │
- ┌────────────────┐    ┌──────────────┐  │
- Admin Frontend │    │Public Frontend│  │
- ┘    └──────────────┘  │
- ┬───────────────┬──────────┘

**┌─────────────────▼───────────────▼──────────┐**
- HTTP Layer                     │
- ┌────────────────────────────────┐       │
- Middleware Stack        │       │
- ┘       │
- ┬──────────────────────┘

**┌─────────────────────▼──────────────────────┐**
- Application Layer                 │
- ┌─────────────┐  ┌────────────────────┐   │
- Controllers │◄─┤Service Providers   │   │
- ┬──────┘  └────────────────────┘   │

- ┌──────▼──────┐                           │
- Models    │                           │
- ┬──────┘                           │
- ┼────────────────────────────────┘

**┌─────────▼────────────────────────────────┐**
- Database Layer                 │
- ┌─────────────┐  ┌─────────────┐        │
- Products   │  │  Customers  │        │
- ┘  └─────────────┘        │
- ┌─────────────┐  ┌─────────────┐        │
- Orders    │  │  Invoices   │        │
- ┘  └─────────────┘        │
- ┘

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        AF["Admin Frontend"]:::frontend
        PF["Public Frontend"]:::frontend
    end

    subgraph "HTTP Layer"
        MW["Middleware Stack"]:::middleware
        Auth["Authentication"]:::security
    end

    subgraph "Application Layer"
        subgraph Controllers
            PC["Product Controller"]:::controller
            CC["Customer Controller"]:::controller
            OC["Order Controller"]:::controller
            IC["Invoice Controller"]:::controller
            AuthC["Auth Controllers"]:::controller
        end

        subgraph Models
            PM["Product Model"]:::model
            CM["Customer Model"]:::model
            OM["Order Model"]:::model
            IM["Invoice Model"]:::model
        end

        subgraph Views
            PV["Product Views"]:::view
            CV["Customer Views"]:::view
            OV["Order Views"]:::view
            IV["Invoice Views"]:::view
            AuthV["Auth Views"]:::view
        end

        API["API Layer"]:::api
    end

    subgraph "Database Layer"
        Products[(Products)]:::database
        Customers[(Customers)]:::database
        Orders[(Orders)]:::database
        Invoices[(Invoices)]:::database
        Users[(Users)]:::database
    end

    %% Relationships
    AF & PF --> MW
    MW --> Auth
    Auth --> AuthC
    MW --> PC & CC & OC & IC
    
    PC --> PM --> Products
    CC --> CM --> Customers
    OC --> OM --> Orders
    IC --> IM --> Invoices
    AuthC --> Users

    PC --> PV
    CC --> CV
    OC --> OV
    IC --> IV
    AuthC --> AuthV

    API --> PC & CC & OC & IC

    %% Click Events
    click AF "https://github.com/ekramasif/Inventory_Management_System/tree/main/public/backend"
    click PF "https://github.com/ekramasif/Inventory_Management_System/tree/main/public/frontend"
    click PC "https://github.com/ekramasif/Inventory_Management_System/blob/main/app/Http/Controllers/ProductController.php"
    click CC "https://github.com/ekramasif/Inventory_Management_System/blob/main/app/Http/Controllers/CustomerController.php"
    click OC "https://github.com/ekramasif/Inventory_Management_System/blob/main/app/Http/Controllers/OrderController.php"
    click IC "https://github.com/ekramasif/Inventory_Management_System/blob/main/app/Http/Controllers/InvoiceController.php"
    click AuthC "https://github.com/ekramasif/Inventory_Management_System/tree/main/app/Http/Controllers/Auth"
    click PM "https://github.com/ekramasif/Inventory_Management_System/blob/main/app/Models/Product.php"
    click CM "https://github.com/ekramasif/Inventory_Management_System/blob/main/app/Models/Customer.php"
    click OM "https://github.com/ekramasif/Inventory_Management_System/blob/main/app/Models/Order.php"
    click IM "https://github.com/ekramasif/Inventory_Management_System/blob/main/app/Models/Invoice.php"
    click PV "https://github.com/ekramasif/Inventory_Management_System/blob/main/resources/views/Admin/all_product.blade.php"
    click CV "https://github.com/ekramasif/Inventory_Management_System/blob/main/resources/views/Admin/all_customers.blade.php"
    click OV "https://github.com/ekramasif/Inventory_Management_System/blob/main/resources/views/Admin/all_orders.blade.php"
    click IV "https://github.com/ekramasif/Inventory_Management_System/blob/main/resources/views/Admin/all_invoices.blade.php"
    click AuthV "https://github.com/ekramasif/Inventory_Management_System/tree/main/resources/views/auth"
    click Auth "https://github.com/ekramasif/Inventory_Management_System/blob/main/app/Http/Middleware/Authenticate.php"
    click API "https://github.com/ekramasif/Inventory_Management_System/blob/main/routes/api.php"

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef middleware fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef controller fill:#2ecc71,stroke:#27ae60,color:white
    classDef model fill:#e74c3c,stroke:#c0392b,color:white
    classDef view fill:#9b59b6,stroke:#8e44ad,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef api fill:#1abc9c,stroke:#16a085,color:white

    %% Legend
    subgraph Legend
        F["Frontend"]:::frontend
        M["Middleware"]:::middleware
        C["Controller"]:::controller
        Mo["Model"]:::model
        V["View"]:::view
        D["Database"]:::database
        S["Security"]:::security
        A["API"]:::api
    end
```
