Stacks
A stack is the top-level organizational unit in sh0. It groups related applications and services together, providing shared configuration and a unified view of your project.
What is a Stack?
A stack represents a project or product that consists of one or more applications and services. For example, a typical web application stack might include:
- A frontend app (React, Vue, Svelte)
- A backend API (Node.js, Python, Go)
- A PostgreSQL database
- A Redis cache
- A background worker
All of these live within one stack, share environment variables, and can communicate over a private Docker network. When you open a stack in the dashboard, you see all its components at a glance.
Stacks vs Apps vs Services
Understanding the hierarchy is important:
| Concept | Description | Example |
|---|---|---|
| Stack | A project or product grouping | "E-commerce Platform" |
| App | A deployable unit within a stack | "api", "frontend", "worker" |
| Service | A running container instance of an app | "api-v3-abc123" (container) |
A stack contains one or more apps. Each app runs as one or more services (containers). When you deploy an app, sh0 creates a new service (container) and optionally removes the old one after the health check passes.
http://api:3000 without any extra configuration.Creating a Stack
There are two ways to create a stack:
From the Dashboard:
- Click New Stack in the top-right corner or from the stacks page.
- Enter a name (lowercase, alphanumeric, and hyphens only).
- Add an optional description.
- Click Create Stack.
From the API:
curl -X POST http://localhost:9000/api/projects \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "my-stack", "description": "Production web app"}'Stack Detail View
Clicking on a stack opens the detail view, which provides a complete picture of your project:
- Apps tab -- All applications in this stack with their status, resource usage, and quick actions (deploy, restart, stop).
- Environment tab -- Stack-level environment variables shared across all apps.
- Domains tab -- All domains assigned to apps in this stack.
- Backups tab -- Backup schedules and history for databases in this stack.
- Settings tab -- Stack name, description, danger zone (delete stack).
Stack Environment Variables
Stack-level environment variables are inherited by all apps in the stack. This is useful for shared configuration like API keys, database URLs, or feature flags that apply to the entire project.
DATABASE_URL=postgres://user:pass@db:5432/myapp
REDIS_URL=redis://cache:6379
APP_ENV=production
STRIPE_API_KEY=sk_live_...APP_ENV=production and an app defines APP_ENV=staging, the app uses staging. This lets you share defaults while allowing per-app overrides.Stack Settings
The Settings tab lets you modify the stack's metadata and perform administrative actions:
- Name and Description -- Update the stack's display name and description.
- Docker Network -- View the internal Docker network name for this stack.
- Danger Zone -- Delete the stack and all its apps, services, and data. This action is irreversible.
Common Patterns
Here are some common ways to organize stacks:
Per-Project
One stack per project with all its services.
saas-app (frontend + api + db + redis)Per-Environment
Separate stacks for staging and production.
myapp-staging / myapp-productionPer-Client
Agencies can organize by client.
client-acme / client-globexShared Services
Common infrastructure in its own stack.
infrastructure (traefik + monitoring + logging)Managing Stacks via API
All stack operations are available through the REST API. Here are the key endpoints:
# List all stacks
curl http://localhost:9000/api/projects \
-H "Authorization: Bearer YOUR_TOKEN"
# Get a specific stack
curl http://localhost:9000/api/projects/STACK_ID \
-H "Authorization: Bearer YOUR_TOKEN"
# Update a stack
curl -X PUT http://localhost:9000/api/projects/STACK_ID \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "new-name", "description": "Updated description"}'
# Delete a stack
curl -X DELETE http://localhost:9000/api/projects/STACK_ID \
-H "Authorization: Bearer YOUR_TOKEN"