# g-ravikumar11/yerp architecture

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

- Interactive diagram: https://gitdiagram.com/g-ravikumar11/yerp
- Repository: https://github.com/g-ravikumar11/yerp

## Overview

Y ERP is a civil-contracting ERP whose central workflow tracks an order from item master through measurement, billing and payment, alongside procurement, stock, site operations and project profitability. The web app presents these workflows; the FastAPI backend and SQLAlchemy models provide the server-side operations and persistent state. The README documents major capabilities and their business flow; source excerpts and the index support selected backend relationships, but many feature implementations were not sampled, so undocumented links are omitted.

Main entry points: [`backend/app/routers`](https://github.com/g-ravikumar11/yerp/tree/master/backend/app/routers) (HTTP API), [`frontend/src/features/clientorders`](https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/clientorders) (Work orders), [`backend/app/services/client_billing.py`](https://github.com/g-ravikumar11/yerp/blob/master/backend/app/services/client_billing.py) (Billing rules), [`frontend/src/features/projects`](https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/projects) (Project profit)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["ERP screens"]
end

subgraph group_commercial["Work and commercial flow"]
  node_items["Item master"]
  node_workorders["Work orders"]
  node_measurement["Measurement book"]
  node_clientbilling["Client RA bills"]
  node_payments["Payments and retention"]
  node_subcontracts["Subcontract work"]
end

subgraph group_operations["Site operations"]
  node_procurement["Purchasing and receipt"]
  node_stock["Stock and issues"]
  node_diary["Site diary"]
  node_profit["Project profit"]
  node_planning["AI planning"]
end

subgraph group_platform["Backend platform"]
  node_api["HTTP API"]
  node_orders_backend["Order handling<br/>[client_orders.py]"]
  node_billing_backend["Billing rules<br/>[client_billing.py]"]
  node_documents["Business documents<br/>[forms.py]"]
  node_ai_client["AI provider client<br/>[llm_client.py]"]
  node_auth["Identity and access<br/>[auth.py]"]
  node_database[("ERP database<br/>[session.py]")]
  node_application["Application startup<br/>[application.py]"]
end

node_owner(("Owner and staff"))

node_owner -->|"uses"| node_webapp
node_items -->|"supplies codes"| node_workorders
node_workorders -->|"measured in"| node_measurement
node_measurement -->|"supports claims"| node_clientbilling
node_clientbilling -->|"paid and retained"| node_payments
node_workorders -->|"drives purchasing"| node_procurement
node_procurement -->|"receipts post"| node_stock
node_stock -->|"feeds material cost"| node_profit
node_diary -->|"feeds site costs"| node_profit
node_workorders -->|"anchors job result"| node_profit
node_subcontracts -.->|"uses endpoints"| node_api
node_planning -.->|"uses endpoints"| node_api
node_webapp -.->|"requests data"| node_api
node_api -.->|"routes order requests"| node_orders_backend
node_api -->|"delegates billing"| node_billing_backend
node_billing_backend -->|"reads and writes"| node_database
node_billing_backend -->|"provides bill data"| node_documents
node_orders_backend -->|"reads and writes"| node_database
node_api -->|"checks access"| node_auth
node_application -->|"initializes"| node_database
node_planning -.->|"requests suggestions"| node_ai_client

click node_webapp "https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features"
click node_items "https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/items"
click node_workorders "https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/clientorders"
click node_measurement "https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/measurement"
click node_clientbilling "https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/clientbook"
click node_payments "https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/money"
click node_procurement "https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/purchaseorders"
click node_stock "https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/stock"
click node_diary "https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/diary"
click node_profit "https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/projects"
click node_subcontracts "https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/subbills"
click node_planning "https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/schedule"
click node_api "https://github.com/g-ravikumar11/yerp/tree/master/backend/app/routers"
click node_orders_backend "https://github.com/g-ravikumar11/yerp/blob/master/backend/app/routers/client_orders.py"
click node_billing_backend "https://github.com/g-ravikumar11/yerp/blob/master/backend/app/services/client_billing.py"
click node_documents "https://github.com/g-ravikumar11/yerp/blob/master/backend/app/documents/forms.py"
click node_ai_client "https://github.com/g-ravikumar11/yerp/blob/master/backend/app/ai/llm_client.py"
click node_auth "https://github.com/g-ravikumar11/yerp/blob/master/backend/app/core/auth.py"
click node_database "https://github.com/g-ravikumar11/yerp/blob/master/backend/app/db/session.py"
click node_application "https://github.com/g-ravikumar11/yerp/blob/master/backend/app/core/application.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_webapp toneBlue
class node_items,node_workorders,node_measurement,node_clientbilling,node_payments,node_subcontracts toneAmber
class node_procurement,node_stock,node_diary,node_profit,node_planning toneMint
class node_api,node_orders_backend,node_billing_backend,node_documents,node_ai_client,node_auth,node_database,node_application toneRose
class node_owner toneIndigo
```

## Components

### Web application

- [ERP screens](https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features): `frontend/src/features`

### Work and commercial flow

- [Item master](https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/items): `frontend/src/features/items`
- [Work orders](https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/clientorders): `frontend/src/features/clientorders`
- [Measurement book](https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/measurement): `frontend/src/features/measurement`
- [Client RA bills](https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/clientbook): `frontend/src/features/clientbook`
- [Payments and retention](https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/money): `frontend/src/features/money`
- [Subcontract work](https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/subbills): `frontend/src/features/subbills`

### Site operations

- [Purchasing and receipt](https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/purchaseorders): `frontend/src/features/purchaseorders`
- [Stock and issues](https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/stock): `frontend/src/features/stock`
- [Site diary](https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/diary): `frontend/src/features/diary`
- [Project profit](https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/projects): `frontend/src/features/projects`
- [AI planning](https://github.com/g-ravikumar11/yerp/tree/master/frontend/src/features/schedule): `frontend/src/features/schedule`

### Backend platform

- [HTTP API](https://github.com/g-ravikumar11/yerp/tree/master/backend/app/routers): `backend/app/routers`
- [Order handling](https://github.com/g-ravikumar11/yerp/blob/master/backend/app/routers/client_orders.py): `backend/app/routers/client_orders.py`
- [Billing rules](https://github.com/g-ravikumar11/yerp/blob/master/backend/app/services/client_billing.py): `backend/app/services/client_billing.py`
- [Business documents](https://github.com/g-ravikumar11/yerp/blob/master/backend/app/documents/forms.py): `backend/app/documents/forms.py`
- [AI provider client](https://github.com/g-ravikumar11/yerp/blob/master/backend/app/ai/llm_client.py): `backend/app/ai/llm_client.py`
- [Identity and access](https://github.com/g-ravikumar11/yerp/blob/master/backend/app/core/auth.py): `backend/app/core/auth.py`
- [ERP database](https://github.com/g-ravikumar11/yerp/blob/master/backend/app/db/session.py): `backend/app/db/session.py`
- [Application startup](https://github.com/g-ravikumar11/yerp/blob/master/backend/app/core/application.py): `backend/app/core/application.py`

### Other components

- **Owner and staff**

## Connections

- Owner and staff → ERP screens: uses (evidence: `README.md`)
- Item master → Work orders: supplies codes (evidence: `README.md`)
- Work orders → Measurement book: measured in (evidence: `README.md`)
- Measurement book → Client RA bills: supports claims (evidence: `README.md`)
- Client RA bills → Payments and retention: paid and retained (evidence: `README.md`)
- Work orders → Purchasing and receipt: drives purchasing (evidence: `README.md`)
- Purchasing and receipt → Stock and issues: receipts post (evidence: `README.md`)
- Stock and issues → Project profit: feeds material cost (evidence: `README.md`)
- Site diary → Project profit: feeds site costs (evidence: `README.md`)
- Work orders → Project profit: anchors job result (evidence: `README.md`)
- Subcontract work → HTTP API: uses endpoints
- AI planning → HTTP API: uses endpoints
- ERP screens → HTTP API: requests data
- HTTP API → Order handling: routes order requests
- HTTP API → Billing rules: delegates billing (evidence: `backend/app/routers/client_billing.py`)
- Billing rules → ERP database: reads and writes (evidence: `backend/app/services/client_billing.py`)
- Billing rules → Business documents: provides bill data (evidence: `backend/app/documents/forms.py`)
- Order handling → ERP database: reads and writes (evidence: `backend/app/routers/client_orders.py`)
- HTTP API → Identity and access: checks access (evidence: `backend/app/routers/client_orders.py`)
- Application startup → ERP database: initializes (evidence: `backend/app/core/application.py`)
- AI planning → AI provider client: requests suggestions
