Skip to content

Environments

Environments let you run multiple versions of your entire stack side by side. Each environment gets its own services, databases, networking, and environment variables — fully isolated from other environments in the same project.

Creating an environment

  1. Open your project in the dashboard
  2. Click Environments in the sidebar
  3. Click Create Environment
  4. Give it a name (e.g. “Staging”, “Development”, “QA”)
  5. Optionally link it to a Git branch

When you create an environment, Stackpad clones all services from the default (production) environment — including databases, caches, and background services. Each cloned service gets its own container and storage on a separate Docker network.

Branch linking

Each environment can be linked to a Git branch:

  • Production environment → main branch
  • Staging environment → develop branch
  • QA environment → release/* branch

When you push to a linked branch, Stackpad automatically deploys to the matching environment. If a push doesn’t match any environment’s branch, it falls through to the catch-all environment (if one exists), which triggers a preview deployment.

Environment variable cascading

Environment variables resolve in three layers, where each layer can override the previous:

  1. Project-level — shared across all environments and services
  2. Environment-level — specific to one environment, overrides project-level
  3. Service-level — specific to one service in one environment, overrides everything

For example, you might set API_URL=https://api.example.com at the project level, then override it with API_URL=https://staging-api.example.com in the staging environment.

Variables set at a higher level are inherited by all lower levels unless explicitly overridden.

Networking

Each environment gets its own Docker network with a dedicated subnet. Services within an environment can reach each other by hostname (e.g. postgres:5432), but services in different environments are completely isolated — they cannot communicate.

Auto-injected credentials

When a database or cache is cloned into a new environment, Stackpad generates fresh credentials for the new instance. These are automatically injected into the environment’s web services as environment variables (e.g. DATABASE_URL), just like in the production environment.

Scale to zero

Environments that don’t need to run 24/7 (staging, QA, development) can be configured to scale to zero — automatically stopping when idle and waking up on the first request.

What’s next?