# Preview deploys

> A separate address per pull request, with its own variables, to try a change before production.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://run.docs.sypnia.com/deploys/previews/

For agents: Run previews: deploy per pull request at https://<app>--pr-<n>.sypnia.app (plus per-deploy <app>--dpl-<id>), optional wildcard on own domain; preview environment variables separate from production; protection none | sypnia (org members, default in Cloud) | password, enforced at the edge with bypass header for machines; updated per push, removed on close/merge.

A preview is a deploy of a pull request's branch, released to an environment of its own. People open it, test it, and the pull request shows its status.

## Addresses

- Sypnia Cloud: `https://<app>--pr-<number>.sypnia.app`, stable for the life of the pull request.
- Each deploy also keeps its own `https://<app>--dpl-<id>.sypnia.app`.
- On your own domain, a wildcard such as `*.preview.laespiga.co` can serve previews as `pr-<number>.preview.laespiga.co`.

## Variables and secrets

Previews read the `preview` environment's variables, never production's, unless a variable is shared on purpose. Point previews at a test database: a [Sypnia Data](https://data.sypnia.com) branch or a separate project.

## Who can open a preview

| Setting                              | Effect                                                             |
| ------------------------------------ | ------------------------------------------------------------------ |
| `previews.protection = "none"`       | anyone with the address                                            |
| `"sypnia"` (default in Sypnia Cloud) | members of your organization signed in to Sypnia, once per browser |
| `"password"`                         | a shared password, stored as a secret                              |

Protection runs at the edge before your app sees the request; machine traffic can pass with a bypass header tied to a deploy token.

## Lifecycle

A preview is updated on every push to the branch and removed when the pull request is closed or merged. Its deploys follow the [retention](https://run.docs.sypnia.com/cloud/credits-and-limits) of the plan.
