# ali00209/laravel_dms architecture

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

- Interactive diagram: https://gitdiagram.com/ali00209/laravel_dms
- Repository: https://github.com/ali00209/laravel_dms

## Overview

DMS is a multi-tenant retail and distribution operations API. Users work within an organization and selected business context; API requests manage catalog, pricing, stock, and business documents through approval and posting, with accounting and logistics capabilities around that lifecycle. The graph highlights documented domain stages and sampled service calls. Several subsystems are represented at directory level because their implementation was not excerpted; those links are included only where the README or source index supports them.

Main entry points: [`app/Services/Inventory/Core/StockMovementService.php`](https://github.com/ali00209/laravel_dms/blob/main/app/Services/Inventory/Core/StockMovementService.php) (Stock movement), [`app/Http/Controllers/v1/api/BaseApiController.php`](https://github.com/ali00209/laravel_dms/blob/main/app/Http/Controllers/v1/api/BaseApiController.php) (API base), [`app/Services/Accounts/AccountingService.php`](https://github.com/ali00209/laravel_dms/blob/main/app/Services/Accounts/AccountingService.php) (Double-entry accounting), [`app/Models/Inventory/InventoryBalance.php`](https://github.com/ali00209/laravel_dms/blob/main/app/Models/Inventory/InventoryBalance.php) (Stock balances)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and organization"]
  node_api["API base"]
  node_auth["Identity and context"]
  node_org[("Organization hierarchy<br/>[Organization.php]")]
end

subgraph group_inventory["Inventory and pricing"]
  node_catalog[("Product catalog<br/>[ProductVariant.php]")]
  node_stock[("Stock balances")]
  node_stockquery["Stock queries"]
  node_reservation["Reservations"]
  node_stockengine["Stock movement"]
  node_valuation["Stock valuation"]
  node_pricing["Pricing and promotions"]
end

subgraph group_documents["Documents and logistics"]
  node_saleapi["Sales API"]
  node_sales["Sales workflow"]
  node_purchasing[("Purchasing documents<br/>[PurchaseOrder.php]")]
  node_delivery["Delivery and returns"]
  node_workflow["Document workflow"]
end

subgraph group_finance["Governance and finance"]
  node_governance["Policy governance"]
  node_accountsapi["Accounts API"]
  node_accounting["Double-entry accounting"]
  node_reporting["Operational reports<br/>[AgingService.php]"]
end

node_user(("Business user"))

node_user -->|"calls API"| node_api
node_api -->|"checks authorization"| node_auth
node_org -->|"owns catalog"| node_catalog
node_stockquery -->|"queries balances"| node_stock
node_reservation -->|"updates reservations"| node_stock
node_stockengine -->|"updates balances"| node_stock
node_valuation -->|"records movements"| node_stockengine
node_saleapi -->|"calls service"| node_sales
node_saleapi -.->|"advances documents"| node_workflow
node_purchasing -.->|"receives stock"| node_stockengine
node_delivery -.->|"moves goods"| node_stockengine
node_pricing -.->|"prices products"| node_catalog
node_governance -.->|"governs actions"| node_api
node_accountsapi -->|"calls service"| node_accounting
node_accounting -.->|"supplies aging"| node_reporting
node_sales -.->|"posts journals"| node_accounting

click node_api "https://github.com/ali00209/laravel_dms/blob/main/app/Http/Controllers/v1/api/BaseApiController.php"
click node_auth "https://github.com/ali00209/laravel_dms/tree/main/app/Services/Auth"
click node_org "https://github.com/ali00209/laravel_dms/blob/main/app/Models/Core/Organization.php"
click node_catalog "https://github.com/ali00209/laravel_dms/blob/main/app/Models/Inventory/ProductVariant.php"
click node_stock "https://github.com/ali00209/laravel_dms/blob/main/app/Models/Inventory/InventoryBalance.php"
click node_stockquery "https://github.com/ali00209/laravel_dms/blob/main/app/Services/Inventory/StockQueryService.php"
click node_reservation "https://github.com/ali00209/laravel_dms/blob/main/app/Services/Inventory/Reservation/ReservationEngine.php"
click node_stockengine "https://github.com/ali00209/laravel_dms/blob/main/app/Services/Inventory/Core/StockMovementService.php"
click node_valuation "https://github.com/ali00209/laravel_dms/tree/main/app/Services/Inventory/Valuation"
click node_pricing "https://github.com/ali00209/laravel_dms/tree/main/app/Services/Inventory/Pricing"
click node_saleapi "https://github.com/ali00209/laravel_dms/blob/main/app/Http/Controllers/v1/api/Voucher/SaleOrderController.php"
click node_sales "https://github.com/ali00209/laravel_dms/tree/main/app/Services/Voucher"
click node_purchasing "https://github.com/ali00209/laravel_dms/blob/main/app/Models/Vouchers/PurchaseOrder.php"
click node_delivery "https://github.com/ali00209/laravel_dms/tree/main/app/Http/Controllers/v1/api/Logistics"
click node_workflow "https://github.com/ali00209/laravel_dms/blob/main/app/Traits/HasDocumentWorkflow.php"
click node_governance "https://github.com/ali00209/laravel_dms/tree/main/app/Services/Policy"
click node_accountsapi "https://github.com/ali00209/laravel_dms/blob/main/app/Http/Controllers/v1/api/Account/AccountController.php"
click node_accounting "https://github.com/ali00209/laravel_dms/blob/main/app/Services/Accounts/AccountingService.php"
click node_reporting "https://github.com/ali00209/laravel_dms/blob/main/app/Services/Accounts/AgingService.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_auth,node_org,node_user toneBlue
class node_catalog,node_stock,node_stockquery,node_reservation,node_stockengine,node_valuation,node_pricing toneAmber
class node_saleapi,node_sales,node_purchasing,node_delivery,node_workflow toneMint
class node_governance,node_accountsapi,node_accounting,node_reporting toneRose
```

## Components

### Access and organization

- [API base](https://github.com/ali00209/laravel_dms/blob/main/app/Http/Controllers/v1/api/BaseApiController.php): `app/Http/Controllers/v1/api/BaseApiController.php`
- [Identity and context](https://github.com/ali00209/laravel_dms/tree/main/app/Services/Auth): `app/Services/Auth`
- [Organization hierarchy](https://github.com/ali00209/laravel_dms/blob/main/app/Models/Core/Organization.php): `app/Models/Core/Organization.php`

### Inventory and pricing

- [Product catalog](https://github.com/ali00209/laravel_dms/blob/main/app/Models/Inventory/ProductVariant.php): `app/Models/Inventory/ProductVariant.php`
- [Stock balances](https://github.com/ali00209/laravel_dms/blob/main/app/Models/Inventory/InventoryBalance.php): `app/Models/Inventory/InventoryBalance.php`
- [Stock queries](https://github.com/ali00209/laravel_dms/blob/main/app/Services/Inventory/StockQueryService.php): `app/Services/Inventory/StockQueryService.php`
- [Reservations](https://github.com/ali00209/laravel_dms/blob/main/app/Services/Inventory/Reservation/ReservationEngine.php): `app/Services/Inventory/Reservation/ReservationEngine.php`
- [Stock movement](https://github.com/ali00209/laravel_dms/blob/main/app/Services/Inventory/Core/StockMovementService.php): `app/Services/Inventory/Core/StockMovementService.php`
- [Stock valuation](https://github.com/ali00209/laravel_dms/tree/main/app/Services/Inventory/Valuation): `app/Services/Inventory/Valuation`
- [Pricing and promotions](https://github.com/ali00209/laravel_dms/tree/main/app/Services/Inventory/Pricing): `app/Services/Inventory/Pricing`

### Documents and logistics

- [Sales API](https://github.com/ali00209/laravel_dms/blob/main/app/Http/Controllers/v1/api/Voucher/SaleOrderController.php): `app/Http/Controllers/v1/api/Voucher/SaleOrderController.php`
- [Sales workflow](https://github.com/ali00209/laravel_dms/tree/main/app/Services/Voucher): `app/Services/Voucher`
- [Purchasing documents](https://github.com/ali00209/laravel_dms/blob/main/app/Models/Vouchers/PurchaseOrder.php): `app/Models/Vouchers/PurchaseOrder.php`
- [Delivery and returns](https://github.com/ali00209/laravel_dms/tree/main/app/Http/Controllers/v1/api/Logistics): `app/Http/Controllers/v1/api/Logistics`
- [Document workflow](https://github.com/ali00209/laravel_dms/blob/main/app/Traits/HasDocumentWorkflow.php): `app/Traits/HasDocumentWorkflow.php`

### Governance and finance

- [Policy governance](https://github.com/ali00209/laravel_dms/tree/main/app/Services/Policy): `app/Services/Policy`
- [Accounts API](https://github.com/ali00209/laravel_dms/blob/main/app/Http/Controllers/v1/api/Account/AccountController.php): `app/Http/Controllers/v1/api/Account/AccountController.php`
- [Double-entry accounting](https://github.com/ali00209/laravel_dms/blob/main/app/Services/Accounts/AccountingService.php): `app/Services/Accounts/AccountingService.php`
- [Operational reports](https://github.com/ali00209/laravel_dms/blob/main/app/Services/Accounts/AgingService.php): `app/Services/Accounts/AgingService.php`

### Other components

- **Business user**

## Connections

- Business user → API base: calls API
- API base → Identity and context: checks authorization (evidence: `app/Http/Controllers/v1/api/BaseApiController.php`)
- Organization hierarchy → Product catalog: owns catalog (evidence: `app/Models/Core/Organization.php`)
- Stock queries → Stock balances: queries balances (evidence: `app/Services/Inventory/StockQueryService.php`)
- Reservations → Stock balances: updates reservations (evidence: `app/Services/Inventory/Reservation/ReservationEngine.php`)
- Stock movement → Stock balances: updates balances (evidence: `app/Services/Inventory/Core/StockMovementService.php`)
- Stock valuation → Stock movement: records movements (evidence: `app/Services/Inventory/Valuation/FefoInventoryEngine.php`)
- Sales API → Sales workflow: calls service (evidence: `app/Http/Controllers/v1/api/Voucher/SaleOrderController.php`)
- Sales API → Document workflow: advances documents
- Purchasing documents → Stock movement: receives stock
- Delivery and returns → Stock movement: moves goods
- Pricing and promotions → Product catalog: prices products
- Policy governance → API base: governs actions
- Accounts API → Double-entry accounting: calls service (evidence: `app/Http/Controllers/v1/api/Account/AccountController.php`)
- Double-entry accounting → Operational reports: supplies aging
- Sales workflow → Double-entry accounting: posts journals
