Skip to content
Docs
strackt.io Open app

Preview environments

Get a live, isolated deployment for every GitHub pull request, cleaned up automatically when the PR closes.

Preview environments

A preview environment is a live, throwaway copy of your application spun up for a single pull request. Open a PR and strackt deploys that branch to its own URL, so you can click through the change before it merges. Close the PR and the preview is cleaned up.

Turn previews on

Link a GitHub repository to your application, then open Environments on the application's page and choose Enable preview environments. Pick an existing source environment and enable previews. Production is suggested when available; you can choose staging or another environment on the same application instead.

Each new pull-request preview copies that source's settings, connected services, and environment variables. Review the secrets note below before enabling previews. Enabling creates no preview by itself and does not create previews for pull requests that were already open.

Choose Preview settings to change the source or cleanup settings. A source change affects future previews; existing previews keep their copied settings. Lowering the preview limit leaves existing previews in place. If a setting is refused, your saved settings stay unchanged. Choose an environment from the same application as the preview source. Resume configuration changes before editing previews on a frozen application.

What happens when you open a pull request

Once previews are on and your repository is connected through GitHub:

  1. You open a PR → strackt clones your selected source, deploys the pull-request branch, and gives the preview its own URL.
  2. You get a notification with the preview link, and the environment's page shows a banner with the PR number, the branch, and the URL.
  3. You push more commits → the preview redeploys with the latest code.
  4. You close or merge the PR → strackt removes the preview (depending on your cleanup settings below).

Settings

Setting What it does
Maximum concurrent previews Caps how many live previews one application can have at once. Past the cap, new PRs are held off and you're told the limit was reached.
Idle timeout Removes a preview that's had no activity for the number of days you set. Choose a positive number of days; turn off the idle auto-delete trigger to keep previews until another cleanup rule applies or you delete them.
Allow previews from forks Lets pull requests from forked repositories run on your infrastructure. Off by default, because a fork PR runs code from outside your workspace.
Auto-delete Chooses whether previews are removed when a PR is merged, closed without merging, or goes idle. Leave it empty to keep previews until you delete them by hand.

A note on secrets

A preview copies the selected source's environment variables and connected services. Pull-request code can therefore access copied secrets. Use a source with variables and service access suitable for previews, and review them before sharing a preview URL. Enabling fork previews also allows code from outside your workspace to run with that access.

Turn previews off

The workspace owner can choose Disable previews and confirm. Previews turn off immediately and cleanup is requested in the background. The confirmation does not mean every preview has been deleted: locked or busy previews may remain. Check the environment list for anything still present.

Disabling is refused while the application is frozen. If a pull-request environment is marked as production, contact support before disabling previews. Automatic cleanup also preserves that application's pull-request previews until this is resolved.

What previews don't do yet

  • GitHub only. Previews are driven by GitHub pull requests. GitLab and Bitbucket aren't supported yet.
  • No database copy. A preview connects to the services selected on its source; it doesn't clone or seed a fresh database for each PR.
  • Fork approval is per application, not per PR. The "allow previews from forks" switch is all-or-nothing — there's no approve-this-one-PR control yet.

If a preview doesn't appear after you open a PR, check that previews are enabled for the application and that your repository is connected through GitHub.

Manage previews through the API

Use GET /v1/applications/{application}/preview-policy to read the current policy, including saved settings while previews are off. You need applications:read and access to the whole application.

After linking a GitHub repository, enable previews with:

PATCH /v1/applications/{application}/preview-policy Content-Type: application/json {"enabled":true}

The source defaults to the application's production environment. To choose another source, supply its source_environment_id. A preview copies that source's configuration and secrets, so choose access suitable for pull-request code. Fork previews remain off unless you explicitly set allow_fork_previews:true.

You can also send max_concurrent, idle_timeout_days, auto_delete_triggers or allow_fork_previews. Omitted settings stay unchanged; an empty trigger list turns off automatic cleanup. Numeric values must be positive. enabled:false is refused: use the separate disable action. Enabling does not create previews for already-open pull requests. Opening or updating a GitHub pull request starts the usual preview workflow.

Policy writes need applications:write and access to every environment in the application. For scoped tokens, select the workspace or application and include production when the application has a production environment. Environment-only and server-only tokens cannot manage the policy. Selecting a source does not expand a token's access.

Find previews with the existing environment list or environment details. Each environment response includes is_preview, pr_number and preview_url. The URL is null until an enabled domain is reachable with HTTPS; ordinary environments always have a null preview URL.

The workspace owner can send POST /v1/applications/{application}/preview-policy/disable with an empty body. The response returns the policy with enabled:false and meta.cleanup_requested:true. Cleanup has been requested; check the environment list for remaining previews. There is no cleanup completion handle or dry-run mode. Frozen applications or a production-marked pull-request environment prevent disabling; resolve the refusal before retrying.

Was this helpful?