cubby dev
Start a local development environment with Docker. This provides a production-like environment on your machine with hot reload and a local Postgres database.Usage
Flags
| Flag | Description | Default |
|---|---|---|
--reset | Reset database (deletes all local data) | false |
--prod-mode | Simulate production environment (NODE_ENV=production) | false |
Examples
What Happens
- Validation - Checks for
cubby.yamland Docker - Port detection - Finds available ports (default: 3000 for app, 5432 for database)
- Secret injection - Loads local secrets (set via
cubby secrets set) - Compose generation - Creates
docker-compose.dev.yml - Container build - Builds your app container
- Database start - Starts Postgres with health check
- Schema sync - Runs
prisma db pushautomatically - Log streaming - Shows combined app and database logs
Output
How It Differs from npm run dev
| Feature | cubby dev | npm run dev |
|---|---|---|
| Database | Postgres in Docker | Manual setup required |
| Secrets | Injected from cubby secrets | Manual .env file |
| Environment | Production-like container | Node.js directly |
| Schema sync | Automatic | Manual prisma db push |
| Cleanup | Automatic on Ctrl+C | None |
Database Persistence
Data persists betweencubby dev sessions in a Docker volume named cubby-db-<appname>.
To start fresh:
Local Secrets
Secrets set withcubby secrets set are automatically injected:
process.env.OPENAI_API_KEY in your app.
Port Conflicts
If port 3000 or 5432 is in use,cubby dev automatically finds alternatives:
Stopping Development
PressCtrl+C to stop. This:
- Kills log streaming
- Stops containers
- Cleans up
docker-compose.dev.yml
Requirements
- Docker must be running
- Project must have
cubby.yaml(runcubby initfirst)
Troubleshooting
”Docker is not running”
Start Docker Desktop and try again.”Not a Cubby app directory”
Runcubby init first, or cd to a directory with cubby.yaml.
”Database failed to become healthy”
The Postgres container may be slow to start. Try:Schema Sync Warning
Ifprisma db push fails, you’ll see a warning but dev continues:
npx prisma db push manually to see the full error.
Related Commands
cubby init- Create a new appcubby secrets- Manage local secretscubby deploy- Deploy to production