> ## Documentation Index
> Fetch the complete documentation index at: https://forest-chore-open-api.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment Variables

> Configure your Forest back-end with required environment variables

Environment variables are used to configure your Forest back-end securely, keeping sensitive information separate from your codebase.

## Required variables

### FOREST\_ENV\_SECRET

Your unique environment secret provided by Forest.

<CodeGroup>
  ```bash Node.js theme={null}
  FOREST_ENV_SECRET=1234567890abcdef1234567890abcdef1234567890abcdef
  ```

  ```bash Ruby theme={null}
  FOREST_ENV_SECRET=1234567890abcdef1234567890abcdef1234567890abcdef
  ```
</CodeGroup>

**Purpose:**

* Authenticates your back-end with Forest
* Links your back-end to your Forest project
* Required for all architectures (Cloud, Self-Hosted, On-Premise)

**Where to find it:**

1. Go to [app.forestadmin.com](https://app.forestadmin.com)
2. Select your project
3. Go to Settings → Environments
4. Copy the environment secret

<Warning>
  Never commit `FOREST_ENV_SECRET` to version control. Always use environment variables or secret management tools.
</Warning>

### FOREST\_AUTH\_SECRET

Secret key used to sign authentication tokens (Self-Hosted and On-Premise only).

<CodeGroup>
  ```bash Node.js theme={null}
  FOREST_AUTH_SECRET=your-secure-random-string-at-least-32-characters-long
  ```

  ```bash Ruby theme={null}
  FOREST_AUTH_SECRET=your-secure-random-string-at-least-32-characters-long
  ```
</CodeGroup>

**Purpose:**

* Signs JWT tokens for user authentication
* Required for Self-Hosted and On-Premise architectures
* Not needed for Cloud architecture

**Generate a secure secret:**

```bash theme={null}
# Generate a random 32-character string
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

# Or use OpenSSL
openssl rand -hex 32
```

### NODE\_ENV (Node.js only)

Environment mode for Node.js applications.

```bash theme={null}
NODE_ENV=production  # Options: development, production, test
```

**Purpose:**

* `production`: Optimized performance, minimal logging
* `development`: Detailed logging, development mode
* `test`: Testing mode

<CodeGroup>
  ```javascript Node.js theme={null}
  const agent = createAgent({
    envSecret: process.env.FOREST_ENV_SECRET,
    authSecret: process.env.FOREST_AUTH_SECRET,
    isProduction: process.env.NODE_ENV === 'production'
  });
  ```

  ```ruby Ruby theme={null}
  # config/initializers/forest_admin_rails.rb
  ForestAdminRails.configure do |config|
    config.env_secret = ENV['FOREST_ENV_SECRET']
    config.auth_secret = ENV['FOREST_AUTH_SECRET']
  end
  ```
</CodeGroup>

<Warning>
  **Security reminder:** These environment variables contain sensitive secrets that authenticate your back-end with Forest. Never commit them to version control, share them publicly, or reuse them across different environments (development, staging, production). Always use separate secrets for each environment and store them securely using environment variables or secret management tools.
</Warning>
