This guide explains how to run the Acquisitions API using Docker with different configurations for development and production environments.
- Neon Local: Runs a local proxy that creates ephemeral database branches
- Application: Connects to Neon Local proxy instead of cloud database
- Benefits: Fresh database for each session, no impact on production data
- Neon Cloud Database: Direct connection to your production Neon database
- Application: Optimized production build with resource limits
- Benefits: Production-ready deployment with proper security and performance
- Docker & Docker Compose installed on your system
- Neon Account with a project created at console.neon.tech
- Neon API Key (get from Neon Console → Account Settings → API Keys)
From your Neon Console:
- NEON_API_KEY: Go to Account Settings → API Keys
- NEON_PROJECT_ID: Found in Project Settings → General
- DATABASE_URL: Copy from your dashboard (for production)
Edit .env.development:
# Required for Neon Local
NEON_API_KEY=neon_api_1ABCDEFGHijklmnop1234567890
NEON_PROJECT_ID=steep-forest-12345678
PARENT_BRANCH_ID=main
# Application settings
JWT_SECRET=your-development-jwt-secret-key-here
PORT=3000
LOG_LEVEL=debugEdit .env.production:
# Direct Neon Cloud connection
DATABASE_URL=postgres://username:password@ep-cool-darkness-123456.us-east-2.aws.neon.tech/dbname?sslmode=require
# Application settings
JWT_SECRET=your-strong-production-jwt-secret-key-here
PORT=3000
LOG_LEVEL=info
CORS_ORIGIN=https://yourdomain.com# Start with Neon Local (creates fresh ephemeral database)
npm run docker:dev
# Or manually
docker-compose -f docker-compose.dev.yml --env-file .env.development up --buildThis will:
- Start Neon Local proxy on port 5432
- Create an ephemeral database branch from your main branch
- Start your application with hot-reload on port 3000
- Mount your source code for live development
# View logs
npm run docker:logs:dev
# Stop and remove containers + volumes
npm run docker:dev:down
# Rebuild containers
npm run docker:build:dev
# Run database migrations (inside running container)
docker exec acquisitions-app-dev npm run db:migrate
# Open Drizzle Studio (inside running container)
docker exec acquisitions-app-dev npm run db:studio- Hot Reload: Code changes automatically restart the server
- Fresh Database: Each
docker:devcreates a new database branch - Volume Mounts: Source code and logs are mounted for easy access
- Debug Logging: Verbose logging for development
# Start in production mode (detached)
npm run docker:prod
# Or manually
docker-compose -f docker-compose.prod.yml --env-file .env.production up --build -dThis will:
- Build optimized production image
- Connect directly to your Neon Cloud database
- Run with resource limits and health checks
- Start in detached mode
# View logs
npm run docker:logs:prod
# Stop production containers
npm run docker:prod:down
# Rebuild production image
npm run docker:build:prod
# Scale the application (if needed)
docker-compose -f docker-compose.prod.yml up --scale app=3 -d- Optimized Build: Multi-stage Docker build for smaller image size
- Resource Limits: CPU and memory constraints
- Health Checks: Built-in application health monitoring
- Security: Non-root user, minimal attack surface
# Inside the running dev container
docker exec acquisitions-app-dev npm run db:migrate
# Or connect to Neon Local directly
docker exec acquisitions-neon-local psql -U neon -d neondb# Inside the running prod container
docker exec acquisitions-app-prod npm run db:migrate
# Or run one-time migration container
docker run --rm -it --env-file .env.production acquisitions-app npm run db:migrate# Development (with Neon Local)
docker exec acquisitions-app-dev npm run db:studio
# Visit http://localhost:4983
# Production (connects to cloud)
docker exec acquisitions-app-prod npm run db:studio- Application: http://localhost:3000
- Neon Local: localhost:5432
- Drizzle Studio: http://localhost:4983
- Application: http://localhost:3000 (configure reverse proxy)
- Database: Direct connection to Neon Cloud
- Ephemeral databases automatically deleted
- Debug logging may expose sensitive information
- Use only for development
- Strong JWT secrets
- CORS properly configured
- Resource limits enforced
- Health checks for reliability
# Check if Neon Local is healthy
docker-compose -f docker-compose.dev.yml ps
# Check Neon Local logs
docker logs acquisitions-neon-local
# Verify environment variables
docker-compose -f docker-compose.dev.yml config# Check database connection
docker exec acquisitions-app-dev npm run db:studio
# Manual migration
docker exec -it acquisitions-app-dev npm run db:generate
docker exec -it acquisitions-app-dev npm run db:migrate# Stop all containers
docker-compose -f docker-compose.dev.yml down
docker-compose -f docker-compose.prod.yml down
# Check what's using the port
lsof -i :3000
lsof -i :5432# Remove all containers and volumes
docker-compose -f docker-compose.dev.yml down -v
docker-compose -f docker-compose.prod.yml down -v
# Remove Docker images
docker rmi acquisitions-app
# Clean up Docker system
docker system prune -aacquisitions/
├── Dockerfile # Multi-stage Docker build
├── docker-compose.dev.yml # Development with Neon Local
├── docker-compose.prod.yml # Production with Neon Cloud
├── .dockerignore # Files excluded from build
├── .env.development # Development environment vars
├── .env.production # Production environment vars
├── .neon_local/ # Neon Local metadata (git ignored)
└── logs/ # Application logs (mounted)
- Always use environment-specific files
- Never commit real credentials to git
- Use ephemeral branches for development testing
- Monitor resource usage in production
- Regularly update Docker images
- Use Docker health checks
- Implement proper logging and monitoring
- Install Docker and Docker Compose
- Create Neon account and get API credentials
- Update
.env.developmentwith your Neon credentials - Update
.env.productionwith your production database URL - Run
npm run docker:devto start development - Visit http://localhost:3000 to verify the application
- Run database migrations if needed
- For production, use
npm run docker:prod
For additional help, check the Neon Local documentation or create an issue in the project repository.