Scale to Zero
Environments can automatically stop when idle and wake up on the first request. This is ideal for staging, preview, and development environments that don’t need to run 24/7 — saving resources without manual intervention.
Enabling scale to zero
- Open your project and go to the environment settings
- Toggle Scale to zero on
- Set the idle timeout (how long without traffic before the environment sleeps)
- Click Save
Idle timeout limits
| Plan | Minimum idle timeout |
|---|---|
| Starter | 15 minutes |
| Pro | 5 minutes |
| Business | 5 minutes |
| Enterprise | 5 minutes |
The default idle timeout is 15 minutes.
How it works
Idle detection
Stackpad checks ClickHouse access logs every 60 seconds. If no traffic has reached any externally-exposed service in the environment within the idle timeout window, the environment is put to sleep.
When sleeping:
- All service containers are stopped
- CPU and memory reservations are released
- Resources become available for other workloads
Wake-up flow
When the first request hits a sleeping service:
- Caddy serves a branded loading page (no 502 errors)
- Services start in the background — databases and caches first, then web apps (dependency ordering)
- The loading page auto-refreshes every 2 seconds
- Once the service is healthy, the page redirects to the actual application
For API clients (non-browser requests), Stackpad returns a JSON response:
{ "error": "Service is sleeping", "status": "waking", "retryAfter": 10}With a Retry-After: 10 header, so well-behaved HTTP clients retry automatically.
Per-service overrides
By default, all services in an environment follow the environment’s scale-to-zero setting. You can override this per service:
- Allow this service to sleep — toggle on/off per service
- Force always awake — keep a specific service running even when the environment sleeps
- Force always sleep — stop a service even when the environment is awake
Configure overrides in the service’s Settings tab.
Keep-awake timer
Temporarily prevent an environment or service from sleeping — useful during debugging sessions or active development:
- Quick options: 1 hour, 4 hours, 8 hours
- While active, the keep-awake timer overrides the idle timeout
- A badge shows the remaining time in the dashboard
- Click Clear to remove the timer early
Keep-awake limits
| Plan | Maximum keep-awake duration |
|---|---|
| Starter | 4 hours |
| Pro | 24 hours |
| Business | Unlimited |
| Enterprise | Unlimited |
Cron job awareness
Environments with active cron jobs are kept awake automatically — you don’t need to manually configure keep-awake timers for environments running scheduled tasks.
Service type restrictions
| Service type | Can sleep? |
|---|---|
| Web apps | Yes |
| Databases | Yes |
| Caches | Yes |
| Background services | Yes |
| GPU services | No |
| Object storage | No |
GPU and object storage services are not Docker containers and cannot be paused.
What’s next?
- Environments — create and manage environments
- Horizontal scaling — run multiple replicas for availability
- Cron jobs — schedule recurring tasks