Production ERP running daily operations at a steel fabrication business. 172 endpoints, 6-role RBAC, FastAPI + PostgreSQL on Cloud SQL + Cloud Run.
| URL | |
|---|---|
| App | kbsteel-backend-498310931350.asia-south1.run.app |
| API Docs | /docs |
| Version | /version |
| Username | Password | Role |
|---|---|---|
admin |
AdminTest2026Kbs |
Boss (full access) |
supervisor |
(contact admin) | Software Supervisor |
storekeeper |
(contact admin) | Store Keeper |
qainspector |
(contact admin) | QA Inspector |
dispatchop |
(contact admin) | Dispatch Operator |
user |
(contact admin) | View-only |
| Layer | Technology |
|---|---|
| Backend | FastAPI 0.128.0, Python 3.12, Gunicorn + Uvicorn |
| ORM | SQLAlchemy 2.0.46, Pydantic v2 |
| Database | PostgreSQL (Cloud SQL) / SQLite (dev) |
| Frontend | Vanilla JS, Bootstrap 5.3.2, no build step |
| Auth | JWT (python-jose), bcrypt, 6 RBAC roles |
| Excel | pandas 3.0.0 + openpyxl for import/export |
| Deploy | Google Cloud Run, Artifact Registry, Cloud Build |
| CI/CD | GitHub Actions (Workload Identity Federation) |
Raw Material Receipt (GRN) --> Weighbridge --> QA Inspection --> Stock Lot
|
Customer Order --> Excel Upload (auto-link profiles to inventory)
|
Fabrication --> Painting --> Dispatch --> Completed
| |
Auto-deduct inventory Dispatch note --> Weighbridge --> Ship
|
Scrap/Waste --> Recovery or Write-off
- Drawing-based production tracking (v3) — Kanban board with per-component stage tracking
- Dual inventory system — v1 simple counts + v2 lot-level traceability with immutable audit trail
- GRN/Dispatch workflows — Goods receipt and dispatch with weighbridge integration
- Auto material deduction — Fabrication stage auto-deducts from inventory with double-deduction prevention
- Excel import — 90+ column alias matching, auto-links profiles to raw materials
- 6-role RBAC — Boss, Supervisor, Store Keeper, QA Inspector, Dispatch Operator, User
- Scrap management — Track waste, recover reusable stock, loss analytics
- Real-time dashboard — Live counts, low stock alerts, auto-refresh
# Clone and setup
git clone https://github.com/mangod12/industryERP.git
cd industryERP
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
# Install dependencies
pip install -r requirements.txt
# Start (SQLite dev DB created automatically)
uvicorn backend_core.app.main:app --reload --port 8000Open http://localhost:8000 — frontend is served by FastAPI.
Admin credentials are printed to console on first startup.
172 endpoints across 3 API versions:
| Version | Prefix | Endpoints | Purpose |
|---|---|---|---|
| v1 | /auth, /customers, /tracking, etc. |
77 | Legacy CRUD, stage tracking |
| v2 | /api/v2/* |
27 | Lot-level inventory, GRN, dispatch |
| v3 | /api/v3/* |
+ | Drawing-based production tracking |
Full interactive docs at /docs.
kbsteel-old/
├── backend_core/app/ # FastAPI application
│ ├── main.py # App factory, router mounting
│ ├── models.py # v1 models (15 tables)
│ ├── models_v2.py # v2 models (12 tables)
│ ├── models_v3.py # v3 drawing models (10 tables)
│ ├── security.py # JWT, RBAC, rate limiting
│ ├── version.py # Version tracking
│ ├── db.py # Engine, sessions, migrations
│ ├── services/ # Business logic layer
│ └── routers/ # v2/v3 API endpoints
├── kumar_frontend/ # 24 HTML pages, vanilla JS
│ ├── js/config.js # Auth, API client, RBAC
│ └── css/main.css # Theming
├── tests/ # Test suite
│ ├── test_v3_drawings.py # Unit tests (TestClient)
│ └── e2e_cloud_run.py # 78 E2E tests against live deployment
├── .github/workflows/ # CI/CD pipelines
│ ├── ci.yml # Tests + Docker build verification
│ └── deploy.yml # Cloud Build + Cloud Run deploy
├── Dockerfile # Production container
└── deploy/ # nginx.conf, start.sh
git push main --> CI (tests + Docker build) --> Cloud Build --> Cloud Run (live)
- CI: Python 3.12 unit tests, Docker build verification on every push/PR
- CD: Automatic deploy to Cloud Run on push to
mainvia Workload Identity Federation
The app auto-deploys to Cloud Run on push to main. Manual deploy:
gcloud run deploy kbsteel-backend \
--source . \
--region asia-south1 \
--project kbsteel-erp \
--allow-unauthenticated| Variable | Required | Purpose |
|---|---|---|
KUMAR_SECRET_KEY |
prod | JWT signing key (min 32 chars) |
ENVIRONMENT |
no | production or development |
DATABASE_URL |
prod | PostgreSQL connection string |
CORS_ORIGINS |
no | Comma-separated allowed origins |
Private — Kumar Brothers Steel Industry.