1.8 KiB
1.8 KiB
Runbook: Development and Production
Development
- Setup env and deps
cp .env.dev.example .env
pnpm install
- Start services (PostgreSQL + Redis)
pnpm dev:start
- Start the apps (hot reload)
pnpm dev
# or
pnpm dev:apps
- Migrate database (optional initially)
pnpm dev:migrate
- Tools (optional)
pnpm dev:tools # Adminer (http://localhost:8080) + Redis Commander (http://localhost:8081)
- Stop / Status / Logs
pnpm dev:status
pnpm dev:logs
pnpm dev:stop
Notes
- Both apps read env from the root
.env(centralized). - Ports are controlled via env:
BFF_PORT(fallback toPORT) defaults to 4000NEXT_PORTdefaults to 3000
- Backend API runs on http://localhost:${BFF_PORT} (default 4000; paths start with
/api). - Portal runs on http://localhost:${NEXT_PORT} (default 3000).
Production
- Setup env
cp .env.production.example .env
# Edit .env with production values
- (Optional) First-time TLS certificate via HTTP challenge
# Replace with your domain and email
./scripts/prod/manage.sh issue-cert yourdomain.com you@example.com
- Deploy (build + start + migrate)
pnpm prod:deploy
- Status / Logs / Update / Stop
pnpm prod:status
pnpm prod:logs
pnpm prod:update
pnpm prod:stop
Endpoints (behind reverse proxy)
- Portal: https://yourdomain.com
- API: https://yourdomain.com/api
- Health: https://yourdomain.com/healthz (proxy) and https://yourdomain.com/api/health (backend)
Security
- Nginx enforces HTTPS, HSTS, CSP and rate limiting for
/api/. - Backend disables
x-powered-by, supportstrust proxy, and uses centralized env validation. - Do not commit the
.envfile; keep secrets safe (e.g.,secrets/volume for keys).