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

# Environment variables

> Every environment variable a self-hosted Compiler instance reads.

A self-hosted instance needs only a handful of environment variables. The AI provider (Anthropic API or AWS Bedrock), the GitHub App, file storage and Slack are configured in the app after first login, not through environment variables.

## Required

<ResponseField name="DATABASE_URL" type="string" required>
  PostgreSQL connection string, in the form `postgresql://user:password@host:port/database`. The database must be PostgreSQL 16 or later, and the user must be able to create tables and the `pg_trgm` extension.
</ResponseField>

<ResponseField name="TOKEN_ENCRYPTION_KEY" type="string" required>
  A 32-byte key as 64 hex characters, used to encrypt stored credentials. Generate one with:

  ```bash theme={null}
  openssl rand -hex 32
  ```

  <Warning>
    If this key is lost, every stored credential (GitHub App key, AI provider keys, connectors) has to be entered again.
  </Warning>
</ResponseField>

<ResponseField name="REDIS_URL" type="string" required>
  Redis 7 or later connection string, such as `redis://localhost:6379`. Use `rediss://` for TLS. The app refuses to start without it. Redis holds resumable stream state, so a client can reconnect to an in-progress response, and run leases.
</ResponseField>

## Recommended

<ResponseField name="PUBLIC_URL" type="string">
  The public address your instance is reached on, such as `https://compiler.yourdomain.com`. Needed for the MCP server, for [Slack](/configuration/slack), and for SSO/SAML behind a reverse proxy or custom domain.
</ResponseField>

## Optional

<ResponseField name="DATABASE_SSL" type="boolean" default="false">
  Set to `true` when your database requires SSL, as Amazon RDS and Heroku Postgres do. Compiler then appends `?sslmode=require` to the connection string.
</ResponseField>

<ResponseField name="REPOS_DIR" type="string" default="/repos">
  A writable directory where Compiler clones repositories. On hosts with ephemeral disks, such as [Heroku](/deployment/heroku), set it to `/tmp/repos`. Compiler re-clones missing repositories when needed.
</ResponseField>

<ResponseField name="PORT" type="number" default="3000">
  The port the app listens on. Without it, the app uses 3000 when that port is free and picks another when it isn't, so set it explicitly on platforms that route to a fixed container port.
</ResponseField>

<ResponseField name="MCP_ALLOW_PRIVATE_NETWORK" type="boolean" default="false">
  Set to `true` to let MCP connectors reach private and loopback addresses, for MCP servers on your intranet.
</ResponseField>

<ResponseField name="TRIAL_ENDS_AT" type="string">
  When a free trial ends, as a date or ISO timestamp (for example `2026-10-26`). Shows the days left above the message box. Leave unset for no trial.
</ResponseField>

## Docker Compose

The [Docker deployment](/deployment/docker) reads these from `.env` and passes the ones above to the app container.

| Variable | Description |
| - | - |
| `DOMAIN` | The domain Compiler is served on, without `https://` |
| `POSTGRES_PASSWORD` | Password for the bundled database |


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