Skip to content

DevBox Development Environment

TL;DR: The DevBox is a containerized development environment with all tools pre-installed, all platform services accessible, and your workspace mounted for hot-reload development.

The DevBox container provides a complete, isolated development environment for the Banyan Platform. It eliminates “works on my machine” problems by giving every developer the exact same environment with all dependencies pre-configured.

  • What the DevBox is and why you should use it
  • How to build and test inside the DevBox
  • How to run platform services with hot-reload
  • How to debug issues using DevBox tools
  • DevBox vs local development trade-offs

The DevBox is a Docker container that includes:

  • Node.js 20 - JavaScript/TypeScript runtime
  • pnpm - Package manager with workspace support
  • All build tools - TypeScript, Biome, Jest pre-installed
  • Development utilities - git, gh, fzf, tmux, nano, vim
  • Native build tools - gcc, g++, make, python3 for native modules
  • Network access to all platform services (RabbitMQ, PostgreSQL, Redis, Jaeger)
  • Workspace mounted at /workspace with hot-reload
  • Persistent command history across container restarts
  • Claude Code CLI for AI-assisted development

1. Zero Local Setup

  • No need to install Node.js, pnpm, or any dependencies locally
  • Works the same on macOS, Linux, and Windows

2. CI/CD Parity

  • DevBox environment matches GitHub Actions exactly
  • “It works in CI” = “It works on my machine”

3. Isolated Environment

  • Doesn’t pollute your local system with dependencies
  • Multiple platform versions can coexist

4. All Services Available

  • RabbitMQ, PostgreSQL, Redis, Jaeger accessible at localhost
  • No port conflicts with your local services

5. Hot Reload

  • Changes to your local files immediately reflect in container
  • No need to rebuild for code changes

Use DevBox for:

  • ✅ Building platform packages
  • ✅ Running tests (unit, integration, comprehensive)
  • ✅ Developing platform services (auth-service, api-gateway, etc.)
  • ✅ Debugging with full observability stack
  • ✅ Reproducing CI failures locally

Use Local Development for:

  • ❌ Quick edits to markdown files
  • ❌ Reviewing code (your IDE works better locally)
  • ❌ Git operations (easier with local tools)
Terminal window
# From repository root
docker compose up -d
# Wait for services to be ready (~30 seconds)
docker compose ps

Expected output:

NAME STATUS
flow-platform-devbox Up 30 seconds
rabbitmq Up 30 seconds (healthy)
postgres Up 30 seconds (healthy)
redis Up 30 seconds (healthy)
jaeger Up 30 seconds
grafana Up 30 seconds
Terminal window
# Open a shell in the DevBox
docker compose exec devbox /bin/bash
# You're now inside the container
node@flow-platform-devbox:/workspace$
Terminal window
# Check versions
node --version # v20.x
pnpm --version # 8.x
tsc --version # 5.x
# Check services are accessible
ping -c 1 rabbitmq
ping -c 1 postgres
ping -c 1 redis

Build all packages:

Terminal window
# Inside DevBox
pnpm install
pnpm run build

Build specific package:

Terminal window
# Inside DevBox
cd platform/packages/core
pnpm run build
# Or from root with filter
pnpm --filter @banyanai/platform-core run build

Watch mode (hot-reload):

Terminal window
# Inside DevBox
cd platform/packages/core
pnpm run dev
# Or parallel watch for all packages
pnpm -r --parallel run dev

All tests:

Terminal window
# Inside DevBox
pnpm run test

Specific package tests:

Terminal window
# Inside DevBox
cd platform/packages/cqrs
pnpm run test
# Or from root
pnpm --filter @banyanai/platform-cqrs run test

Integration tests (require services):

Terminal window
# Inside DevBox - services are already running!
pnpm run test:integration
# Specific integration test
cd platform/packages/message-bus-client
pnpm run test -- --testPathPattern=integration

Comprehensive tests:

Terminal window
# Inside DevBox
cd platform/packages/telemetry
pnpm run test:comprehensive

Watch mode for tests:

Terminal window
# Inside DevBox
pnpm run test:watch
# Or specific file
pnpm run test:watch CreateUserHandler.test.ts

The platform services (auth-service, api-gateway, service-discovery) can run inside the DevBox with hot-reload.

Start all platform services:

Terminal window
# Inside DevBox
pnpm -r --parallel run dev

Start specific service:

Terminal window
# Inside DevBox
cd platform/services/api-gateway
pnpm run dev
# API Gateway now accessible at http://localhost:3003

Check service logs:

Terminal window
# From host machine
docker compose logs -f devbox
# Or inside DevBox
# Services log to stdout

Run full quality check:

Terminal window
# Inside DevBox
./platform/scripts/quality-check-all.sh

This runs:

  • TypeScript compilation
  • Biome linting
  • All tests
  • Coverage checks (90%+ required)

Quick quality check:

Terminal window
# Inside DevBox
./platform/scripts/quick-quality-check.sh

Open multiple shells in the same DevBox:

Terminal window
# Terminal 1: Run tests in watch mode
docker compose exec devbox /bin/bash
pnpm run test:watch
# Terminal 2: Run service in dev mode
docker compose exec devbox /bin/bash
cd platform/services/api-gateway && pnpm run dev
# Terminal 3: Interactive debugging
docker compose exec devbox /bin/bash

The DevBox includes tmux for managing multiple panes in one shell:

Terminal window
# Inside DevBox
tmux
# Split horizontally: Ctrl+b then "
# Split vertically: Ctrl+b then %
# Switch panes: Ctrl+b then arrow keys
# New window: Ctrl+b then c
# Detach: Ctrl+b then d
# Reattach: tmux attach

View RabbitMQ queues:

Terminal window
# Inside DevBox
curl -u admin:admin123 http://rabbitmq:15672/api/queues

Check PostgreSQL:

Terminal window
# Inside DevBox
PGPASSWORD=actor_pass123 psql -h postgres -U actor_user -d eventstore -c "\dt"

Check Redis cache:

Terminal window
# Inside DevBox
redis-cli -h redis -a redis123 keys '*'

View Jaeger traces:

Terminal window
# Open from host machine browser
open http://localhost:16686
# Or check if Jaeger is receiving traces
curl http://jaeger:16686/api/services
Terminal window
# Inside DevBox (as node user)
npm install -g <package-name>
# Or install system packages (requires root)
docker compose exec -u root devbox apt-get update
docker compose exec -u root devbox apt-get install -y <package-name>

All files at /workspace inside DevBox are your repository files:

Terminal window
# Edit on host machine
code platform/packages/core/src/index.ts
# Changes immediately available inside DevBox
# DevBox watches for changes and rebuilds automatically

The DevBox has access to all platform environment variables:

Terminal window
# Inside DevBox
echo $RABBITMQ_URL
# amqp://admin:admin123@rabbitmq:5672
echo $DATABASE_URL
# postgresql://actor_user:actor_pass123@postgres:5432/eventstore
echo $REDIS_URL
# redis://:redis123@redis:6379

The DevBox mounts several volumes:

  • Workspace: ./workspace (your code, hot-reload enabled)
  • Command history: Persistent bash history across restarts
  • Claude config: Persistent Claude Code configuration

Services are accessible from both host and DevBox:

ServiceFrom HostFrom DevBox
RabbitMQ AMQPlocalhost:55671rabbitmq:5672
RabbitMQ UIlocalhost:55672rabbitmq:15672
PostgreSQLlocalhost:55432postgres:5432
Redislocalhost:56379redis:6379
Jaeger UIlocalhost:16686jaeger:16686
Grafanalocalhost:5005grafana:3000
API Gatewaylocalhost:3003localhost:3003
Auth Servicelocalhost:3001localhost:3001

Problem: DevBox container fails to start

Solution 1: Check if ports are in use

Terminal window
# Check port conflicts
lsof -i :3001
lsof -i :3003
lsof -i :55671
# Stop conflicting processes or change ports in docker-compose.yml

Solution 2: Rebuild DevBox image

Terminal window
docker compose down
docker compose build devbox
docker compose up -d

Solution 3: Clean volumes and restart

Terminal window
docker compose down -v
docker compose up -d

Problem: Cannot write files inside DevBox

Solution: Fix ownership

Terminal window
# Inside DevBox
sudo chown -R node:node /workspace
# Or from host
docker compose exec -u root devbox chown -R node:node /workspace

Problem: Different environment behavior

Solution 1: Check service connectivity

Terminal window
# Inside DevBox
ping rabbitmq
ping postgres
ping redis
# All should respond

Solution 2: Check environment variables

Terminal window
# Inside DevBox
env | grep -E "RABBITMQ|DATABASE|REDIS"
# Should show correct URLs with service names, not localhost

Solution 3: Clear node_modules and reinstall

Terminal window
# Inside DevBox
rm -rf node_modules platform/*/node_modules
pnpm install
pnpm run build
pnpm run test

Problem: Builds are slower in DevBox than locally

Solution 1: Use watch mode instead of rebuilding

Terminal window
# Inside DevBox
pnpm -r --parallel run dev

Solution 2: Increase Docker resources

Terminal window
# Docker Desktop → Settings → Resources
# CPU: 4+ cores
# Memory: 8+ GB
# Swap: 2+ GB

Solution 3: Use build filters

Terminal window
# Only build what you're working on
pnpm --filter @banyanai/platform-core run build

Problem: Bash history lost on DevBox restart

Solution: Check volume mount

Terminal window
# Verify volume exists
docker volume ls | grep command-history
# If missing, recreate
docker compose down
docker compose up -d

Problem: Cannot connect to RabbitMQ/PostgreSQL from DevBox

Solution 1: Wait for health checks

Terminal window
# Check service health
docker compose ps
# All should show "healthy" or "Up"
# If "starting", wait 30 seconds and check again

Solution 2: Check network

Terminal window
# Inside DevBox
docker network ls | grep flow-platform
# All services should be on same network

Solution 3: Restart services

Terminal window
docker compose restart rabbitmq postgres redis

Before committing, verify your changes work in a clean environment:

Terminal window
# Inside DevBox
rm -rf node_modules platform/*/node_modules
pnpm install
pnpm run build
pnpm run test
./platform/scripts/quality-check-all.sh

Don’t constantly stop/start DevBox:

Terminal window
# Start once
docker compose up -d
# Enter/exit as needed
docker compose exec devbox /bin/bash
exit
# Stop only when done for the day
docker compose down

Enable hot-reload for faster iteration:

Terminal window
# Terminal 1: Watch platform packages
docker compose exec devbox /bin/bash
pnpm -r --parallel run dev
# Terminal 2: Watch tests
docker compose exec devbox /bin/bash
pnpm run test:watch
# Edit files on host, see changes immediately

CI runs in DevBox, so test there before pushing:

Terminal window
# Inside DevBox
pnpm run build
pnpm run test
pnpm run lint
# If these pass, CI will pass too

Your bash history persists across restarts:

Terminal window
# Inside DevBox
history | grep pnpm
# Use Ctrl+R to search history
# Use !! to repeat last command
# Use !pnpm to repeat last pnpm command
FeatureDevBoxLocalCI (GitHub Actions)
Setup time2 min (first time)15 min (install tools)Automatic
EnvironmentDocker containerHost machineDocker container
Consistency✅ Always same❌ Varies by machine✅ Always same
Service access✅ All services ready⚠️ Manual setup✅ All services ready
Hot reload✅ Yes✅ Yes❌ No
Performance⚠️ Slight overhead✅ Native speed⚠️ Varies
Debugging✅ Full access✅ Full access❌ Limited
Matches CI✅ Exact match❌ Different✅ Exact match

Recommendation: Use DevBox for builds/tests, local for editing, CI for validation.

graph TB
Host[Your Machine]
DevBox[DevBox Container]
RabbitMQ[RabbitMQ Container]
Postgres[PostgreSQL Container]
Redis[Redis Container]
Jaeger[Jaeger Container]
Host -->|Workspace mounted| DevBox
Host -->|Edit files| Workspace[/workspace]
Workspace -->|Hot reload| DevBox
DevBox -->|amqp://rabbitmq:5672| RabbitMQ
DevBox -->|postgresql://postgres:5432| Postgres
DevBox -->|redis://redis:6379| Redis
DevBox -->|http://jaeger:4318| Jaeger
Host -->|Browser| Jaeger
Host -->|Browser| RabbitMQ
style DevBox fill:#5f67ee,color:#fff
style Workspace fill:#7d85ff,color:#fff

Start DevBox:

Terminal window
docker compose up -d
docker compose exec devbox /bin/bash

Build everything:

Terminal window
pnpm install && pnpm run build

Run all tests:

Terminal window
pnpm run test

Quality check:

Terminal window
./platform/scripts/quality-check-all.sh

Stop DevBox:

Terminal window
exit # Exit shell
docker compose down # Stop all services

Pro Tip: Add this alias to your ~/.bashrc or ~/.zshrc for quick DevBox access:

Terminal window
alias devbox='docker compose exec devbox /bin/bash'

Then just run devbox to enter the container!