How shankari987/construction-erp-mini-project works
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: material.py Domain endpoints · main.py API application · auth.py Auth endpoints · material_service.py Domain services
Components 19
React Client
- Client bootstrap
main.jsx - App shell
App.jsx - Route composition
routes/AppRoutes.jsx - Protected route · Blocks unauthenticated or denied navigation.
components/common/ProtectedRoute.jsx - Authenticated layout · Composes navbar and sidebar navigation.
components/layout/Layout.jsx - Domain pages · Dashboard, inventory, and purchase views.
pages/dashboard/Dashboard.jsx - Operational forms · Purchase and stock-out submissions.
components/forms/PurchaseForm.jsx - API adapters · Domain adapters centralize browser requests.
api/materialApi.js - HTTP client config
api/axios.js
Python API
- API application
main.py - Auth endpoints
routes/auth.py - Domain endpoints · Materials, purchases, inventory, suppliers, finance, and dashboard.
routes/material.py - Domain services · Executes primary ERP operations.
services/material_service.py - Validation schemas · Request and response validation.
schemas/material.py - Security primitives
core/security.py - Dependency wiring
utils/deps.py
Persistence
- Persistence models · Material, purchase, stock, supplier, and user records.
models/material.py - Database integration
core/database.py - ERP database · Stores operational and user data.
Connections 20
- 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