# Preview environments

> Get an isolated, throwaway deployment for every open pull request.

Source: https://gheima.ma/docs/previews

Preview environments give every pull request its own isolated, live deployment. Reviewers see the change running, not only the diff.

1. Pull request — Opened or updated on the connected repository.
2. Preview build — Gheima builds that commit on its own.
3. Own subdomain — The preview gets a URL of its own.
4. Comment on the PR — The URL is posted back to the pull request.

### Turn on auto-create

1. **Open Preview environments** — Go to Previews in the dashboard.
2. **Enable per service** — Under "Auto-create on pull requests", turn on the switch for each service that should get previews.

### How it works

When you open (or update) a pull request, Gheima builds a preview and comments the URL on the PR. The preview lives at its own subdomain, for example:

```
https://pr-42-myapp.gheima.ma
```

- Pushing more commits to the PR redeploys the same preview.
- A Postgres database can be branched automatically so the preview gets isolated data.
- Previews expire after 72 hours of inactivity and are torn down when the PR closes.

> Result: Each open PR has a shareable URL that always reflects its latest commit, with no manual setup per branch.

---

All docs: https://gheima.ma/docs.md
