# REmodel Python calculation engine + FastAPI backend + Next.js frontend for Indian renewable energy (Solar + Wind + BESS) project finance modeling. Replaces an Excel-macro workflow for bid preparation at hybrid RTC RE projects. Computes optimal flat tariff and full 25-year project financials in <30 seconds per scenario. ## Prerequisites | Tool | Version | Install | |------|---------|---------| | Python | ≥ 3.12 | [python.org](https://python.org) | | Poetry | ≥ 2.0 | `curl -sSL https://install.python-poetry.org \| python3 -` | | Node.js | ≥ 20 | [nodejs.org](https://nodejs.org) | | pnpm | ≥ 10 | `npm install -g pnpm` | | Docker | any | [docker.com](https://docker.com) | ## Quick start ```bash git clone remodel cd remodel # 1. Start Redis (required for API + worker) docker compose up -d redis # 2. Install all deps make setup # 3. Start all services make dev ``` After `make dev`: | Service | URL | |---------|-----| | Web UI | http://localhost:3000 | | API | http://localhost:8000 | | API docs | http://localhost:8000/docs | | Redis | localhost:6379 | ## Package layout ``` packages/ ├── engine/ pip-installable Python calculation library (UI-agnostic) ├── api/ FastAPI + Arq async worker └── web/ Next.js App Router frontend ``` ## Common commands ```bash make setup # one-time: install all deps (Poetry + pnpm) make dev # start Redis, API server, Arq worker, web dev server make test # pytest (engine + api) + jest (web, if any) make lint # ruff + mypy + tsc + eslint make build # production build of web make clean # remove build artefacts, __pycache__, .next, etc. ``` ## Individual package commands ```bash # Engine cd packages/engine && poetry run pytest cd packages/engine && poetry run mypy src/ # API cd packages/api && poetry run uvicorn remodel_api.main:app --reload --port 8000 cd packages/api && poetry run arq remodel_api.workers.main.WorkerSettings cd packages/api && poetry run pytest # Web cd packages/web && pnpm dev cd packages/web && pnpm type-check cd packages/web && pnpm generate-types # needs API on :8000 ``` ## Pre-commit hooks ```bash pip install pre-commit pre-commit install ``` ## Architecture overview ``` ┌─────────────────────────────────────────────────────┐ │ packages/web (Next.js App Router + shadcn/ui) │ └────────────────────────┬────────────────────────────┘ │ REST + SSE ┌────────────────────────▼────────────────────────────┐ │ packages/api (FastAPI + Arq + SQLite) │ └────────────────────────┬────────────────────────────┘ │ Python import ┌────────────────────────▼────────────────────────────┐ │ packages/engine (Pydantic + NumPy + SciPy) │ └─────────────────────────────────────────────────────┘ ``` See `PROJECT.md` for full domain context and architectural decisions.