# lehaziq/proerp architecture

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

- Interactive diagram: https://gitdiagram.com/lehaziq/proerp
- Repository: https://github.com/lehaziq/proerp

## Overview

ProCore ERP is a Laravel modular-monolith for company-scoped business operations. Users work through a Blade web interface or Sanctum API; the product covers customer and supplier records, inventory, invoices, payments, accounting, approvals, reporting, OCR, and dashboards. The README describes services as the business-logic layer and documents invoice and payment posting, stock deduction, and reporting capabilities. Many controller-to-service calls and integrations were not sampled, so those links are omitted or marked unverified rather than presented as confirmed call flow.

Main entry points: [`app/Models`](https://github.com/lehaziq/proerp/tree/main/app/Models) (ERP Records), [`routes/web.php`](https://github.com/lehaziq/proerp/blob/main/routes/web.php) (Web Routes), [`app/Http/Controllers/ProductController.php`](https://github.com/lehaziq/proerp/blob/main/app/Http/Controllers/ProductController.php) (Product Catalog), [`app/Services/InvoiceService.php`](https://github.com/lehaziq/proerp/blob/main/app/Services/InvoiceService.php) (Invoicing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Interfaces"]
  node_web_routes["Web Routes<br/>[web.php]"]
  node_api_routes["API Routes<br/>[api.php]"]
  node_web_ui["Blade ERP UI"]
  node_api_controllers["API Controllers"]
  node_auth["Authentication"]
end

subgraph group_operations["Business Operations"]
  node_customers["Customer CRM"]
  node_suppliers["Supplier Records"]
  node_products["Product Catalog"]
  node_inventory["Inventory"]
  node_invoicing["Invoicing<br/>[InvoiceService.php]"]
  node_ocr["OCR Uploads<br/>[OcrService.php]"]
  node_ai_context["AI Context"]
end

subgraph group_finance["Finance and Oversight"]
  node_payments["Payments<br/>[PaymentService.php]"]
  node_accounting["Accounting"]
  node_approvals["Approvals"]
  node_reports["Reports<br/>[ReportService.php]"]
  node_dashboard["Dashboard"]
end

subgraph group_platform["Shared Platform"]
  node_tenant["Company and Branch<br/>[CompanyProfile.php]"]
  node_audit["Audit Logging<br/>[AuditService.php]"]
  node_models[("ERP Records")]
  node_notifications["Notifications"]
  node_automation["Scheduled ERP Tasks"]
end

node_user(("ERP User"))
node_api_client(("API Client"))

node_user -->|"uses"| node_web_routes
node_web_routes -->|"serves"| node_web_ui
node_api_client -->|"calls"| node_api_routes
node_api_routes -.->|"routes"| node_api_controllers
node_web_routes -->|"routes"| node_auth
node_web_routes -.->|"routes"| node_customers
node_web_routes -.->|"routes"| node_products
node_api_controllers -->|"provides API"| node_customers
node_api_controllers -->|"provides API"| node_products
node_customers -.->|"uses records"| node_models
node_suppliers -.->|"uses records"| node_models
node_products -->|"uses records"| node_models
node_products -->|"logs changes"| node_audit
node_tenant -->|"scopes records"| node_models
node_invoicing -->|"uses records"| node_models
node_payments -->|"uses records"| node_models
node_accounting -->|"posts entries"| node_models
node_invoicing -->|"deducts stock"| node_inventory
node_invoicing -->|"posts journals"| node_accounting
node_payments -->|"posts journals"| node_accounting
node_approvals -->|"sends alerts"| node_notifications
node_approvals -->|"records actions"| node_audit
node_reports -.->|"reports on"| node_models
node_dashboard -.->|"summarizes"| node_models
node_ocr -->|"stores uploads"| node_models
node_ai_context -->|"builds context"| node_models
node_automation -.->|"checks alerts"| node_notifications

click node_web_routes "https://github.com/lehaziq/proerp/blob/main/routes/web.php"
click node_api_routes "https://github.com/lehaziq/proerp/blob/main/routes/api.php"
click node_web_ui "https://github.com/lehaziq/proerp/tree/main/resources/views"
click node_api_controllers "https://github.com/lehaziq/proerp/tree/main/app/Http/Controllers/Api"
click node_auth "https://github.com/lehaziq/proerp/tree/main/app/Http/Controllers/Auth"
click node_customers "https://github.com/lehaziq/proerp/blob/main/app/Http/Controllers/CustomerController.php"
click node_suppliers "https://github.com/lehaziq/proerp/blob/main/app/Http/Controllers/SupplierController.php"
click node_products "https://github.com/lehaziq/proerp/blob/main/app/Http/Controllers/ProductController.php"
click node_inventory "https://github.com/lehaziq/proerp/blob/main/app/Services/InventoryService.php"
click node_invoicing "https://github.com/lehaziq/proerp/blob/main/app/Services/InvoiceService.php"
click node_payments "https://github.com/lehaziq/proerp/blob/main/app/Services/PaymentService.php"
click node_accounting "https://github.com/lehaziq/proerp/blob/main/app/Services/AccountingService.php"
click node_approvals "https://github.com/lehaziq/proerp/blob/main/app/Services/ApprovalService.php"
click node_reports "https://github.com/lehaziq/proerp/blob/main/app/Services/ReportService.php"
click node_dashboard "https://github.com/lehaziq/proerp/blob/main/app/Services/DashboardService.php"
click node_ocr "https://github.com/lehaziq/proerp/blob/main/app/Services/OcrService.php"
click node_ai_context "https://github.com/lehaziq/proerp/blob/main/app/Services/AiContextService.php"
click node_tenant "https://github.com/lehaziq/proerp/blob/main/app/Models/CompanyProfile.php"
click node_audit "https://github.com/lehaziq/proerp/blob/main/app/Services/AuditService.php"
click node_models "https://github.com/lehaziq/proerp/tree/main/app/Models"
click node_notifications "https://github.com/lehaziq/proerp/blob/main/app/Notifications/ErpAlertNotification.php"
click node_automation "https://github.com/lehaziq/proerp/tree/main/app/Console/Commands"

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_web_routes,node_api_routes,node_web_ui,node_api_controllers,node_auth,node_user,node_api_client toneBlue
class node_customers,node_suppliers,node_products,node_inventory,node_invoicing,node_ocr,node_ai_context toneAmber
class node_payments,node_accounting,node_approvals,node_reports,node_dashboard toneMint
class node_tenant,node_audit,node_models,node_notifications,node_automation toneRose
```

## Components

### Access and Interfaces

- [Web Routes](https://github.com/lehaziq/proerp/blob/main/routes/web.php): `routes/web.php`
- [API Routes](https://github.com/lehaziq/proerp/blob/main/routes/api.php): `routes/api.php`
- [Blade ERP UI](https://github.com/lehaziq/proerp/tree/main/resources/views): `resources/views`
- [API Controllers](https://github.com/lehaziq/proerp/tree/main/app/Http/Controllers/Api): `app/Http/Controllers/Api`
- [Authentication](https://github.com/lehaziq/proerp/tree/main/app/Http/Controllers/Auth): `app/Http/Controllers/Auth`

### Business Operations

- [Customer CRM](https://github.com/lehaziq/proerp/blob/main/app/Http/Controllers/CustomerController.php): `app/Http/Controllers/CustomerController.php`
- [Supplier Records](https://github.com/lehaziq/proerp/blob/main/app/Http/Controllers/SupplierController.php): `app/Http/Controllers/SupplierController.php`
- [Product Catalog](https://github.com/lehaziq/proerp/blob/main/app/Http/Controllers/ProductController.php): `app/Http/Controllers/ProductController.php`
- [Inventory](https://github.com/lehaziq/proerp/blob/main/app/Services/InventoryService.php): `app/Services/InventoryService.php`
- [Invoicing](https://github.com/lehaziq/proerp/blob/main/app/Services/InvoiceService.php): `app/Services/InvoiceService.php`
- [OCR Uploads](https://github.com/lehaziq/proerp/blob/main/app/Services/OcrService.php): `app/Services/OcrService.php`
- [AI Context](https://github.com/lehaziq/proerp/blob/main/app/Services/AiContextService.php): `app/Services/AiContextService.php`

### Finance and Oversight

- [Payments](https://github.com/lehaziq/proerp/blob/main/app/Services/PaymentService.php): `app/Services/PaymentService.php`
- [Accounting](https://github.com/lehaziq/proerp/blob/main/app/Services/AccountingService.php): `app/Services/AccountingService.php`
- [Approvals](https://github.com/lehaziq/proerp/blob/main/app/Services/ApprovalService.php): `app/Services/ApprovalService.php`
- [Reports](https://github.com/lehaziq/proerp/blob/main/app/Services/ReportService.php): `app/Services/ReportService.php`
- [Dashboard](https://github.com/lehaziq/proerp/blob/main/app/Services/DashboardService.php): `app/Services/DashboardService.php`

### Shared Platform

- [Company and Branch](https://github.com/lehaziq/proerp/blob/main/app/Models/CompanyProfile.php): `app/Models/CompanyProfile.php`
- [Audit Logging](https://github.com/lehaziq/proerp/blob/main/app/Services/AuditService.php): `app/Services/AuditService.php`
- [ERP Records](https://github.com/lehaziq/proerp/tree/main/app/Models): `app/Models`
- [Notifications](https://github.com/lehaziq/proerp/blob/main/app/Notifications/ErpAlertNotification.php): `app/Notifications/ErpAlertNotification.php`
- [Scheduled ERP Tasks](https://github.com/lehaziq/proerp/tree/main/app/Console/Commands): `app/Console/Commands`

### Other components

- **ERP User**
- **API Client**

## Connections

- ERP User → Web Routes: uses (evidence: `README.md`)
- Web Routes → Blade ERP UI: serves (evidence: `README.md`)
- API Client → API Routes: calls (evidence: `README.md`)
- API Routes → API Controllers: routes
- Web Routes → Authentication: routes
- Web Routes → Customer CRM: routes
- Web Routes → Product Catalog: routes
- API Controllers → Customer CRM: provides API (evidence: `README.md`)
- API Controllers → Product Catalog: provides API (evidence: `README.md`)
- Customer CRM → ERP Records: uses records (evidence: `app/Http/Controllers/CustomerController.php`)
- Supplier Records → ERP Records: uses records (evidence: `app/Http/Controllers/SupplierController.php`)
- Product Catalog → ERP Records: uses records (evidence: `app/Http/Controllers/ProductController.php`)
- Product Catalog → Audit Logging: logs changes (evidence: `app/Http/Controllers/ProductController.php`)
- Company and Branch → ERP Records: scopes records (evidence: `app/Models/Concerns/BelongsToCompany.php`)
- Invoicing → ERP Records: uses records
- Payments → ERP Records: uses records
- Accounting → ERP Records: posts entries (evidence: `app/Services/AccountingService.php`)
- Invoicing → Inventory: deducts stock (evidence: `README.md`)
- Invoicing → Accounting: posts journals (evidence: `README.md`)
- Payments → Accounting: posts journals (evidence: `README.md`)
- Approvals → Notifications: sends alerts (evidence: `app/Services/ApprovalService.php`)
- Approvals → Audit Logging: records actions (evidence: `app/Services/ApprovalService.php`)
- Reports → ERP Records: reports on
- Dashboard → ERP Records: summarizes
- OCR Uploads → ERP Records: stores uploads (evidence: `README.md`)
- AI Context → ERP Records: builds context (evidence: `app/Services/AiContextService.php`)
- Scheduled ERP Tasks → Notifications: checks alerts
