# environments

> Environments by name.

Environments by name. If omitted, a single `production` environment deploys from the repository's default branch.

- **Type:** map of names to object
- **Since:** manifest v1

## Example

```yaml
environments:
  production:
    branch: main
    protection:
      require_approval: true
  staging:
    branch: develop
```

## Each entry

An environment. Each has its own private network, variables, secrets and databases.

## Fields

| Field | Type | What it does |
| --- | --- | --- |
| [`kind`](/docs/manifest/environments/kind/) | `production`, `staging`, `preview`, `development` | Defaults from the name (production, staging, preview), otherwise development. |
| [`branch`](/docs/manifest/environments/branch/) | string | Git branch that deploys to this environment on push. |
| [`pull_requests`](/docs/manifest/environments/pull-requests/) | boolean | Create a short-lived copy of this environment for every pull request. |
| [`ttl`](/docs/manifest/environments/ttl/) | [duration](/docs/manifest/#duration) | How long a preview environment lives after its last push. |
| [`spend_cap`](/docs/manifest/environments/spend-cap/) | [money](/docs/manifest/#money) | Monthly cap for this environment (for previews, per preview). |
| [`databases`](/docs/manifest/environments/databases/) | `new`, `branch`, `branch-masked` or map of names to `new`, `branch`, `branch-masked` | How databases are provided in this environment. |
| [`protection`](/docs/manifest/environments/protection/) | object | Guard rails for an environment. |
| [`sleep_when_idle`](/docs/manifest/environments/sleep-when-idle/) | boolean | Default sleep_when_idle for services in this environment. |
| [`variables`](/docs/manifest/environments/variables/) | [env](/docs/manifest/#env) | Shared variables for this environment, overriding top-level variables. |
| [`services`](/docs/manifest/environments/services/) | map of names to object | Per-service overrides for this environment (deep-merged over the base service). |
