Skip to content

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

  1. Go to Project Settings
  2. Toggle Automatic preview deploys (or go to Environments → Add Environment and enable Build feature branches)
  3. 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:

  1. Creates a new environment named after the branch
  2. Clones all services from your default (production) environment
  3. Creates separate containers for each cloned service — including databases and caches
  4. Sets up a new private network for the preview environment
  5. 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.eu

The branch name is slugified:

  • Lowercase
  • Special characters (slashes, underscores) replaced with hyphens
  • Leading and trailing hyphens removed
Branch namePreview URL
feature/new-loginyour-project-feature-new-login.your-org.stackpad.eu
fix/header_bugyour-project-fix-header-bug.your-org.stackpad.eu
v2your-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:

  1. Stops all containers in the preview environment
  2. Removes the Caddy routes
  3. 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?