feat: add local dev workflow with hot reload via Traefik

Route dev domain through Traefik to host:3001 instead of Docker
container, enabling instant hot reload. Expose PostgreSQL and Redis
ports to localhost for local dev server connectivity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lorentz 2026-02-16 19:55:26 +00:00
parent 19e8730d41
commit 9fad8af225
3 changed files with 34 additions and 1 deletions

View file

@ -81,7 +81,8 @@ quest-vorteq/
├── traefik/ ├── traefik/
│ ├── traefik.yml # Traefik configuration │ ├── traefik.yml # Traefik configuration
│ ├── acme.json # SSL certificates (gitignored) │ ├── acme.json # SSL certificates (gitignored)
│ └── config/ # Dynamic Traefik config │ └── config/
│ └── dev-local.yml # Routes dev domain → host:3001 for local dev server
├── prisma/ ├── prisma/
│ ├── schema.prisma # PostgreSQL schema (auth + quest + ship/alloc/finance/paint/doc/wave/lts domains) │ ├── schema.prisma # PostgreSQL schema (auth + quest + ship/alloc/finance/paint/doc/wave/lts domains)
│ ├── migrations/ │ ├── migrations/
@ -170,6 +171,8 @@ src/components/forms/ # Shared form components
- Orders: implemented (list page with search and CSV export, HDC exception) - Orders: implemented (list page with search and CSV export, HDC exception)
- Remaining: shipments, coil-activity, invoices, shipment-requests, allocation-requests, jobs, admin pages - Remaining: shipments, coil-activity, invoices, shipment-requests, allocation-requests, jobs, admin pages
**Dev workflow:** Local Next.js dev server with hot reload via `PORT=3001 npm run dev`. Traefik routes `dev.quest.vorteq.wulf.cloud` to host:3001 via `traefik/config/dev-local.yml`. The `app-dev` Docker container should be stopped during local dev to avoid route conflicts.
**Auth status:** Better Auth is configured with Prisma adapter. A custom login endpoint exists at `/api/auth/login`. Auth middleware is temporarily disabled in dev mode (`DEV_MODE=true` bypasses to a mock admin session). The dev domain (`dev.quest.vorteq.wulf.cloud`) also bypasses auth in middleware. **Auth status:** Better Auth is configured with Prisma adapter. A custom login endpoint exists at `/api/auth/login`. Auth middleware is temporarily disabled in dev mode (`DEV_MODE=true` bypasses to a mock admin session). The dev domain (`dev.quest.vorteq.wulf.cloud`) also bypasses auth in middleware.
**Git:** Currently only `main` branch. No `development` branch yet. **Git:** Currently only `main` branch. No `development` branch yet.
@ -334,6 +337,18 @@ docker compose logs -f vorteq-dev # Tail dev container logs
npm run lint && npm run typecheck && npm test npm run lint && npm run typecheck && npm test
``` ```
### Local Development (Hot Reload)
```bash
# Start local dev (instead of Docker container)
docker compose stop app-dev # Release the competing Traefik route
PORT=3001 npm run dev # Run in a tmux pane — hot reload at https://dev.quest.vorteq.wulf.cloud
# Stop local dev (restore containerized version)
# Ctrl+C the dev server, then:
docker compose start app-dev
```
Traefik routes `dev.quest.vorteq.wulf.cloud``http://172.17.0.1:3001` via `traefik/config/dev-local.yml`. CI/CD pipeline is unchanged — pushes to `main` still build and deploy the production container.
## Environment Variables ## Environment Variables
```env ```env

View file

@ -36,6 +36,8 @@ services:
restart: unless-stopped restart: unless-stopped
networks: networks:
- web - web
ports:
- "127.0.0.1:5432:5432"
environment: environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_MULTIPLE_DATABASES: vorteq_dev,vorteq_test,vorteq_prod POSTGRES_MULTIPLE_DATABASES: vorteq_dev,vorteq_test,vorteq_prod
@ -55,6 +57,8 @@ services:
restart: unless-stopped restart: unless-stopped
networks: networks:
- web - web
ports:
- "127.0.0.1:6379:6379"
volumes: volumes:
- redis_data:/data - redis_data:/data
healthcheck: healthcheck:

View file

@ -0,0 +1,14 @@
http:
routers:
dev-local:
rule: "Host(`dev.quest.vorteq.wulf.cloud`)"
entrypoints:
- websecure
tls:
certResolver: letsencrypt
service: dev-local
services:
dev-local:
loadBalancer:
servers:
- url: "http://172.17.0.1:3001"