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

# Adding environments

> Create new environments and verify their configuration.

Niteshift automatically creates one environment for each of your GitHub repositories. You can create
additional environments for the same repository. Each environment can also include
[multiple repositories](https://docs.niteshift.dev/environment-configuration/multi-repo.md).

## Configuration directories

Each environment stores its configuration in a directory in one of your GitHub repositories.
By default, Niteshift uses `.niteshift/`. Additional environments use directories beneath it,
such as `.niteshift/api/` or `.niteshift/frontend/`, each with a `settings.yaml` file. All environments
use the same [configuration format](https://docs.niteshift.dev/environment-configuration/overview.md).

## Create a new environment

Start a task and ask the agent to create another environment. For example:

> Set up a new environment for the API in `.niteshift/api`.

The agent guides you through creating the environment, starts a task to help you test it, and opens
a pull request with its configuration.

## Delete an unmerged environment

In **Settings → Environments → \[environment]**, select **Delete Environment** and confirm. This
option is available only for additional environments whose configuration has not merged.

> [!WARNING]
>
> Deletion cannot be undone. It removes all of the environment's stored settings and secrets.

Deletion retains task history and does not remove the configuration files or branch from GitHub. If you
merge the configuration pull request after deleting the environment, Niteshift creates a fresh
environment without secrets.

## Referencing settings from an existing environment

You can reuse another environment's setup and resume scripts and service definitions by referencing
their files in `settings.yaml`. Paths are relative to the directory containing `settings.yaml`.
For example, `.niteshift/api/settings.yaml` can use the files in `.niteshift/`:

```yaml theme={"dark"}
version: 1
scripts:
  setup: ../setup
  resume: ../resume
serviceDefinitions:
  - ../services.yaml
  - ./services.yaml
```

When you list multiple files, Niteshift combines their services, tunnels, and generated environment
files in the order listed. In this example, `.niteshift/api/services.yaml` adds services alongside
those in `.niteshift/services.yaml`. Later files do not override earlier definitions: duplicate
service names or service preview ports cause a validation error.


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