> ## 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.

# Preview environments

> Give every branch its own environment with Capsules

Capsules give each branch its own copy of your app, created and updated by GitHub Actions. Use them to review changes before they reach your main environment.

## Before you start

* A project Monk has planned, with a `MANIFEST`. See [Deploy an existing app](/guides/deploy-existing-app).
* The repository is on GitHub.
* GitHub credentials, and cloud credentials if each branch gets its own cluster. Monk asks for both through forms.

## Ask Monk

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

Choose where capsules run:

* **Own cluster per branch.** Each branch gets a fresh cluster in the cloud and region you pick.
* **Shared cluster.** Capsules run on a pool of nodes in an existing cluster.

```
/monk set up preview environments on the existing cluster
```

You can leave out branches:

```
/monk set up preview environments, but not for main or release branches
```

## What you review

Credential forms open in the [local dashboard](/getting-started/local-dashboard). Then the plan shows the workflow file, where capsules run, their machine sizes and the secrets it will add to GitHub. The plan decides which services each capsule creates and which it shares. Production data is not copied. Nothing is created or pushed until you approve.

## What you get

* `.github/workflows/dynenv.yml` in your repository, built on `monk-io/monk-actions`
* A scoped API key and the secrets the workflow needs, stored in a GitHub environment
* An environment per branch, each with a preview URL

```
/monk list the preview environments
```

Capsules also appear in the web dashboard under Projects, Previews.

## Control cost with a schedule

Each capsule costs money while it runs. Set a schedule so they are up only when people use them:

```
/monk run preview environments only on weekdays from 8 to 19 Berlin time
```

You can set a schedule for the whole project and change it for one capsule.

## Secrets for capsules

```
/monk update the secrets for the preview environments
```

Values go through the local dashboard, as for any secret.

## Next

* [CI/CD](/guides/cicd)
* [Costs](/guides/costs)
* [Environments and previews](/concepts/environments-and-previews)


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