Development Environment:
- Backend API container (Node.js + Express + Prisma)
- PostgreSQL container (local database)
- Hot reload for instant code changes
- Persistent data storage
Production Environment:
- Optimized backend container (multi-stage build)
- External Supabase PostgreSQL
How hot reload works:
- Host code:
./backend/src/app.ts - Container path:
/app/src/app.ts - Volume mount:
./backend:/app - Development server:
npx tsx src/server.ts --watch
When you edit a file:
- File changes on host
- Volume sync to container
- tsx detects change
- Server restarts automatically
- Changes visible immediately
Node modules protection:
- Volume:
/app/node_modules - Prevents host overwriting container dependencies
- Ensures consistent environment
# Build prod image
docker build -f backend/Dockerfile.production -t cinecircle-backend .
# Tag
docker tag cinecircle-backend registry.digitalocean.com/your-registry/cinecircle
# Deploy trivially--
When SYNC_FROM_PRODUCTION=true in docker-compose, the container will:
- Pull Schema: Downloads the latest schema from production using
prisma db pull - Apply Schema: Resets and applies the schema to the local database
- Copy Data: Uses
pg_dumpto copy all data from production to local - Generate Client: Regenerates the Prisma client
After startup, ALL database operations use the local PostgreSQL database.
DATABASE_URL→ Local PostgreSQL (postgresql://devuser:devpassword@postgres:5432/devdb)PROD_DIRECT_URL→ Production Supabase (for syncing only)- Docker overrides ensure local database is used at runtime
DATABASE_URL→ Production Supabase- No sync operations