# samuraimaid/mc-larens_erp2 architecture

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

- Interactive diagram: https://gitdiagram.com/samuraimaid/mc-larens_erp2
- Repository: https://github.com/samuraimaid/mc-larens_erp2

## Overview

MC-LARENS ERP 2.0 is an automotive workshop and point-of-sale system. Its principal workflow spans sales and invoicing, workshop jobs, quality approval, then delivery with customer tracking; the README also documents inventory, payroll, vehicle catalog, and reporting capabilities. The frontend routing and authentication relationships are supported by excerpts; most domain-to-API wiring is not sampled, so those links are omitted. Product workflows and capabilities are retained as documented, not as claims of inspected implementation.

Main entry points: [`frontend/src/App.js`](https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/App.js) (Application router), [`backend/api/v1/auth.py`](https://github.com/samuraimaid/mc-larens_erp2/blob/master/backend/api/v1/auth.py) (Authentication API), [`frontend/src/pages/WorkOrdersPage.jsx`](https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/WorkOrdersPage.jsx) (Workshop and KDS), [`frontend/src/pages/QualityControlPage.jsx`](https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/QualityControlPage.jsx) (Quality control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["ERP frontend"]
  node_app["Application router<br/>[App.js]"]
  node_mainlayout["Main workspace<br/>[MainLayout.jsx]"]
  node_authctx["Session context<br/>[AuthContext.js]"]
  node_sales["Sales and cashier<br/>[SalesPage.jsx]"]
  node_quotations["Quotations<br/>[QuotationsPage.jsx]"]
  node_inventory["Inventory management<br/>[InventoryPage.jsx]"]
end

subgraph group_operations["Business operations"]
  node_workshop["Workshop and KDS<br/>[WorkOrdersPage.jsx]"]
  node_quality["Quality control"]
  node_delivery["Delivery and tracking<br/>[DeliveriesPage.jsx]"]
  node_vehiclecatalog["Vehicle catalog<br/>[CatalogPage.jsx]"]
end

subgraph group_platform["Platform services"]
  node_authapi["Authentication API<br/>[auth.py]"]
  node_database[("MongoDB session<br/>[session.py]")]
  node_sentinel["Business alerts"]
  node_terabox["Cloud backup"]
  node_teraboxconfig["Backup configuration<br/>[terabox_config.py]"]
end

subgraph group_people["People and control"]
  node_hr["Payroll and HR<br/>[payroll_engine.py]"]
  node_approvals["Approvals<br/>[ApprovalsPage.jsx]"]
  node_reports["Business reports<br/>[ReportsPage.jsx]"]
end

node_user(("ERP user"))

node_user -->|"uses"| node_app
node_app -->|"provides session"| node_authctx
node_app -->|"routes through"| node_mainlayout
node_mainlayout -->|"checks session"| node_user
node_app -->|"routes to"| node_sales
node_app -->|"routes to"| node_quotations
node_app -.->|"routes to"| node_inventory
node_app -.->|"routes to"| node_workshop
node_app -.->|"routes to"| node_quality
node_app -.->|"routes to"| node_delivery
node_app -.->|"routes to"| node_vehiclecatalog
node_app -.->|"routes to"| node_approvals
node_app -.->|"routes to"| node_reports
node_authctx -->|"checks session"| node_authapi
node_authapi -->|"reads attempts"| node_database
node_authapi -->|"sends alert"| node_sentinel
node_hr -.->|"queries records"| node_database
node_terabox -->|"loads settings"| node_teraboxconfig
node_terabox -.->|"backs up data"| node_database
node_sales -.->|"work proceeds"| node_workshop
node_workshop -->|"requires approval"| node_quality
node_quality -->|"enables release"| node_delivery

click node_app "https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/App.js"
click node_mainlayout "https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/components/layout/MainLayout.jsx"
click node_authctx "https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/context/AuthContext.js"
click node_sales "https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/SalesPage.jsx"
click node_quotations "https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/QuotationsPage.jsx"
click node_inventory "https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/InventoryPage.jsx"
click node_workshop "https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/WorkOrdersPage.jsx"
click node_quality "https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/QualityControlPage.jsx"
click node_delivery "https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/DeliveriesPage.jsx"
click node_vehiclecatalog "https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/CatalogPage.jsx"
click node_hr "https://github.com/samuraimaid/mc-larens_erp2/blob/master/backend/domains/hr/payroll_engine.py"
click node_approvals "https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/ApprovalsPage.jsx"
click node_reports "https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/ReportsPage.jsx"
click node_authapi "https://github.com/samuraimaid/mc-larens_erp2/blob/master/backend/api/v1/auth.py"
click node_database "https://github.com/samuraimaid/mc-larens_erp2/blob/master/backend/db/session.py"
click node_sentinel "https://github.com/samuraimaid/mc-larens_erp2/blob/master/backend/services/weekly_business_sentinel.py"
click node_terabox "https://github.com/samuraimaid/mc-larens_erp2/blob/master/backend/services/terabox_backup_service.py"
click node_teraboxconfig "https://github.com/samuraimaid/mc-larens_erp2/blob/master/backend/services/terabox_config.py"

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_app,node_mainlayout,node_authctx,node_sales,node_quotations,node_inventory,node_user toneBlue
class node_workshop,node_quality,node_delivery,node_vehiclecatalog toneAmber
class node_authapi,node_database,node_sentinel,node_terabox,node_teraboxconfig toneMint
class node_hr,node_approvals,node_reports toneRose
```

## Components

### ERP frontend

- [Application router](https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/App.js): `frontend/src/App.js`
- [Main workspace](https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/components/layout/MainLayout.jsx): `frontend/src/components/layout/MainLayout.jsx`
- [Session context](https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/context/AuthContext.js): `frontend/src/context/AuthContext.js`
- [Sales and cashier](https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/SalesPage.jsx): `frontend/src/pages/SalesPage.jsx`
- [Quotations](https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/QuotationsPage.jsx): `frontend/src/pages/QuotationsPage.jsx`
- [Inventory management](https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/InventoryPage.jsx): `frontend/src/pages/InventoryPage.jsx`

### Business operations

- [Workshop and KDS](https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/WorkOrdersPage.jsx): `frontend/src/pages/WorkOrdersPage.jsx`
- [Quality control](https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/QualityControlPage.jsx): `frontend/src/pages/QualityControlPage.jsx`
- [Delivery and tracking](https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/DeliveriesPage.jsx): `frontend/src/pages/DeliveriesPage.jsx`
- [Vehicle catalog](https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/CatalogPage.jsx): `frontend/src/pages/CatalogPage.jsx`

### Platform services

- [Authentication API](https://github.com/samuraimaid/mc-larens_erp2/blob/master/backend/api/v1/auth.py): `backend/api/v1/auth.py`
- [MongoDB session](https://github.com/samuraimaid/mc-larens_erp2/blob/master/backend/db/session.py): `backend/db/session.py`
- [Business alerts](https://github.com/samuraimaid/mc-larens_erp2/blob/master/backend/services/weekly_business_sentinel.py): `backend/services/weekly_business_sentinel.py`
- [Cloud backup](https://github.com/samuraimaid/mc-larens_erp2/blob/master/backend/services/terabox_backup_service.py): `backend/services/terabox_backup_service.py`
- [Backup configuration](https://github.com/samuraimaid/mc-larens_erp2/blob/master/backend/services/terabox_config.py): `backend/services/terabox_config.py`

### People and control

- [Payroll and HR](https://github.com/samuraimaid/mc-larens_erp2/blob/master/backend/domains/hr/payroll_engine.py): `backend/domains/hr/payroll_engine.py`
- [Approvals](https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/ApprovalsPage.jsx): `frontend/src/pages/ApprovalsPage.jsx`
- [Business reports](https://github.com/samuraimaid/mc-larens_erp2/blob/master/frontend/src/pages/ReportsPage.jsx): `frontend/src/pages/ReportsPage.jsx`

### Other components

- **ERP user**

## Connections

- ERP user → Application router: uses (evidence: `README.md`)
- Application router → Session context: provides session (evidence: `frontend/src/App.js`)
- Application router → Main workspace: routes through (evidence: `frontend/src/App.js`)
- Main workspace → ERP user: checks session (evidence: `frontend/src/components/layout/MainLayout.jsx`)
- Application router → Sales and cashier: routes to (evidence: `frontend/src/App.js`)
- Application router → Quotations: routes to (evidence: `frontend/src/App.js`)
- Application router → Inventory management: routes to (evidence: `frontend/src/App.js`)
- Application router → Workshop and KDS: routes to (evidence: `frontend/src/App.js`)
- Application router → Quality control: routes to
- Application router → Delivery and tracking: routes to (evidence: `frontend/src/App.js`)
- Application router → Vehicle catalog: routes to (evidence: `frontend/src/App.js`)
- Application router → Approvals: routes to (evidence: `frontend/src/App.js`)
- Application router → Business reports: routes to (evidence: `frontend/src/App.js`)
- Session context → Authentication API: checks session (evidence: `frontend/src/context/AuthContext.js`)
- Authentication API → MongoDB session: reads attempts (evidence: `backend/api/v1/auth.py`)
- Authentication API → Business alerts: sends alert (evidence: `backend/api/v1/auth.py`)
- Payroll and HR → MongoDB session: queries records
- Cloud backup → Backup configuration: loads settings (evidence: `backend/services/terabox_backup_service.py`)
- Cloud backup → MongoDB session: backs up data
- Sales and cashier → Workshop and KDS: work proceeds (evidence: `README.md`)
- Workshop and KDS → Quality control: requires approval (evidence: `README.md`)
- Quality control → Delivery and tracking: enables release (evidence: `README.md`)
