Local Development¶
The fast, hot-reload development loop for dichit-backend.
Prerequisites¶
- Tools from installation.md
- Docker available for local PostgreSQL and Redis
1. Start PostgreSQL + Redis¶
Starts postgres:16-alpine (port 5434) and redis:alpine (port 6379) from docker-compose.local.yml. Credentials default to user user / password password / db app.
Stop everything with pnpm docker:local:down.
2. Prepare the local database¶
setup:local chains: prisma:generate → migrate:local:up (applies migrations) → seed:local:up (dev seeders).
Individual steps if you need to control each:
pnpm prisma:generate # generate the Prisma client
pnpm migrate:local:up # apply migrations (prisma migrate dev)
pnpm seed:local:up # seed dev data
pnpm migrate:local:reset # wipe + re-apply migrations + seed
pnpm seed:local:down # un-seed
pnpm studio:local # open Prisma Studio on the local DB
3. Run the server (hot reload)¶
start:local = tsx watch src/interfaces/server with NODE_ENV=local. The default port is 3500 (see environment-variables.md).
Health check: http://localhost:3500/health (platform route).
Debug logging variants¶
# debug level + pretty logs + response bodies
pnpm start:local:debug
# also log Prisma queries + params + slow queries
pnpm start:local:debug:prisma
# everything at once
pnpm start:local:debug:all
See debugging.md for the meaning of each LOG_* flag.
4. Verify¶
For functional tests you need the test containers:
Day-to-day loop¶
pnpm start:local # dev server
pnpm prisma:generate # after schema changes (tsx may warn otherwise)
pnpm test:unit # iterate on logic
pnpm check # before committing / pushing
pnpm build # full production-style build
Common commands (reference)¶
| Command | Purpose |
|---|---|
pnpm build | clean → prisma:generate → esbuild → tsc-alias |
pnpm build:ci | same without prisma:generate |
pnpm check | typecheck + lint |
pnpm format | prettier write across repo |
pnpm knip | dead-code detection |
pnpm test | unit + functional |