Skip to content

PR Preview Environments

Each pull request can get its own environment — a copy of the canvas with its own URL. Review the real stack before you merge. No extra staging project to keep around.

The preview is torn down when the PR closes or merges. Databases in that environment are separate from production.

PR preview environment PR #142 pr-142.preview.stackblaze.app web postgres redis seeded from staging | destroyed when PR closes

Each pull request gets a full-stack preview URL, web, workers, and databases provisioned together.

PR #42, my-frontend
# Preview URL automatically posted as PR comment
https://pr-42--my-frontend.preview.stackblaze.cloud
# Isolated from production data and domains

StackBlaze posts an automated comment when the preview is ready, for example:

Your preview environment is ready!

  • my-frontend: pr-42--my-frontend.preview.stackblaze.cloud
  • my-api: pr-42--my-api.preview.stackblaze.cloud

Preview environments can spin up their own ephemeral databases. This means PRs can test schema migrations, seed data, and data mutations without touching the production database.

Ephemeral database (default)

A fresh empty database is provisioned for each PR. Your app’s migration command (if configured) runs automatically on deploy. Database is destroyed when the PR closes.

Seeded from snapshot

Configure a snapshot source in Settings → Preview Environments → Database Seed. StackBlaze restores the snapshot into the ephemeral database before the preview is made live. Useful for testing with realistic data.

  1. Enable PR previews per service

    Navigate to Service → Settings → Preview Environments and toggle “Enable PR preview environments” on. You can enable this on some services and not others, for example, enable on your frontend and API but skip standalone workers that have no external traffic.

  2. Open a pull request

    Open a pull request against the configured base branch (typically main). StackBlaze detects the PR via the GitHub webhook and begins provisioning a new isolated Kubernetes namespace named stackblaze-preview-{repo}-pr-{number}.

  3. Get the preview URL from the PR comment

    Within 2–3 minutes, StackBlaze posts an automated comment on the PR with the live preview URL: pr-{number}--{service}.preview.stackblaze.cloud. The URL is also available in the StackBlaze dashboard under the Previews tab.

  4. Configure preview-specific environment variables

    If your preview environments need different values for certain variables (e.g. a different Stripe key or feature flag), add them under Service → Settings → Preview Environments → Override Variables. Preview values take precedence over production values for that namespace only.

  5. Preview updates on new commits

    Every push to the PR branch triggers a rebuild of the preview environment. The preview URL stays the same; its content is updated in place. This makes it easy to iterate and share a stable link with reviewers throughout the review cycle.

  6. Automatic teardown on merge or close

    When the PR is merged or closed, StackBlaze deletes the preview namespace within 60 seconds. All pods, services, ingress rules, and ephemeral database volumes are removed. Nothing is left running or billed after teardown.