Preview Deployments
Preview deployments give every pull request its own live URL, so your team can review changes before merging to production.
How it works
When you enable the catch-all environment for a project, Stackpad automatically creates a preview deployment for any branch that doesn’t match an existing environment.
For example, if your default environment is main:
- Push to
main→ deploys to production - Push to
feature/new-login→ creates a preview - Push to
fix/header-bug→ creates a separate preview - Merge the PR and delete the branch → preview is cleaned up automatically
Enabling preview deployments
- Go to Project Settings
- Toggle Automatic preview deploys (or go to Environments → Add Environment and enable Build feature branches)
- That’s it — push to any branch and Stackpad creates a preview
You can only have one catch-all environment per project.
What happens when a preview is created
When you push to a branch that doesn’t match any existing environment, Stackpad:
- Creates a new environment named after the branch
- Clones all services from your default (production) environment
- Creates separate containers for each cloned service — including databases and caches
- Sets up a new private network for the preview environment
- Builds and deploys the web services from the pushed branch
Each preview environment is a complete, isolated copy of your production stack.
Preview URLs
Preview deployments are accessible at:
https://your-project-branch-name.your-org.stackpad.euThe branch name is slugified:
- Lowercase
- Special characters (slashes, underscores) replaced with hyphens
- Leading and trailing hyphens removed
| Branch name | Preview URL |
|---|---|
feature/new-login | your-project-feature-new-login.your-org.stackpad.eu |
fix/header_bug | your-project-fix-header-bug.your-org.stackpad.eu |
v2 | your-project-v2.your-org.stackpad.eu |
Automatic cleanup
When a branch is deleted on GitHub (typically after merging a pull request), Stackpad receives a webhook and automatically:
- Stops all containers in the preview environment
- Removes the Caddy routes
- Cleans up the preview environment
No manual cleanup needed. If you delete the branch locally but not on GitHub, the preview stays running until the branch is deleted from GitHub.
Environment variables in previews
Preview environments inherit project-level environment variables. They do not inherit environment-level variables from production — those are scoped to the production environment only.
If your previews need different values (e.g. a separate third-party API key for testing), set them as environment-level variables on the preview environment after it’s created.
What’s next?
- Git push deploy — understand the full deployment pipeline
- Environment variables — how variable scoping works across environments
- Rollbacks — zero-downtime deploys and debugging failures