ZeroShift is a self-hosted deployment engine that runs blue-green Docker deployments on your own server. Push to GitHub — ZeroShift pulls the source, builds the image, starts the container, switches Nginx traffic, and tears down the old one. No downtime. No cloud lock-in.
// dashboard
// how it works
Every deploy targets the idle container slot. The live app is never touched until the new one is healthy.
Each project has two container slots — BLUE on basePort
and GREEN on basePort+1.
One is always live. Every deploy targets the idle one. Click the buttons to simulate.
ROLLED_BACK and a lower version number than current.// features
Built for real deployments on real hardware, not abstract cloud primitives.
Two container slots per project. Traffic switches in milliseconds via Nginx upstream reload. Zero dropped connections.
Webhook triggers on push. ZeroShift clones or fetches your repo, checks out the configured branch, and deploys.
Every previous deployment is stored. Roll back to any ROLLED_BACK version instantly — health-checked before traffic switches.
Stuck on a long build? Hit Stop. The pipeline is interrupted at the next checkpoint, the container stopped, and the lock released.
No Dockerfile? ZeroShift generates one — detects Node.js, Bun, Python. Scans subdirectories. Regenerated each deploy, never overwrites yours.
On startup, reconciliation scans for DEPLOYING records (process died mid-deploy), marks them FAILED, and cleans up orphaned containers.
Inject environment variables per project via the dashboard. Applied to the next deploy — no restart required.
Live CPU, memory, disk, and network stats for the host server. Per-container metrics — CPU %, memory used, net I/O, block I/O, PIDs. All polled in real-time from the dashboard.
AI-generates a production GitHub Actions workflow for your project — detects runtime, caches deps, runs build & test, then fires the ZeroShift webhook to deploy on every push.
// why zeroshift
No vendor lock-in. No monthly bill for a deployment tool. Just your server, running your code.
| Feature | ZeroShift | Heroku / Render | Kubernetes | Raw Docker |
|---|---|---|---|---|
| Zero-downtime deploys | ✓ | ✓ | ✓ | ✗ |
| Self-hosted | ✓ | ✗ | ✓ | ✓ |
| No cloud fees | ✓ | ✗ | depends | ✓ |
| Dashboard UI | ✓ | ✓ | 3rd party | ✗ |
| One-click rollback | ✓ | limited | ✓ | ✗ |
| Git-native workflow | ✓ | ✓ | via CI | ✗ |
| AI CI pipeline gen | ✓ | ✗ | ✗ | ✗ |
| Setup complexity | Low | Low | High | Medium |
| Open source | ✓ | ✗ | ✓ | ✓ |
// setup
Requires Bun, Docker, Nginx, and a PostgreSQL database (Neon free tier works).
Clone the repo and install dependencies with Bun.
git clone https://github.com/dinexh/ZeroShift-Engine cd ZeroShift-Engine bun install
Create a .env file at the repo root. Only DATABASE_URL is required.
# Required DATABASE_URL=postgresql://user:pass@host/db # Optional PORT=9090 DOCKER_NETWORK=bridge NGINX_CONFIG_PATH=/etc/nginx/conf.d/upstream.conf PROJECTS_ROOT_PATH=/var/zeroshift/projects GEMINI_API_KEY= # for AI pipeline generation
Creates the Project and Deployment tables. Re-run after any schema change.
bunx prisma db push
Next.js static export. Fastify serves it automatically from dashboard/out/.
cd dashboard && bun install && bun run build && cd ..
Dev mode with watch, or production via PM2.
bun --watch src/server.ts
pm2 start ecosystem.config.cjs pm2 save # persist across reboots
Engine + dashboard available at http://localhost:9090
basePort is auto-assigned. webhookSecret is auto-generated — copy the URL from the dashboard after creation.
# Create project curl -X POST http://localhost:9090/api/v1/projects \ -H 'Content-Type: application/json' \ -d '{ "name": "myapp", "repoUrl": "https://github.com/you/myapp", "branch": "main", "appPort": 3000 }' # Trigger first deploy curl -X POST http://localhost:9090/api/v1/deploy \ -H 'Content-Type: application/json' \ -d '{ "projectId": "<id>" }'
| Variable | Default | Description |
|---|---|---|
| DATABASE_URL required | — | PostgreSQL connection string |
| PORT | 9090 | API + dashboard port |
| DOCKER_NETWORK | bridge | Docker network for containers |
| NGINX_CONFIG_PATH | /etc/nginx/conf.d/upstream.conf | Nginx upstream file |
| PROJECTS_ROOT_PATH | /var/zeroshift/projects | Root dir for cloned repos |
| GEMINI_API_KEY | — | Google AI Studio key (optional) |
| GEMINI_MODEL | gemini-2.5-pro | Gemini model ID |
| LOG_LEVEL | info | Pino log level |
// api reference
All endpoints are prefixed with /api/v1. Responses are JSON.
| Method | Path | Description |
|---|---|---|
| POST | /projects | Create project |
| GET | /projects | List all projects |
| GET | /projects/:id | Get project |
| PATCH | /projects/:id | Update branch / ports / build context |
| PATCH | /projects/:id/env | Update env vars |
| DELETE | /projects/:id | Delete project |
| POST | /projects/:id/rollback | Rollback to previous deployment |
| POST | /projects/:id/cancel-deploy | Cancel in-progress deployment |
| Method | Path | Description |
|---|---|---|
| POST | /deploy | Trigger deployment { projectId } |
| GET | /deployments | List all deployments |
| GET | /status | Current active deployment |
| Method | Path | Description |
|---|---|---|
| POST | /webhooks/:secret | GitHub push webhook — triggers auto-deploy |
| GET | /system/server-stats | Host CPU / memory / disk / network |
| POST | /system/reconcile | Manual crash recovery |
| GET | /health | Engine health check |