A preview is a temporary environment for testing a change, usually one per branch or pull request. It starts with a copy of another environment’s definitions (tables, rules, flows, templates…), has its own empty data, comes with its own keys, and removes itself when it expires.

Why use previews

  • Test a change with real tables and rules without touching staging.
  • Give a reviewer a working backend for a pull request’s preview deployment.
  • Run automated tests against a clean environment every time.
  • Try a risky migration somewhere disposable first.

Create one in Studio

  1. Project → Environments → New preview.
  2. Choose the environment to copy from (usually development or staging).
  3. Give the ref: lowercase letters, digits and dashes, up to 48 characters, typically the branch name (add-referrals). The preview is called pr-<ref> unless you give it a name.
  4. Choose how long it lives: 72 hours by default, from 1 hour to 30 days.
  5. Create. Studio shows its publishable and secret keys. Copy them now.

What a preview contains

Its two keys, a publishable key and a secret key, expire when the preview does.
Copied webhooks and schedules are live in the preview. If a webhook points at a real partner, or a schedule sends email, disable them in the preview or point them at test targets. Pause mail delivery in previews.

Create one from CI

The usual setup: when a pull request opens, CI creates a preview, seeds it, deploys the frontend preview against it, runs tests, and the preview expires on its own.
The request takes: The source environment is the one in the address (/envs/staging/previews), and the key used must be allowed to manage it. A preview with the same name already existing is refused with 409, so use a stable ref per pull request and delete or reuse it. If your plan’s environment limit is reached, creating a preview is refused. Infrastructure as code can then deploy the branch’s own definitions to the preview, so it matches the branch rather than the source.

Seed it

A preview’s tables start empty. Seed what your tests need from CI, using the preview’s secret key:
Or keep a seed backup file with only data, and restore it into the preview.

Clean up

A preview expires by itself: when its time is up, it and everything in it are removed. To remove it sooner (for example when the pull request closes), delete it from Project → Environments, or:
Deleting removes its data, keys, secrets and users for good.

Good practice

  • Name previews after the branch, so it’s obvious which can go.
  • Use test keys for any provider a preview’s flows call. Never a live payment key.
  • Disable outbound webhooks in previews unless they point at test receivers.
  • Never put real customer data in a preview.
  • Keep the lifetime short and let CI recreate it.