docs/dev-setup.md
This project runs generation primarily through the FastAPI backend in backend/ (Railway in production).
Next.js Route Handlers under /api/generate/* remain available as an optional fallback path.
Recommended versions:
22.x (see .nvmrc)9.13.03.12.x (required for FastAPI backend work)0.5.24+ (required for FastAPI backend work)Install/check:
node -v
pnpm -v
python3 --version
uv --version
docker --version
Expected:
v229.13.0 (or compatible in the same series)3.12pnpm install
cd backend
uv sync --no-install-project
cd ..
This creates backend/.venv and installs pinned Python dependencies from backend/uv.lock.
cp .env.example .env
Then set at least:
POSTGRES_URLOPENAI_API_KEYOptional:
OPENAI_MODEL (single model used for all generation stages, defaults to gpt-5.4-mini)GITHUB_PATNEXT_PUBLIC_POSTHOG_KEYNEXT_PUBLIC_USE_LEGACY_BACKEND=true and NEXT_PUBLIC_API_DEV_URL (to route frontend calls to an external backend such as Railway/local FastAPI)Start local Postgres (if using local DB URL):
chmod +x start-database.sh
./start-database.sh
Push schema:
pnpm db:push
Start frontend:
pnpm dev
Start FastAPI backend (recommended for production parity):
docker-compose up --build -d
docker-compose logs -f api
or
pnpm dev:backend
If the FastAPI backend is running locally at http://localhost:8000, set:
NEXT_PUBLIC_USE_LEGACY_BACKEND=trueNEXT_PUBLIC_API_DEV_URL=http://localhost:8000Run all baseline checks:
pnpm check
pnpm test
pnpm build
FastAPI backend checks:
cd backend
uv run pytest -q
uv run python -m compileall app
cd ..
If all pass, your local environment is ready.