> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Environments and previews

> Run staging and production side by side, and give every branch its own preview environment

Reviewing a change is easier when you can open it running. Keeping staging and production apart matters just as much. Monk gives you named environments to keep stages apart, and preview environments, called capsules, to review changes. Each branch gets its own copy of the app, created and removed by GitHub Actions.

## What you can do

### Deploy to named environments

A project can have environments such as `dev`, `staging` and `production`. Each is linked to a cluster, and several can share one. The environment decides which cluster receives the deploy. Secrets can be scoped to a project or an environment, so staging and production get different values.

**How:** Ask Monk. You approve the deploy in the local dashboard. See [Environments and previews](/concepts/environments-and-previews).

### Get a preview environment per branch

Monk writes a GitHub Actions workflow that deploys each branch you push and removes the environment when its pull request closes. Each capsule can run on its own new cluster, or on a pool of nodes in a cluster you already have. The plan you review decides what each capsule creates and what it shares.

**How:** Ask Monk. You approve the plan in the local dashboard. The repository must be on GitHub. See [Preview environments](/guides/preview-environments).

### Control what previews cost

A schedule sets when previews are up, for example weekdays from 8 to 19 in your timezone. One schedule covers the project, and a single preview can override it.

**How:** Ask Monk. You approve schedule changes in the local dashboard. See [Preview environments](/guides/preview-environments).

### Give previews their own secrets

Update the secrets that previews use. Values go through the local dashboard like any other secret.

**How:** Ask Monk, with the values entered in the local dashboard. See [Preview environments](/guides/preview-environments).

### See every preview in one place

Previews are listed under a project's Previews tab, with the branch, pull request, schedule and last deploy. You can also ask Monk to list them.

**How:** In the web dashboard, or ask Monk. See [Preview environments](/guides/preview-environments).

## Try it

```
/monk set up preview environments for each branch
```

## Good to know

* Previews need the repository on GitHub, and a project with a `MANIFEST`.
* Production data is not copied into previews. A new environment starts empty.
* A preview costs money while it runs. A cluster per branch costs more than a shared pool.
* `main`, `master` and the branch you set up from are excluded by default.

<CardGroup cols={2}>
  <Card title="Preview environments" icon="code-pull-request" href="/guides/preview-environments">
    Set up capsules step by step
  </Card>

  <Card title="Environments and previews" icon="layer-group" href="/concepts/environments-and-previews">
    Projects, environments, modes and schedules
  </Card>

  <Card title="CI/CD" icon="arrows-spin" href="/guides/cicd">
    Deploy to one fixed cluster on every push
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.