# Bhagirath ERP

Manufacturing ERP for a bus body-building plant: chassis inward and yard, production stations with
QA gates, quality checksheets, dispatch, sales and dealer orders, bills of material, purchasing and
stock, plus vendor, dealer and maintenance portals.

| Part | Technology |
|---|---|
| Backend | Python 3.12, FastAPI, SQLAlchemy 2 (async), Alembic |
| Frontend | React 18, Vite, TanStack Query, Tailwind CSS |
| Database | PostgreSQL 18 |

## Get started

- **Windows:** [docs/SETUP_GUIDE_WINDOWS.md](docs/SETUP_GUIDE_WINDOWS.md)
- **macOS:** [docs/SETUP_GUIDE_MAC.md](docs/SETUP_GUIDE_MAC.md). In short:
  `./scripts/setup_mac.sh ~/Downloads/erp_db.dump`, then `./scripts/run_mac.sh`

Once running: the application is at http://localhost:5173 and the API documentation at
http://localhost:8000/docs.

## Understand and change the system

- [docs/TECHNICAL_HANDOVER.md](docs/TECHNICAL_HANDOVER.md): architecture, file-by-file reference,
  database guide, business flows, what affects what, how to make common changes
- [docs/DATABASE_REFERENCE.md](docs/DATABASE_REFERENCE.md): every table and column

## Repository layout

```
backend/    FastAPI app (app/core, app/models, app/modules), Alembic migrations, scripts, tests
frontend/   React app (src/api, src/components, src/pages)
scripts/    macOS setup and run scripts
docs/       Documentation
```

## Configuration

Copy `backend/.env.example` to `backend/.env` and fill it in. `frontend/.env.example` documents the
optional frontend setting. Never commit `.env` files.

## Checks

```bash
cd backend && python -m pytest && alembic check
cd frontend && npx vite build
```
