# Environments and promote

> A staging environment, pull request previews, and shipping a tested release to production without rebuilding.

Source: https://livops.dev/en/docs/environments

Every project starts with a `production` environment. To test a new version before showing it to customers, add another environment — usually `staging`.

## Add an environment

On the project page, click **Add environment**. The new environment:

- gets copies of the services in production (with their own URLs);
- gets **its own empty database** for each database type in production — no data is copied, and staging never writes to the production database;
- copies variables; those that can't be copied (for example, ones pointing to another database) are shown as **not set** — fill them in.

## Promote: staging → production

Move a version tested in staging with the **Promote to production** button.

- The running release is placed on the production service **without rebuilding**: the exact tested files ship.
- **Production keeps its own variables.** Staging's `DATABASE_URL` doesn't carry over to production.
- **Exception — static sites.** Their variables (`VITE_*`, `NEXT_PUBLIC_*`) are baked into files at build time, so the site is rebuilt from the same commit with production variables.

Via the API:

```bash
curl -X POST https://livops.uz/api/projects/<staging-service-id>/promote \
  -H 'Authorization: Bearer lvp_xxx'
```

## Pull request previews

When **preview** is enabled in project settings, a separate environment opens for every pull request on GitHub and is deleted when the PR closes. A preview is billed like a regular service.

## Delete an environment

Deleting an environment also deletes its services and databases. This can only be done from the cabinet — not with an API token.
