# matheus2306/erp architecture

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

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

## Overview

Vértice ERP is a local retail ERP with a React interface, ASP.NET Core API, and PostgreSQL persistence. The main workflow is operator sign-in, product and stock setup, cash-session opening, sale creation and payment, then review of stock and cash movements; the README also documents purchasing, finance, returns, imports, opening balances, inventory, and reports. Frontend routing and API calls are evidenced in sampled excerpts; several backend feature links are documented or represented by unsampled endpoint directories, so uncertain internal calls are omitted or marked unverified.

Main entry points: [`frontend/src/App.tsx`](https://github.com/matheus2306/erp/blob/main/frontend/src/App.tsx) (ERP workspace), [`backend/Erp.Api/Data/ErpDb.cs`](https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Data/ErpDb.cs) (ERP data context), [`frontend/src/areas/access`](https://github.com/matheus2306/erp/tree/main/frontend/src/areas/access) (Access screens), [`frontend/src/areas/catalog`](https://github.com/matheus2306/erp/tree/main/frontend/src/areas/catalog) (Catalog screens)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["ERP workspace<br/>[App.tsx]"]
  node_transport["API client<br/>[api.ts]"]
end

subgraph group_identity["Identity and catalog"]
  node_access_ui["Access screens"]
  node_catalog_ui["Catalog screens"]
  node_access_api["Access endpoints<br/>[AccessEndpoints.cs]"]
  node_catalog_api["Catalog endpoints<br/>[Catalog]"]
  node_products["Products<br/>[Product.cs]"]
end

subgraph group_operations["Retail operations"]
  node_cash_ui["Cash screens<br/>[CashPage.tsx]"]
  node_sales_ui["Sales screens<br/>[SalePage.tsx]"]
  node_stock_ui["Stock screens<br/>[StockPage.tsx]"]
  node_purchasing_ui["Purchasing screens<br/>[SuppliersPage.tsx]"]
  node_finance_ui["Finance screens<br/>[PayablesPage.tsx]"]
  node_opening_ui["Opening balances"]
  node_reports_ui["Operations reports"]
  node_cash_api["Cash operations<br/>[Cash]"]
  node_sales_api["Sales operations<br/>[Sales]"]
  node_stock_api["Stock operations<br/>[Stock]"]
  node_purchasing_api["Purchasing operations<br/>[Purchasing]"]
  node_finance_api["Finance operations<br/>[Finance]"]
  node_opening_api["Opening-load operations<br/>[Opening]"]
  node_reports_api["Report endpoints"]
  node_stock_ledger[("Stock movements<br/>[StockMovement.cs]")]
  node_purchase_model["Purchases<br/>[Purchase.cs]"]
  node_sale_model["Sales<br/>[Sale.cs]"]
  node_cash_session["Cash sessions<br/>[CashSession.cs]"]
end

subgraph group_platform["API and persistence"]
  node_api_host["API host<br/>[Program.cs]"]
  node_db_context["ERP data context<br/>[ErpDb.cs]"]
  node_postgres[("PostgreSQL")]
end

node_operator(("Store operator"))

node_operator -->|"uses"| node_app
node_app -->|"renders"| node_access_ui
node_app -->|"renders"| node_catalog_ui
node_app -->|"requests through"| node_transport
node_transport -->|"sends API requests"| node_api_host
node_api_host -->|"configures"| node_db_context
node_db_context -->|"persists data"| node_postgres
node_operator -->|"signs in"| node_access_ui
node_operator -->|"sets up products"| node_catalog_ui
node_operator -->|"opens session"| node_cash_ui
node_operator -->|"records sale"| node_sales_ui
node_operator -->|"checks stock"| node_stock_ui
node_app -->|"renders"| node_cash_ui
node_app -->|"renders"| node_sales_ui
node_app -->|"renders"| node_stock_ui
node_app -->|"renders"| node_purchasing_ui
node_app -->|"renders"| node_finance_ui
node_app -->|"renders"| node_opening_ui
node_app -->|"renders"| node_reports_ui
node_access_ui -.->|"calls"| node_access_api
node_catalog_ui -.->|"calls"| node_catalog_api
node_cash_ui -.->|"calls"| node_cash_api
node_sales_ui -.->|"calls"| node_sales_api
node_stock_ui -.->|"calls"| node_stock_api
node_purchasing_ui -.->|"calls"| node_purchasing_api
node_finance_ui -.->|"calls"| node_finance_api
node_opening_ui -.->|"calls"| node_opening_api
node_reports_ui -.->|"calls"| node_reports_api
node_catalog_api -.->|"manages"| node_products
node_sales_api -.->|"records"| node_sale_model
node_cash_api -.->|"manages"| node_cash_session
node_purchasing_api -.->|"records"| node_purchase_model
node_purchase_model -->|"posts receipts"| node_stock_ledger
node_db_context -->|"maps"| node_sale_model
node_db_context -->|"maps"| node_cash_session
node_db_context -->|"maps"| node_stock_ledger

click node_app "https://github.com/matheus2306/erp/blob/main/frontend/src/App.tsx"
click node_transport "https://github.com/matheus2306/erp/blob/main/frontend/src/api.ts"
click node_access_ui "https://github.com/matheus2306/erp/tree/main/frontend/src/areas/access"
click node_catalog_ui "https://github.com/matheus2306/erp/tree/main/frontend/src/areas/catalog"
click node_access_api "https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Modules/Access/AccessEndpoints.cs"
click node_catalog_api "https://github.com/matheus2306/erp/tree/main/backend/Erp.Api/Modules/Catalog"
click node_products "https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Modules/Catalog/Product.cs"
click node_cash_ui "https://github.com/matheus2306/erp/blob/main/frontend/src/areas/cash/CashPage.tsx"
click node_sales_ui "https://github.com/matheus2306/erp/blob/main/frontend/src/areas/sales/SalePage.tsx"
click node_stock_ui "https://github.com/matheus2306/erp/blob/main/frontend/src/areas/stock/StockPage.tsx"
click node_purchasing_ui "https://github.com/matheus2306/erp/blob/main/frontend/src/areas/purchasing/SuppliersPage.tsx"
click node_finance_ui "https://github.com/matheus2306/erp/blob/main/frontend/src/areas/finance/PayablesPage.tsx"
click node_opening_ui "https://github.com/matheus2306/erp/blob/main/frontend/src/areas/opening/OpeningLoadsPage.tsx"
click node_reports_ui "https://github.com/matheus2306/erp/blob/main/frontend/src/areas/reports/OperationsReportPage.tsx"
click node_cash_api "https://github.com/matheus2306/erp/tree/main/backend/Erp.Api/Modules/Cash"
click node_sales_api "https://github.com/matheus2306/erp/tree/main/backend/Erp.Api/Modules/Sales"
click node_stock_api "https://github.com/matheus2306/erp/tree/main/backend/Erp.Api/Modules/Stock"
click node_purchasing_api "https://github.com/matheus2306/erp/tree/main/backend/Erp.Api/Modules/Purchasing"
click node_finance_api "https://github.com/matheus2306/erp/tree/main/backend/Erp.Api/Modules/Finance"
click node_opening_api "https://github.com/matheus2306/erp/tree/main/backend/Erp.Api/Modules/Opening"
click node_reports_api "https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Modules/Reports/OperationsReportEndpoints.cs"
click node_api_host "https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Program.cs"
click node_db_context "https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Data/ErpDb.cs"
click node_stock_ledger "https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Modules/Stock/StockMovement.cs"
click node_purchase_model "https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Modules/Purchasing/Purchase.cs"
click node_sale_model "https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Modules/Sales/Sale.cs"
click node_cash_session "https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Modules/Cash/CashSession.cs"

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_transport toneBlue
class node_access_ui,node_catalog_ui,node_access_api,node_catalog_api,node_products toneAmber
class node_cash_ui,node_sales_ui,node_stock_ui,node_purchasing_ui,node_finance_ui,node_opening_ui,node_reports_ui,node_cash_api,node_sales_api,node_stock_api,node_purchasing_api,node_finance_api,node_opening_api,node_reports_api,node_stock_ledger,node_purchase_model,node_sale_model,node_cash_session toneMint
class node_api_host,node_db_context,node_postgres toneRose
class node_operator toneIndigo
```

## Components

### Web application

- [ERP workspace](https://github.com/matheus2306/erp/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/matheus2306/erp/blob/main/frontend/src/api.ts): `frontend/src/api.ts`

### Identity and catalog

- [Access screens](https://github.com/matheus2306/erp/tree/main/frontend/src/areas/access): `frontend/src/areas/access`
- [Catalog screens](https://github.com/matheus2306/erp/tree/main/frontend/src/areas/catalog): `frontend/src/areas/catalog`
- [Access endpoints](https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Modules/Access/AccessEndpoints.cs): `backend/Erp.Api/Modules/Access/AccessEndpoints.cs`
- [Catalog endpoints](https://github.com/matheus2306/erp/tree/main/backend/Erp.Api/Modules/Catalog): `backend/Erp.Api/Modules/Catalog`
- [Products](https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Modules/Catalog/Product.cs): `backend/Erp.Api/Modules/Catalog/Product.cs`

### Retail operations

- [Cash screens](https://github.com/matheus2306/erp/blob/main/frontend/src/areas/cash/CashPage.tsx): `frontend/src/areas/cash/CashPage.tsx`
- [Sales screens](https://github.com/matheus2306/erp/blob/main/frontend/src/areas/sales/SalePage.tsx): `frontend/src/areas/sales/SalePage.tsx`
- [Stock screens](https://github.com/matheus2306/erp/blob/main/frontend/src/areas/stock/StockPage.tsx): `frontend/src/areas/stock/StockPage.tsx`
- [Purchasing screens](https://github.com/matheus2306/erp/blob/main/frontend/src/areas/purchasing/SuppliersPage.tsx): `frontend/src/areas/purchasing/SuppliersPage.tsx`
- [Finance screens](https://github.com/matheus2306/erp/blob/main/frontend/src/areas/finance/PayablesPage.tsx): `frontend/src/areas/finance/PayablesPage.tsx`
- [Opening balances](https://github.com/matheus2306/erp/blob/main/frontend/src/areas/opening/OpeningLoadsPage.tsx): `frontend/src/areas/opening/OpeningLoadsPage.tsx`
- [Operations reports](https://github.com/matheus2306/erp/blob/main/frontend/src/areas/reports/OperationsReportPage.tsx): `frontend/src/areas/reports/OperationsReportPage.tsx`
- [Cash operations](https://github.com/matheus2306/erp/tree/main/backend/Erp.Api/Modules/Cash): `backend/Erp.Api/Modules/Cash`
- [Sales operations](https://github.com/matheus2306/erp/tree/main/backend/Erp.Api/Modules/Sales): `backend/Erp.Api/Modules/Sales`
- [Stock operations](https://github.com/matheus2306/erp/tree/main/backend/Erp.Api/Modules/Stock): `backend/Erp.Api/Modules/Stock`
- [Purchasing operations](https://github.com/matheus2306/erp/tree/main/backend/Erp.Api/Modules/Purchasing): `backend/Erp.Api/Modules/Purchasing`
- [Finance operations](https://github.com/matheus2306/erp/tree/main/backend/Erp.Api/Modules/Finance): `backend/Erp.Api/Modules/Finance`
- [Opening-load operations](https://github.com/matheus2306/erp/tree/main/backend/Erp.Api/Modules/Opening): `backend/Erp.Api/Modules/Opening`
- [Report endpoints](https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Modules/Reports/OperationsReportEndpoints.cs): `backend/Erp.Api/Modules/Reports/OperationsReportEndpoints.cs`
- [Stock movements](https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Modules/Stock/StockMovement.cs): `backend/Erp.Api/Modules/Stock/StockMovement.cs`
- [Purchases](https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Modules/Purchasing/Purchase.cs): `backend/Erp.Api/Modules/Purchasing/Purchase.cs`
- [Sales](https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Modules/Sales/Sale.cs): `backend/Erp.Api/Modules/Sales/Sale.cs`
- [Cash sessions](https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Modules/Cash/CashSession.cs): `backend/Erp.Api/Modules/Cash/CashSession.cs`

### API and persistence

- [API host](https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Program.cs): `backend/Erp.Api/Program.cs`
- [ERP data context](https://github.com/matheus2306/erp/blob/main/backend/Erp.Api/Data/ErpDb.cs): `backend/Erp.Api/Data/ErpDb.cs`
- **PostgreSQL**

### Other components

- **Store operator**

## Connections

- Store operator → ERP workspace: uses (evidence: `README.md`)
- ERP workspace → Access screens: renders (evidence: `frontend/src/App.tsx`)
- ERP workspace → Catalog screens: renders (evidence: `frontend/src/App.tsx`)
- ERP workspace → API client: requests through (evidence: `frontend/src/App.tsx`)
- API client → API host: sends API requests (evidence: `frontend/src/api.ts`)
- API host → ERP data context: configures (evidence: `backend/Erp.Api/Program.cs`)
- ERP data context → PostgreSQL: persists data (evidence: `README.md`)
- Store operator → Access screens: signs in (evidence: `README.md`)
- Store operator → Catalog screens: sets up products (evidence: `README.md`)
- Store operator → Cash screens: opens session (evidence: `README.md`)
- Store operator → Sales screens: records sale (evidence: `README.md`)
- Store operator → Stock screens: checks stock (evidence: `README.md`)
- ERP workspace → Cash screens: renders (evidence: `frontend/src/App.tsx`)
- ERP workspace → Sales screens: renders (evidence: `frontend/src/App.tsx`)
- ERP workspace → Stock screens: renders (evidence: `frontend/src/App.tsx`)
- ERP workspace → Purchasing screens: renders (evidence: `frontend/src/App.tsx`)
- ERP workspace → Finance screens: renders (evidence: `frontend/src/App.tsx`)
- ERP workspace → Opening balances: renders (evidence: `frontend/src/App.tsx`)
- ERP workspace → Operations reports: renders (evidence: `frontend/src/App.tsx`)
- Access screens → Access endpoints: calls
- Catalog screens → Catalog endpoints: calls
- Cash screens → Cash operations: calls
- Sales screens → Sales operations: calls
- Stock screens → Stock operations: calls
- Purchasing screens → Purchasing operations: calls
- Finance screens → Finance operations: calls
- Opening balances → Opening-load operations: calls
- Operations reports → Report endpoints: calls
- Catalog endpoints → Products: manages (evidence: `backend/Erp.Api/Modules/Catalog/CatalogSearchEndpoints.cs`)
- Sales operations → Sales: records (evidence: `backend/Erp.Api/Modules/Sales/SaleReturnEndpoints.cs`)
- Cash operations → Cash sessions: manages (evidence: `backend/Erp.Api/Modules/Cash/CashMovement.cs`)
- Purchasing operations → Purchases: records (evidence: `backend/Erp.Api/Modules/Purchasing/PurchaseEndpoints.cs`)
- Purchases → Stock movements: posts receipts (evidence: `backend/Erp.Api/Modules/Purchasing/PurchaseEndpoints.cs`)
- ERP data context → Sales: maps (evidence: `backend/Erp.Api/Data/ErpDb.cs`)
- ERP data context → Cash sessions: maps (evidence: `backend/Erp.Api/Data/ErpDb.cs`)
- ERP data context → Stock movements: maps (evidence: `backend/Erp.Api/Data/ErpDb.cs`)
