# rajwada-infotech/civiliererp architecture

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

- Interactive diagram: https://gitdiagram.com/rajwada-infotech/civiliererp
- Repository: https://github.com/rajwada-infotech/civiliererp

## Overview

CivilierERP is a construction-sector ERP spanning project operations, finance, materials, engineering, CRM, legal land management, workforce, and administration. The main workflow is staff or portal users working through the web and mobile clients; backend routes enforce access and approvals, then read or update shared SQL-backed operational data. The graph preserves README-described product modules and sampled legal and engineering relationships. Several subsystem connections are documented at product level only; unsampled implementation details are not inferred.

Main entry points: [`backend/routes/legal/landPipeline.js`](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/legal/landPipeline.js) (Land workflow), [`backend/server.js`](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/server.js) (Express API), [`backend/db.js`](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/db.js) (SQL Server), [`backend/routes/legal/dueDiligence.js`](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/legal/dueDiligence.js) (Due diligence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User applications"]
  node_web["Web application<br/>[App.tsx]"]
  node_mobile["Department apps<br/>[App.tsx]"]
end

subgraph group_operations["Project operations"]
  node_engineering["Engineering work<br/>[engineering.js]"]
  node_activity_master["Engineering activities"]
  node_cwd["Civil work DPR"]
  node_materials["Materials and procurement<br/>[purchaseOrders.js]"]
end

subgraph group_business["Business workflows"]
  node_finance["Finance and ledgers<br/>[generalLedger.js]"]
  node_crm["CRM and bookings<br/>[crmBookings.js]"]
  node_sales["Sales automation<br/>[saLeads.js]"]
  node_followup["Follow-up tasks<br/>[tasks.js]"]
  node_hr["HR and payroll<br/>[payrollRun.js]"]
  node_assets["Fixed assets<br/>[fixedAssets.js]"]
  node_maintenance["Maintenance and tickets<br/>[ticketRoutes.js]"]
  node_legal_pipeline["Land workflow<br/>[landPipeline.js]"]
  node_legal_diligence["Due diligence<br/>[dueDiligence.js]"]
  node_legal_documents["Land documents<br/>[landDocuments.js]"]
  node_reports["Reports and widgets<br/>[reports.js]"]
end

subgraph group_platform["Backend platform"]
  node_backend["Express API<br/>[server.js]"]
  node_database[("SQL Server<br/>[db.js]")]
  node_redis[("Redis services<br/>[redis.js]")]
end

subgraph group_governance["Access and audit"]
  node_approval_authority["Approval authority"]
  node_legal_audit["Legal audit trail<br/>[legalAudit.js]"]
  node_approval["Approval workflows<br/>[approvalService.js]"]
  node_permissions["Page permissions<br/>[permissions.js]"]
  node_page_right["Page-right gate"]
end

node_staff(("ERP users"))

node_staff -->|"uses"| node_web
node_staff -->|"uses"| node_mobile
node_web -->|"requests"| node_backend
node_mobile -->|"shares API"| node_backend
node_backend -->|"queries"| node_database
node_engineering -->|"reads and writes"| node_database
node_activity_master -.->|"manages activities"| node_database
node_activity_master -->|"calls API"| node_backend
node_engineering -->|"checks approvals"| node_approval
node_staff -->|"manages land"| node_legal_pipeline
node_legal_pipeline -->|"reads and writes"| node_database
node_legal_pipeline -->|"checks authority"| node_approval_authority
node_legal_pipeline -->|"records changes"| node_legal_audit
node_legal_pipeline -->|"uses documents"| node_legal_documents
node_legal_pipeline -->|"checks diligence"| node_legal_diligence
node_legal_diligence -->|"checks authority"| node_approval_authority
node_legal_diligence -->|"records changes"| node_legal_audit
node_backend -.->|"guards routes"| node_page_right
node_page_right -->|"resolves rights"| node_permissions
node_permissions -->|"loads rights"| node_database
node_backend -.->|"uses caching"| node_redis
node_staff -->|"procures materials"| node_materials
node_staff -->|"manages finances"| node_finance
node_staff -->|"handles bookings"| node_crm
node_staff -->|"manages leads"| node_sales
node_staff -->|"reports work"| node_cwd
node_staff -->|"tracks tasks"| node_followup
node_staff -->|"manages workforce"| node_hr
node_staff -->|"tracks assets"| node_assets
node_staff -->|"tracks support"| node_maintenance
node_staff -->|"views insights"| node_reports

click node_web "https://github.com/rajwada-infotech/civiliererp/blob/main/src/App.tsx"
click node_mobile "https://github.com/rajwada-infotech/civiliererp/blob/main/mobile-admin/App.tsx"
click node_engineering "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/engineering.js"
click node_activity_master "https://github.com/rajwada-infotech/civiliererp/blob/main/src/pages/masters/EngineeringActivityMaster.tsx"
click node_cwd "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/civilworkdprDashboard.js"
click node_materials "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/purchaseOrders.js"
click node_finance "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/generalLedger.js"
click node_crm "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/crmBookings.js"
click node_sales "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/saLeads.js"
click node_followup "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/tasks.js"
click node_hr "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/payrollRun.js"
click node_assets "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/fixedAssets.js"
click node_maintenance "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/ticketRoutes.js"
click node_legal_pipeline "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/legal/landPipeline.js"
click node_legal_diligence "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/legal/dueDiligence.js"
click node_legal_documents "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/legal/landDocuments.js"
click node_approval_authority "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/legal/approvalAuthority.js"
click node_legal_audit "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/legal/legalAudit.js"
click node_approval "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/services/approvalService.js"
click node_permissions "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/middleware/permissions.js"
click node_page_right "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/middleware/requirePageRight.js"
click node_backend "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/server.js"
click node_database "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/db.js"
click node_redis "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/redis.js"
click node_reports "https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/reports.js"

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,node_mobile,node_staff toneBlue
class node_engineering,node_activity_master,node_cwd,node_materials toneAmber
class node_finance,node_crm,node_sales,node_followup,node_hr,node_assets,node_maintenance,node_legal_pipeline,node_legal_diligence,node_legal_documents,node_reports toneMint
class node_backend,node_database,node_redis toneRose
class node_approval_authority,node_legal_audit,node_approval,node_permissions,node_page_right toneIndigo
```

## Components

### User applications

- [Web application](https://github.com/rajwada-infotech/civiliererp/blob/main/src/App.tsx): `src/App.tsx`
- [Department apps](https://github.com/rajwada-infotech/civiliererp/blob/main/mobile-admin/App.tsx): `mobile-admin/App.tsx`

### Project operations

- [Engineering work](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/engineering.js): `backend/routes/engineering.js`
- [Engineering activities](https://github.com/rajwada-infotech/civiliererp/blob/main/src/pages/masters/EngineeringActivityMaster.tsx): `src/pages/masters/EngineeringActivityMaster.tsx`
- [Civil work DPR](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/civilworkdprDashboard.js): `backend/routes/civilworkdprDashboard.js`
- [Materials and procurement](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/purchaseOrders.js): `backend/routes/purchaseOrders.js`

### Business workflows

- [Finance and ledgers](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/generalLedger.js): `backend/routes/generalLedger.js`
- [CRM and bookings](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/crmBookings.js): `backend/routes/crmBookings.js`
- [Sales automation](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/saLeads.js): `backend/routes/saLeads.js`
- [Follow-up tasks](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/tasks.js): `backend/routes/tasks.js`
- [HR and payroll](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/payrollRun.js): `backend/routes/payrollRun.js`
- [Fixed assets](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/fixedAssets.js): `backend/routes/fixedAssets.js`
- [Maintenance and tickets](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/ticketRoutes.js): `backend/routes/ticketRoutes.js`
- [Land workflow](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/legal/landPipeline.js): `backend/routes/legal/landPipeline.js`
- [Due diligence](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/legal/dueDiligence.js): `backend/routes/legal/dueDiligence.js`
- [Land documents](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/legal/landDocuments.js): `backend/routes/legal/landDocuments.js`
- [Reports and widgets](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/reports.js): `backend/routes/reports.js`

### Backend platform

- [Express API](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/server.js): `backend/server.js`
- [SQL Server](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/db.js): `backend/db.js`
- [Redis services](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/redis.js): `backend/redis.js`

### Access and audit

- [Approval authority](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/legal/approvalAuthority.js): `backend/routes/legal/approvalAuthority.js`
- [Legal audit trail](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/routes/legal/legalAudit.js): `backend/routes/legal/legalAudit.js`
- [Approval workflows](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/services/approvalService.js): `backend/services/approvalService.js`
- [Page permissions](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/middleware/permissions.js): `backend/middleware/permissions.js`
- [Page-right gate](https://github.com/rajwada-infotech/civiliererp/blob/main/backend/middleware/requirePageRight.js): `backend/middleware/requirePageRight.js`

### Other components

- **ERP users**

## Connections

- ERP users → Web application: uses (evidence: `README.md`)
- ERP users → Department apps: uses (evidence: `README.md`)
- Web application → Express API: requests (evidence: `README.md`)
- Department apps → Express API: shares API (evidence: `README.md`)
- Express API → SQL Server: queries (evidence: `README.md`)
- Engineering work → SQL Server: reads and writes (evidence: `backend/routes/engineering.js`)
- Engineering activities → SQL Server: manages activities
- Engineering activities → Express API: calls API
- Engineering work → Approval workflows: checks approvals (evidence: `backend/routes/engineering.js`)
- ERP users → Land workflow: manages land (evidence: `README.md`)
- Land workflow → SQL Server: reads and writes (evidence: `backend/routes/legal/landPipeline.js`)
- Land workflow → Approval authority: checks authority (evidence: `backend/routes/legal/landPipeline.js`)
- Land workflow → Legal audit trail: records changes (evidence: `backend/routes/legal/landPipeline.js`)
- Land workflow → Land documents: uses documents (evidence: `backend/routes/legal/landPipeline.js`)
- Land workflow → Due diligence: checks diligence (evidence: `backend/routes/legal/landPipeline.js`)
- Due diligence → Approval authority: checks authority (evidence: `backend/routes/legal/dueDiligence.js`)
- Due diligence → Legal audit trail: records changes (evidence: `backend/routes/legal/dueDiligence.js`)
- Express API → Page-right gate: guards routes
- Page-right gate → Page permissions: resolves rights (evidence: `backend/middleware/requirePageRight.js`)
- Page permissions → SQL Server: loads rights (evidence: `backend/middleware/permissions.js`)
- Express API → Redis services: uses caching
- ERP users → Materials and procurement: procures materials (evidence: `README.md`)
- ERP users → Finance and ledgers: manages finances (evidence: `README.md`)
- ERP users → CRM and bookings: handles bookings (evidence: `README.md`)
- ERP users → Sales automation: manages leads (evidence: `README.md`)
- ERP users → Civil work DPR: reports work (evidence: `README.md`)
- ERP users → Follow-up tasks: tracks tasks (evidence: `README.md`)
- ERP users → HR and payroll: manages workforce (evidence: `README.md`)
- ERP users → Fixed assets: tracks assets (evidence: `README.md`)
- ERP users → Maintenance and tickets: tracks support (evidence: `README.md`)
- ERP users → Reports and widgets: views insights (evidence: `README.md`)
