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

# Deployment Configuration

> Configure build settings, environment variables, and deployment options for your Stormkit applications.

## Accessing Configuration

Configure your deployments by visiting:

**Your App** > **Environments** > **Config**

The configuration page is divided into several sections:

## General Settings

| Setting                  | Description                                                                                                                                                                  |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Environment name**     | The name of the environment. You can use any alphanumeric characters except the reserved name `production`. This setting is used to distinguish your environments in the UI. |
| **Branch**               | The default branch for this environment. Choose the long-lived branch that represents this environment (e.g., `main`, `staging`, `develop`).                                 |
| **Auto publish**         | When enabled, successful auto deployments triggered by commits to the default branch will be published automatically.                                                        |
| **Auto deploy**          | Configure automatic deployment triggers. See [Auto Deployments](/deployments/auto-deployments) for details.                                                                  |
| **Auto deploy branches** | When Auto deploy is set to "Custom branches", use this field to specify which branches to deploy automatically. Supports regex and glob patterns.                            |
| **Preview links**        | When Auto deploy is enabled, Stormkit leaves deployment links on pull/merge requests. Disable this to prevent preview link comments.                                         |

## Build Settings

| Setting           | Description                                                                                                                                        |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Build command** | Command(s) to build your application. Chain multiple commands with `&&`. Defaults to `npm run build` if a `build` script exists in `package.json`. |
| **Output folder** | The folder containing build output to deploy. See [How We Deploy](/deployments/how-we-deploy) for folder structure details.                        |
| **Build root**    | Working directory relative to repository root. Defaults to the top-level directory. Build command and output folder are relative to this path.     |

### Build Command Examples

<CodeGroup>
  ```bash Default (npm) theme={null}
  npm run build
  ```

  ```bash Custom Script theme={null}
  npm run generate && npm run export
  ```

  ```bash Yarn theme={null}
  yarn build
  ```

  ```bash pnpm theme={null}
  pnpm build
  ```

  ```bash Bun theme={null}
  bun run build
  ```
</CodeGroup>

## Serverless Settings

| Setting           | Description                                                                                                                                                                               |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **API Folder**    | Relative path to the `api` folder where serverless functions reside. This path is relative to repository root (not build root). Changing this affects the serving path for API functions. |
| **Start command** | Command to start your server application (self-hosted only). Used for long-running processes like Go HTTP servers.                                                                        |

<Note>
  Serverless settings only apply to API functions. Learn more about [Writing API](/features/writing-api).
</Note>

## Headers Configuration

| Setting                   | Description                                                                                                                                      |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Headers file location** | Path to the custom headers file. Default location is `_headers`. Path is relative to build root. See [Custom Headers](/features/custom-headers). |

## Redirects Configuration

| Setting                     | Description                                                                                                                                                      |
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Redirects file location** | Path to the custom redirects file. Default location is `redirects.json`. Path is relative to build root. See [Redirects](/features/redirects-and-path-rewrites). |
| **Overwrite redirects**     | When enabled, you can specify redirect rules that apply to all deployments instantly without redeploying.                                                        |

## Environment Variables

Environment variables are injected during build time and are also available at runtime for serverless functions.

### Adding Variables

<Steps>
  <Step title="Navigate to Config">
    Go to **Your App** > **Environments** > **Config**
  </Step>

  <Step title="Scroll to Environment Variables">
    Find the Environment Variables section
  </Step>

  <Step title="Add Variable">
    Click **Add Variable** and enter key-value pairs
  </Step>
</Steps>

### Variable Obfuscation

Variables matching this pattern are automatically obfuscated in logs:

```regex theme={null}
/secret|_key|password/i
```

Examples of obfuscated variables:

* `DATABASE_PASSWORD`
* `API_SECRET`
* `STRIPE_SECRET_KEY`
* `JWT_SIGNING_KEY`

### System Variables

Stormkit automatically injects several system variables. See [System Variables](/deployments/system-variables) for the complete list.

### Variable Precedence

When deploying manually via UI, you can override environment configuration variables for a single deployment. The precedence is:

1. Manual deployment overrides (highest)
2. Environment configuration variables
3. System variables (lowest)

## API Keys

Generate API keys to interact with the Stormkit API and programmatically modify environments.

<Steps>
  <Step title="Navigate to Config">
    Go to **Your App** > **Environments** > **Config**
  </Step>

  <Step title="Find API Keys Section">
    Scroll to the API Keys section
  </Step>

  <Step title="Generate Key">
    Click **Generate API Key** and store it securely
  </Step>
</Steps>

<Warning>
  API keys grant full access to the environment. Store them securely and never commit them to version control.
</Warning>

## Monorepo Configuration

For monorepo setups, use the **Build root** setting to specify the package directory:

```bash theme={null}
# Repository structure
my-monorepo/
├── packages/
│   ├── web-app/        # React app
│   └── api/            # Node.js API
├── package.json
└── pnpm-workspace.yaml
```

Configuration for `web-app`:

* **Build root**: `packages/web-app`
* **Build command**: `pnpm build`
* **Output folder**: `dist`

## Advanced Configuration

### Custom Package Manager

Stormkit auto-detects package managers based on lock files:

* `package-lock.json` → npm
* `yarn.lock` → yarn
* `pnpm-lock.yaml` → pnpm
* `bun.lockb` → bun

To use a custom install command:

* **Install command**: `make install` or any custom script

### Runtime Version

Specify runtime versions using `.node-version`, `.go-version`, or `mise.toml`:

<CodeGroup>
  ```bash .node-version theme={null}
  20.11.0
  ```

  ```toml mise.toml theme={null}
  [tools]
  node = "20.11.0"
  go = "1.22.5"
  ```
</CodeGroup>

See [Application Runtime](/deployments/application-runtime) for more details.
