# shankari987/construction-erp-mini-project architecture

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

- Interactive diagram: https://gitdiagram.com/shankari987/construction-erp-mini-project
- Repository: https://github.com/shankari987/construction-erp-mini-project

## Overview

#### Purpose and entry points
Construction ERP mini-project with a React client and Python API for materials, suppliers, purchasing, inventory/stock movements, finance, dashboard reporting, and authentication. Frontend boots at `main.jsx` and composes `App.jsx`; backend application starts from `main.py`.

#### Frontend application shell and navigation
Client-side route composition is centralized in `routes/AppRoutes.jsx`. The authenticated application frame is provided by `components/layout/Layout.jsx`, with navigation in `components/layout/Navbar.jsx` and `components/layout/Sidebar.jsx`. Feature pages are organized by domain, including `pages/dashboard/Dashboard.jsx`, `pages/inventory/Inventory.jsx`, and `pages/purchase/PurchaseList.jsx`.

#### Authentication and access boundary
Authentication API calls are isolated in `api/authApi.js`. Protected UI navigation is enforced through `components/common/ProtectedRoute.jsx`, with denied-state handling in `components/common/AccessDenied.jsx`. On the API side, auth endpoints live in `routes/auth.py`; user persistence and security primitives are represented by `models/user.py` and `core/security.py`.

#### API and domain routing layer
The backend exposes domain-specific route modules: `routes/material.py`, `routes/purchase.py`, `routes/inventory.py`, `routes/supplier.py`, `routes/finance.py`, and `routes/dashboard.py`. These form the HTTP boundary between the React client and business services. Corresponding client adapters, such as `api/materialApi.js`, `api/purchaseApi.js`, and `api/inventoryApi.js`, centralize request behavior rather than embedding API calls in pages.

#### Business services, persistence, and validation
Service modules contain the primary domain operations: `services/material_service.py`, `services/purchase_service.py`, `services/inventory_service.py`, `services/supplier_service.py`, and `services/finance_service.py`. They operate on persistence models in `models/material.py`, `models/purchase.py`, `models/stock.py`, and `models/supplier.py`. Request/response validation contracts are separated into schema modules such as `schemas/material.py`, `schemas/purchase.py`, and `schemas/stock.py`.

#### Core operational flow
A typical workflow is: a user authenticates; the frontend route guard permits access; a feature page invokes its `api/*Api.js` adapter; the backend route delegates to a service; the service validates/uses schemas and updates models through the configured database layer. Purchase and stock-out interactions are captured through `components/forms/PurchaseForm.jsx` and `components/forms/StockOutForm.jsx`, feeding purchase and inventory APIs. Dashboard and finance views consume aggregated operational data through `api/dashboardApi.js` and `api/financeApi.js`.

#### Runtime and infrastructure boundaries
The browser runtime is React/JSX with shared styling and theme assets in `App.css`, `index.css`, and `theme/theme.js`. The server runtime is Python, with application configuration and database integration isolated in `core/config.py` and `core/database.py`. Dependency/access wiring appears in `utils/deps.py`; HTTP client configuration is centralized in `api/axios.js`. The database is the material external infrastructure implied by the model and database layers; no external SaaS integrations are evident from the repository tree.

Main entry points: [`routes/material.py`](https://github.com/shankari987/construction-erp-mini-project/blob/main/routes/material.py) (Domain endpoints), [`main.py`](https://github.com/shankari987/construction-erp-mini-project/blob/main/main.py) (API application), [`routes/auth.py`](https://github.com/shankari987/construction-erp-mini-project/blob/main/routes/auth.py) (Auth endpoints), [`services/material_service.py`](https://github.com/shankari987/construction-erp-mini-project/blob/main/services/material_service.py) (Domain services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React Client"]
  node_client_boot["Client bootstrap<br/>React entry<br/>[main.jsx]"]
  node_app_shell["App shell<br/>React composition<br/>[App.jsx]"]
  node_app_routes["Route composition<br/>client routing<br/>[AppRoutes.jsx]"]
  node_protected_route["Protected route<br/>access guard<br/>[ProtectedRoute.jsx]"]
  node_layout["Authenticated layout<br/>UI frame<br/>[Layout.jsx]"]
  node_feature_pages["Domain pages<br/>React pages<br/>[Dashboard.jsx]"]
  node_workflow_forms["Operational forms<br/>React forms<br/>[PurchaseForm.jsx]"]
  node_api_adapters["API adapters<br/>client API layer<br/>[materialApi.js]"]
  node_http_client["HTTP client config<br/>Axios configuration<br/>[axios.js]"]
end

subgraph group_backend["Python API"]
  node_api_app["API application<br/>Python entry<br/>[main.py]"]
  node_auth_routes["Auth endpoints<br/>HTTP routes<br/>[auth.py]"]
  node_domain_routes["Domain endpoints<br/>HTTP routes<br/>[material.py]"]
  node_domain_services["Domain services<br/>business services"]
  node_schemas["Validation schemas<br/>data contracts<br/>[material.py]"]
  node_security["Security primitives<br/>auth security<br/>[security.py]"]
  node_dependencies["Dependency wiring<br/>API dependencies<br/>[deps.py]"]
end

subgraph group_data["Persistence"]
  node_models["Persistence models<br/>ORM models<br/>[material.py]"]
  node_database_layer["Database integration<br/>database configuration<br/>[database.py]"]
  node_database[("ERP database<br/>external infrastructure")]
end

node_client_boot -->|"boots"| node_app_shell
node_app_shell -->|"composes"| node_app_routes
node_app_routes -->|"guards routes"| node_protected_route
node_protected_route -->|"permits authenticated UI"| node_layout
node_layout -->|"hosts"| node_feature_pages
node_feature_pages -->|"loads domain data"| node_api_adapters
node_workflow_forms -->|"submits operations"| node_api_adapters
node_api_adapters -->|"uses"| node_http_client
node_http_client -->|"HTTP requests"| node_api_app
node_api_app -->|"mounts"| node_auth_routes
node_api_app -->|"mounts"| node_domain_routes
node_auth_routes -->|"authenticates with"| node_security
node_auth_routes -->|"persists users"| node_models
node_domain_routes -->|"resolves dependencies"| node_dependencies
node_domain_routes -->|"delegates"| node_domain_services
node_domain_routes -->|"validates requests"| node_schemas
node_domain_services -->|"uses contracts"| node_schemas
node_domain_services -->|"reads and updates"| node_models
node_models -->|"uses"| node_database_layer
node_database_layer -->|"connects to"| node_database

click node_client_boot "https://github.com/shankari987/construction-erp-mini-project/blob/main/main.jsx"
click node_app_shell "https://github.com/shankari987/construction-erp-mini-project/blob/main/App.jsx"
click node_app_routes "https://github.com/shankari987/construction-erp-mini-project/blob/main/routes/AppRoutes.jsx"
click node_protected_route "https://github.com/shankari987/construction-erp-mini-project/blob/main/components/common/ProtectedRoute.jsx"
click node_layout "https://github.com/shankari987/construction-erp-mini-project/blob/main/components/layout/Layout.jsx"
click node_feature_pages "https://github.com/shankari987/construction-erp-mini-project/blob/main/pages/dashboard/Dashboard.jsx"
click node_workflow_forms "https://github.com/shankari987/construction-erp-mini-project/blob/main/components/forms/PurchaseForm.jsx"
click node_api_adapters "https://github.com/shankari987/construction-erp-mini-project/blob/main/api/materialApi.js"
click node_http_client "https://github.com/shankari987/construction-erp-mini-project/blob/main/api/axios.js"
click node_api_app "https://github.com/shankari987/construction-erp-mini-project/blob/main/main.py"
click node_auth_routes "https://github.com/shankari987/construction-erp-mini-project/blob/main/routes/auth.py"
click node_domain_routes "https://github.com/shankari987/construction-erp-mini-project/blob/main/routes/material.py"
click node_domain_services "https://github.com/shankari987/construction-erp-mini-project/blob/main/services/material_service.py"
click node_schemas "https://github.com/shankari987/construction-erp-mini-project/blob/main/schemas/material.py"
click node_security "https://github.com/shankari987/construction-erp-mini-project/blob/main/core/security.py"
click node_dependencies "https://github.com/shankari987/construction-erp-mini-project/blob/main/utils/deps.py"
click node_models "https://github.com/shankari987/construction-erp-mini-project/blob/main/models/material.py"
click node_database_layer "https://github.com/shankari987/construction-erp-mini-project/blob/main/core/database.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_client_boot,node_app_shell,node_app_routes,node_protected_route,node_layout,node_feature_pages,node_workflow_forms,node_api_adapters,node_http_client toneBlue
class node_api_app,node_auth_routes,node_domain_routes,node_domain_services,node_schemas,node_security,node_dependencies toneAmber
class node_models,node_database_layer,node_database toneMint
```

## Components

### React Client

- [Client bootstrap](https://github.com/shankari987/construction-erp-mini-project/blob/main/main.jsx): React entry · `main.jsx`
- [App shell](https://github.com/shankari987/construction-erp-mini-project/blob/main/App.jsx): React composition · `App.jsx`
- [Route composition](https://github.com/shankari987/construction-erp-mini-project/blob/main/routes/AppRoutes.jsx): client routing · `routes/AppRoutes.jsx`
- [Protected route](https://github.com/shankari987/construction-erp-mini-project/blob/main/components/common/ProtectedRoute.jsx): access guard · Blocks unauthenticated or denied navigation. · `components/common/ProtectedRoute.jsx`
- [Authenticated layout](https://github.com/shankari987/construction-erp-mini-project/blob/main/components/layout/Layout.jsx): UI frame · Composes navbar and sidebar navigation. · `components/layout/Layout.jsx`
- [Domain pages](https://github.com/shankari987/construction-erp-mini-project/blob/main/pages/dashboard/Dashboard.jsx): React pages · Dashboard, inventory, and purchase views. · `pages/dashboard/Dashboard.jsx`
- [Operational forms](https://github.com/shankari987/construction-erp-mini-project/blob/main/components/forms/PurchaseForm.jsx): React forms · Purchase and stock-out submissions. · `components/forms/PurchaseForm.jsx`
- [API adapters](https://github.com/shankari987/construction-erp-mini-project/blob/main/api/materialApi.js): client API layer · Domain adapters centralize browser requests. · `api/materialApi.js`
- [HTTP client config](https://github.com/shankari987/construction-erp-mini-project/blob/main/api/axios.js): Axios configuration · `api/axios.js`

### Python API

- [API application](https://github.com/shankari987/construction-erp-mini-project/blob/main/main.py): Python entry · `main.py`
- [Auth endpoints](https://github.com/shankari987/construction-erp-mini-project/blob/main/routes/auth.py): HTTP routes · `routes/auth.py`
- [Domain endpoints](https://github.com/shankari987/construction-erp-mini-project/blob/main/routes/material.py): HTTP routes · Materials, purchases, inventory, suppliers, finance, and dashboard. · `routes/material.py`
- [Domain services](https://github.com/shankari987/construction-erp-mini-project/blob/main/services/material_service.py): business services · Executes primary ERP operations. · `services/material_service.py`
- [Validation schemas](https://github.com/shankari987/construction-erp-mini-project/blob/main/schemas/material.py): data contracts · Request and response validation. · `schemas/material.py`
- [Security primitives](https://github.com/shankari987/construction-erp-mini-project/blob/main/core/security.py): auth security · `core/security.py`
- [Dependency wiring](https://github.com/shankari987/construction-erp-mini-project/blob/main/utils/deps.py): API dependencies · `utils/deps.py`

### Persistence

- [Persistence models](https://github.com/shankari987/construction-erp-mini-project/blob/main/models/material.py): ORM models · Material, purchase, stock, supplier, and user records. · `models/material.py`
- [Database integration](https://github.com/shankari987/construction-erp-mini-project/blob/main/core/database.py): database configuration · `core/database.py`
- **ERP database**: external infrastructure · Stores operational and user data.

## Connections

- Client bootstrap → App shell: boots
- App shell → Route composition: composes
- Route composition → Protected route: guards routes
- Protected route → Authenticated layout: permits authenticated UI
- Authenticated layout → Domain pages: hosts
- Domain pages → API adapters: loads domain data
- Operational forms → API adapters: submits operations
- API adapters → HTTP client config: uses
- HTTP client config → API application: HTTP requests
- API application → Auth endpoints: mounts
- API application → Domain endpoints: mounts
- Auth endpoints → Security primitives: authenticates with
- Auth endpoints → Persistence models: persists users
- Domain endpoints → Dependency wiring: resolves dependencies
- Domain endpoints → Domain services: delegates
- Domain endpoints → Validation schemas: validates requests
- Domain services → Validation schemas: uses contracts
- Domain services → Persistence models: reads and updates
- Persistence models → Database integration: uses
- Database integration → ERP database: connects to
