# hunghero32/erp-365 architecture

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

- Interactive diagram: https://gitdiagram.com/hunghero32/erp-365
- Repository: https://github.com/hunghero32/erp-365

## Overview

ERP-365 is a multi-branch enterprise management application spanning inventory, purchasing, sales, finance, CRM, HR, warranty service, and administration. The principal workflow is a staff member submitting an operational request, which a module controller delegates to business services that read or update persistent records; PO/SD and transfer flows also use Livewire components. The README documents AI assistance, external webhooks, and shared integrations as additional capabilities. The tree and selected excerpts support the module boundaries, but not detailed wiring among all services or integrations.

Main entry points: [`app/Models`](https://github.com/hunghero32/erp-365/tree/main/app/Models) (Business records), [`app/Livewire`](https://github.com/hunghero32/erp-365/tree/main/app/Livewire) (Operational UI flows), [`app/Services/AI`](https://github.com/hunghero32/erp-365/tree/main/app/Services/AI) (AI and retrieval services), [`app/Services/WMS`](https://github.com/hunghero32/erp-365/tree/main/app/Services/WMS) (Inventory services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Core Operations"]
  node_livewire["Operational UI flows"]
  node_wms["Inventory and products"]
  node_wms_service["Inventory services"]
end

subgraph group_business["Business Modules"]
  node_po["Purchasing"]
  node_po_service["Purchasing services"]
  node_sd["Sales and returns"]
  node_sd_service["Sales services"]
  node_crm["Customer relations"]
  node_crm_service["CRM services"]
  node_fa["Finance and reports"]
  node_fa_service["Finance services"]
end

subgraph group_people["People and Service"]
  node_hrm["Workforce management"]
  node_hrm_service["Workforce services"]
  node_asm["Warranty and testing"]
  node_asm_service["Warranty services"]
end

subgraph group_platform["Platform Services"]
  node_admin["Access and administration"]
  node_models[("Business records")]
  node_database[("MariaDB")]
  node_webhooks["Commerce webhooks"]
  node_shared["Notifications and shared tools"]
end

subgraph group_ai["AI Assistance"]
  node_ai_ui["AI assistant UI"]
  node_ai_services["AI and retrieval services"]
end

node_staff(("Staff member"))
node_external_commerce["Pancake and WooCommerce"]
node_ollama["Ollama LLM"]

node_staff -->|"uses"| node_livewire
node_staff -->|"submits request"| node_wms
node_staff -->|"submits request"| node_po
node_staff -->|"submits request"| node_sd
node_staff -->|"submits request"| node_crm
node_staff -->|"submits request"| node_fa
node_staff -->|"submits request"| node_hrm
node_staff -->|"submits request"| node_asm
node_staff -->|"administers"| node_admin
node_livewire -->|"business operations"| node_po_service
node_livewire -->|"business operations"| node_sd_service
node_livewire -->|"transfer flows"| node_wms_service
node_wms -->|"delegates"| node_wms_service
node_po -->|"delegates"| node_po_service
node_sd -->|"delegates"| node_sd_service
node_crm -->|"delegates"| node_crm_service
node_fa -->|"delegates"| node_fa_service
node_hrm -->|"delegates"| node_hrm_service
node_asm -->|"delegates"| node_asm_service
node_webhooks -->|"processes events"| node_crm_service
node_external_commerce -.->|"sends events"| node_webhooks
node_admin -->|"reads and updates"| node_models
node_wms_service -->|"reads and updates"| node_models
node_po_service -->|"reads and updates"| node_models
node_sd_service -->|"reads and updates"| node_models
node_crm_service -->|"reads and updates"| node_models
node_fa_service -->|"reads and updates"| node_models
node_hrm_service -->|"reads and updates"| node_models
node_asm_service -->|"reads and updates"| node_models
node_models -->|"persists records"| node_database
node_staff -->|"asks questions"| node_ai_ui
node_ai_ui -->|"submits query"| node_ai_services
node_ai_services -.->|"requests generation"| node_ollama
node_ai_services -->|"retrieves business context"| node_database
node_shared -->|"uses shared records"| node_models

click node_livewire "https://github.com/hunghero32/erp-365/tree/main/app/Livewire"
click node_wms "https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/WMS"
click node_wms_service "https://github.com/hunghero32/erp-365/tree/main/app/Services/WMS"
click node_po "https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/PO"
click node_po_service "https://github.com/hunghero32/erp-365/tree/main/app/Services/PO"
click node_sd "https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/SD"
click node_sd_service "https://github.com/hunghero32/erp-365/tree/main/app/Services/SD"
click node_crm "https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/CRM"
click node_crm_service "https://github.com/hunghero32/erp-365/tree/main/app/Services/CRM"
click node_fa "https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/FA"
click node_fa_service "https://github.com/hunghero32/erp-365/tree/main/app/Services/FA"
click node_hrm "https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/HRM"
click node_hrm_service "https://github.com/hunghero32/erp-365/tree/main/app/Services/HRM"
click node_asm "https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/ASM"
click node_asm_service "https://github.com/hunghero32/erp-365/tree/main/app/Services/ASM"
click node_admin "https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/ADMIN"
click node_models "https://github.com/hunghero32/erp-365/tree/main/app/Models"
click node_webhooks "https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/CRM"
click node_shared "https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/SHARE"
click node_ai_ui "https://github.com/hunghero32/erp-365/blob/main/app/Livewire/GlobalAiAssistant.php"
click node_ai_services "https://github.com/hunghero32/erp-365/tree/main/app/Services/AI"

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_livewire,node_wms,node_wms_service toneBlue
class node_po,node_po_service,node_sd,node_sd_service,node_crm,node_crm_service,node_fa,node_fa_service toneAmber
class node_hrm,node_hrm_service,node_asm,node_asm_service toneMint
class node_admin,node_models,node_database,node_webhooks,node_shared toneRose
class node_ai_ui,node_ai_services,node_staff,node_external_commerce,node_ollama toneIndigo
```

## Components

### Core Operations

- [Operational UI flows](https://github.com/hunghero32/erp-365/tree/main/app/Livewire): `app/Livewire`
- [Inventory and products](https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/WMS): `app/Http/Controllers/WMS`
- [Inventory services](https://github.com/hunghero32/erp-365/tree/main/app/Services/WMS): `app/Services/WMS`

### Business Modules

- [Purchasing](https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/PO): `app/Http/Controllers/PO`
- [Purchasing services](https://github.com/hunghero32/erp-365/tree/main/app/Services/PO): `app/Services/PO`
- [Sales and returns](https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/SD): `app/Http/Controllers/SD`
- [Sales services](https://github.com/hunghero32/erp-365/tree/main/app/Services/SD): `app/Services/SD`
- [Customer relations](https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/CRM): `app/Http/Controllers/CRM`
- [CRM services](https://github.com/hunghero32/erp-365/tree/main/app/Services/CRM): `app/Services/CRM`
- [Finance and reports](https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/FA): `app/Http/Controllers/FA`
- [Finance services](https://github.com/hunghero32/erp-365/tree/main/app/Services/FA): `app/Services/FA`

### People and Service

- [Workforce management](https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/HRM): `app/Http/Controllers/HRM`
- [Workforce services](https://github.com/hunghero32/erp-365/tree/main/app/Services/HRM): `app/Services/HRM`
- [Warranty and testing](https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/ASM): `app/Http/Controllers/ASM`
- [Warranty services](https://github.com/hunghero32/erp-365/tree/main/app/Services/ASM): `app/Services/ASM`

### Platform Services

- [Access and administration](https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/ADMIN): `app/Http/Controllers/ADMIN`
- [Business records](https://github.com/hunghero32/erp-365/tree/main/app/Models): `app/Models`
- **MariaDB**
- [Commerce webhooks](https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/CRM): `app/Http/Controllers/CRM`
- [Notifications and shared tools](https://github.com/hunghero32/erp-365/tree/main/app/Http/Controllers/SHARE): `app/Http/Controllers/SHARE`

### AI Assistance

- [AI assistant UI](https://github.com/hunghero32/erp-365/blob/main/app/Livewire/GlobalAiAssistant.php): `app/Livewire/GlobalAiAssistant.php`
- [AI and retrieval services](https://github.com/hunghero32/erp-365/tree/main/app/Services/AI): `app/Services/AI`

### Other components

- **Staff member**
- **Pancake and WooCommerce**
- **Ollama LLM**

## Connections

- Staff member → Operational UI flows: uses
- Staff member → Inventory and products: submits request
- Staff member → Purchasing: submits request
- Staff member → Sales and returns: submits request
- Staff member → Customer relations: submits request
- Staff member → Finance and reports: submits request
- Staff member → Workforce management: submits request
- Staff member → Warranty and testing: submits request
- Staff member → Access and administration: administers
- Operational UI flows → Purchasing services: business operations
- Operational UI flows → Sales services: business operations
- Operational UI flows → Inventory services: transfer flows
- Inventory and products → Inventory services: delegates
- Purchasing → Purchasing services: delegates
- Sales and returns → Sales services: delegates
- Customer relations → CRM services: delegates
- Finance and reports → Finance services: delegates
- Workforce management → Workforce services: delegates
- Warranty and testing → Warranty services: delegates
- Commerce webhooks → CRM services: processes events
- Pancake and WooCommerce → Commerce webhooks: sends events
- Access and administration → Business records: reads and updates
- Inventory services → Business records: reads and updates
- Purchasing services → Business records: reads and updates
- Sales services → Business records: reads and updates
- CRM services → Business records: reads and updates
- Finance services → Business records: reads and updates
- Workforce services → Business records: reads and updates
- Warranty services → Business records: reads and updates
- Business records → MariaDB: persists records
- Staff member → AI assistant UI: asks questions
- AI assistant UI → AI and retrieval services: submits query
- AI and retrieval services → Ollama LLM: requests generation
- AI and retrieval services → MariaDB: retrieves business context
- Notifications and shared tools → Business records: uses shared records
