Platform Architecture
Cubby uses a multi-server architecture to deploy and run your applications reliably.Overview
Control Plane
The control plane handles:- API: Receives deploys, manages apps, serves the dashboard
- Traefik: Routes HTTPS traffic to the right container
- Prometheus: Collects metrics for monitoring
- Authentication: Manages Cubby SSO across all apps
App Servers
App servers run your containerized applications:- Each app runs in an isolated Docker container
- Databases run alongside apps in separate containers
- Resource limits (CPU, memory) are enforced per container
- Multiple apps can run on the same server
Deployment Flow
When you runcubby deploy:
- Package: Your code is packaged into a tarball (respects
.gitignore) - Upload: Tarball is sent to the Cubby API
- Server Selection: API selects an app server with capacity
- Transfer: Tarball is sent to the app server via SSH
- Build: Docker image is built on the app server
- Database: If Prisma is detected, a Postgres container is provisioned
- Migrate:
prisma db pushruns automatically - Start: Container starts with secrets injected
- Route: Traefik config is updated to route traffic
Routing
Traefik handles all incoming traffic:SSL Certificates
- Wildcard certificates via Let’s Encrypt
- Cloudflare DNS challenge for validation
- Automatic renewal
URL Structure
Health Checks
Traefik monitors container health and only routes to healthy instances.Database Provisioning
When Cubby detects Prisma in your project:- A Postgres 17 container is created alongside your app
- A named Docker volume persists data across deploys
DATABASE_URLis automatically injected- Migrations run on each deploy via
prisma db push
Data Persistence
Data persists in Docker volumes even when you redeploy. The volume naming convention:Container Resources
Default resource allocation:| Resource | Default | Configurable |
|---|---|---|
| Memory | 512 MB | Yes (cubby.yaml) |
| CPU | 0.5 cores | Yes (cubby.yaml) |
| Storage | Unlimited | Shared volume |
Security
Network Isolation
- Each app container has its own network namespace
- Apps cannot communicate with each other directly
- Only Traefik can route traffic to containers
Secret Management
- Secrets are encrypted at rest
- Injected at container startup
- Never exposed in logs or API responses
Authentication
- ForwardAuth middleware validates all requests
- User identity passed via headers (
X-Cubby-User-Id) - Headers are stripped and re-added by the control plane (prevents spoofing)
Monitoring
The control plane collects:- Container CPU and memory usage (cAdvisor)
- Request counts and latencies (Traefik)
- Container health status