ADR-002: Hybrid Local Dev Architecture
Status: β Accepted Date: 2026-03-22 Decision Makers: Tilak Kumar
Contextβ
Local development requires running three components: a PostgreSQL database, a Node.js backend API, and a React frontend. The team debated whether to run everything in Docker Compose or use a hybrid approach.
Running everything in Docker was considered for consistency, but it introduced significant friction:
- Hot-reload in Docker requires volume mounts and is 3β5Γ slower than native
- TypeScript compilation and
ts-node-dev/tsxwatch mode are noticeably slower inside containers - Debugging with breakpoints in VS Code/Cursor requires remote Docker debugger configuration
- Mac M-series (ARM) chips have Docker networking quirks that cause intermittent port-binding issues
Decisionβ
Run PostgreSQL in Docker only. Run backend and frontend natively on the host.
Docker Compose:
- postgres:15 (port 5432)
Host (native):
- backend β cd backend && npm run dev β http://localhost:4005
- frontend β cd frontend && npm run dev β http://localhost:3005
Rules that follow from this decision:β
- NEVER run frontend or backend inside Docker locally
- NEVER run
docker-compose upwithout specifying thepostgresservice - Redis is NOT used locally β the caching layer degrades gracefully
- DB shell:
docker-compose exec -T postgres psql -U tenable -d tenable_dashboard
Consequencesβ
Positive:
- Native TypeScript hot-reload is instantaneous vs. 2β5s in Docker
- Breakpoints and debuggers work out-of-the-box in VS Code/Cursor
- No Docker networking issues between frontend β backend
npm run devstartup is < 2s vs. 10β30s for container startup- Logs are readable directly in the terminal (no
docker logsneeded)
Negative / Trade-offs:
- Developers must have Node.js 20+ installed on their host machine
- "Works on my machine" risk is higher than a fully containerized environment
- PostgreSQL version difference between local Docker image and Supabase cloud (managed by pinning the image tag)
- Requires two terminals to be open (backend + frontend) β mitigated by a root-level
npm run dev:allscript
Alternatives Consideredβ
| Option | Why Rejected |
|---|---|
| Full Docker Compose (all 3 services) | Slow hot-reload, complex debug setup, Docker-on-Mac networking issues |
| Dev containers (VS Code) | Adds another layer of complexity; still slow for heavy TypeScript projects |
| Fully native (no Docker at all) | PostgreSQL installation on dev machines is inconsistent across OS versions; Docker gives a reproducible DB environment |
| Docker with volume mounts for code | Bind mounts on Mac are slow (osxfs/VirtioFS still has overhead); not worth it |