Skip to main content
The default configuration in GrowthBook is optimized for trying things out quickly on a local dev machine. Beyond that, you can customize behavior with Environment Variables.

Domains and Ports

This is used to generate links to GrowthBook and enable CORS access to the API. If you want to run GrowthBook on a different host than localhost, you need to add the above environment variables to your docker-compose.yml file.
Unique ports on the same domainThe back-end and the front-end must run on unique ports if on the same domain.The front-end has its own set of /api routes so currently we do not support running both the API and the front-end on the same port on the same domain.
ImportantIn order for authentication cookies to work correctly, both the app and api domains must be considered the “same site”. They can be on different subdomains or ports, but the root domain must be the same.
  • Works: gb.example.com and gb-api.example.com
  • Breaks: gb.frontend.com and gb.backend.com
If you need to change the ports on your local dev environment (e.g. if 3000 is already being used), you need to update the above variables AND change the port mapping in docker-compose.yml:
If you for some reason have a PORT environment variable set, you need to set the BACKEND_PORT variable to 3100 to avoid port conflicts.

Production Settings

  • NODE_ENV - Set to “production” to turn on additional optimizations and API request logging
  • MONGODB_URI - The full MongoDB connection string. Alternatively you can specify the following environment variables from which we will compose the full connection string like so mongodb://${MONGODB_USERNAME}:${MONGODB_PASSWORD}@${MONGODB_HOSTNAME}:${MONGODB_PORT}/${MONGODB_DBNAME}${MONGODB_EXTRA_ARGS}:
    • MONGODB_USERNAME - Username for MongoDB
    • MONGODB_PASSWORD - Password for MongoDB
    • MONGODB_HOST - Host name of MongoDB excluding port, e.g. some.host.com
    • MONGODB_PORT - Port to use for MongoDB (defaults to 27017)
    • MONGODB_DBNAME - Database name of growthbook database (defaults to growthbook)
    • MONGODB_EXTRA_ARGS - Optional set of extra arguments for MongoDB connection string (defaults to ?authSource=admin)
  • JWT_SECRET - Auth signing key (use a long random string)
  • ENCRYPTION_KEY - Data source credential encryption key (use a long random string)
If you change the ENCRYPTION_KEY, you will need to migrate any existing data sources using the following script:
ImportantWhen using GrowthBook in production, it is important to change theNODE_ENV to “production” and change the JWT_SECRET to a random string. Using the production node environment and the default JWT_SECRET will throw an error.

Loading Secrets from Files

If you’d rather not pass sensitive values as plain environment variables, set SECRETS_DIR to a directory and GrowthBook will read every file in it at startup, exposing each as an environment variable named after the file. This works with Docker secrets and Kubernetes secret volume mounts, which both write one file per secret. A variable that is already set in the environment takes precedence over the file.

Email SMTP Settings

This is required in order to send experiment alerts, team member invites, and reset password emails.
  • EMAIL_ENABLED (“true” or “false”)
  • EMAIL_HOST
  • EMAIL_PORT
  • EMAIL_HOST_USER
  • EMAIL_HOST_PASSWORD
  • EMAIL_FROM

Google OAuth Settings

Only required if using Google Analytics as a data source
  • GOOGLE_OAUTH_CLIENT_ID
  • GOOGLE_OAUTH_CLIENT_SECRET

File Uploads

The UPLOAD_METHOD environment variable controls where to store uploaded files and screenshots. The supported values are local, s3, and google-cloud.

local

This is the default value. Uploads are stored in the GrowthBook docker container at /usr/local/src/app/packages/back-end/uploads. In production, you should mount a volume here to persist uploads across container restarts.

s3

Store uploads in an AWS S3 bucket.
  • S3_BUCKET
  • S3_REGION (defaults to us-east-1)
  • S3_DOMAIN (defaults to https://${S3_BUCKET}.s3.amazonaws.com/)
  • AWS_ACCESS_KEY_ID (not required when deployed to AWS with an instance role)
  • AWS_SECRET_ACCESS_KEY (not required when deployed to AWS with an instance role)
  • AWS_ASSUME_ROLE (optional role to assume, that has s3:PutObject and s3:GetObject to the bucket)
  • S3_ENDPOINT (optional endpoint for an S3-compatible store such as MinIO or Cloudflare R2, which GrowthBook reaches with path-style URLs. Set S3_DOMAIN to the store’s public URL too. Leave unset for AWS S3)

google-cloud

Store uploads in a Google Cloud Storage bucket.
  • GCS_BUCKET_NAME
  • GCS_DOMAIN (defaults to https://storage.googleapis.com/${GCS_BUCKET_NAME}/)
  • GOOGLE_APPLICATION_CREDENTIALS (not required when deployed to GCP with an instance service account)

AI Provider API Keys

GrowthBook supports multiple AI providers for features like generating experiment descriptions, checking hypothesis validity, and detecting similar experiments. You can configure one or more of the following API keys:
  • OPENAI_API_KEY - OpenAI API key for GPT models
  • ANTHROPIC_API_KEY - Anthropic API key for Claude models
  • XAI_API_KEY - xAI API key for Grok models
  • MISTRAL_API_KEY - Mistral AI API key
  • GOOGLE_AI_API_KEY - Google AI API key for Gemini models
You only need to set the API keys for the providers you want to use. Once configured, you can select your preferred model in the AI settings. See more on the AI Integrations page.

AI Assistant Skills

Skills tell the in-app AI Assistant how to carry out a task with the GrowthBook REST API. GrowthBook ships built-in skills for Feature Flags, experiments, analytics and the docs, and you can add your own or replace the built-ins.
  • AGENT_SKILLS_DIR - Path to a directory of custom skills. Each skill is a folder containing a SKILL.md file, with optional workflow files in a references/ subfolder and any other files the skill needs:
SKILL.md and each workflow file start with YAML frontmatter holding a name and a description. A skill’s name must be lowercase letters, digits, hyphens and underscores; one that isn’t is skipped with a warning in the server logs. The Assistant sees every skill’s description, then loads a skill’s full instructions when a request matches it. Users can also pick a workflow from the / menu in the chat composer. Other files in a skill’s folder, such as examples/payload.json above, are loaded when SKILL.md or a workflow refers to them by that relative path. The Assistant can read scripts but can’t run them, so it carries out what a script does with REST API calls. A custom skill with the same name as a built-in replaces the built-in along with all of its files. GrowthBook checks AGENT_SKILLS_DIR for changes every 30 seconds, so edits to your skills take effect without a restart. Use real folders inside the directory: changes inside a symlinked skill folder are only picked up when the link itself changes. With Docker, mount the directory into the container:
To turn off a built-in or custom skill for an organization, see AI Assistant skills. Skills only guide the Assistant. It calls the REST API with the signed-in user’s permissions and asks for confirmation before any change. AGENT_SKILLS_DIR has no effect on GrowthBook Cloud.

Outbound Request Proxy

  • WEBHOOK_PROXY - URL of an HTTP proxy, such as http://smokescreen.internal:4750, for outbound requests to URLs that users configure in GrowthBook. Unset by default, so these requests connect directly.
Requests that go through the proxy include:
  • Event webhooks, including the test requests sent while setting one up
  • SDK webhooks
  • Slack notifications
  • Update notifications and health checks to a GrowthBook Proxy
  • fetch calls made by Custom Hooks
  • SSO requests to your identity provider, except those to the standard Auth0, Okta, Microsoft Entra ID and Google domains
Users choose these URLs. Event webhooks are limited to Admins by default, but Engineers and Experimenters can set SDK webhook URLs and the GrowthBook Proxy host. Without a proxy, GrowthBook sends requests to any host it can reach, including internal services and cloud metadata endpoints. It also shows part of the response in the webhook’s details. SDK webhooks can send GET and PUT requests with custom headers, so the response can contain data from internal services. If those users shouldn’t be able to reach your internal network, for example in a multi-org installation, set WEBHOOK_PROXY to a proxy that blocks private and link-local addresses. Smokescreen does this by default.
A proxy that blocks private addresses also blocks internal destinations you rely on, such as a GrowthBook Proxy, an SDK webhook endpoint, or an identity provider on your network. Allow those hosts in the proxy’s configuration.

Enterprise Settings

Some features in self-hosted GrowthBook are only available with a commercial license key. You can get a trial Enterprise key from your self-hosted version of GrowthBook, or reach out to sales@growthbook.io to learn more.

License Keys

If you have a license key, you can activate it in GrowthBook two different ways:
  1. Navigate to Settings → General and look for the License section of the page. There you can input or edit your license key string. (Recommended)
  2. Alternately, set the environment variable LICENSE_KEY to your license key string. If using Docker, go to docker-compose.yml and add the variable to the growthbook → environment section.
License verificationIf you are running your application behind a firewall you will need to allow outbound traffic to both 75.2.109.47 and 99.83.189.109 to be able to have your license verified — the license server is served from two anycast addresses and traffic can use either. See IP addresses. If this is an issue, contact sales@growthbook.io for an air-gapped license.
The GrowthBook app will check with the license server daily to get the latest license information. When doing so, it will send the following data to our license server:
  • A hash of each user’s email - this is used to deduplicate users across multiple installations (dev, prod, etc.) in order to figure out how many seats are being used.
  • The git sha and date of the installation - this is used to determine when GrowthBook can delete deprecated features, determine who to send upgrade notices to, provides helpful information for debugging, etc.
  • A list of which data source types are being used, a list of which event trackers are being used, and a list of SDK languages being used - these help GrowthBook know how much usage the various data sources, event trackers, and sdk languages are getting so we can prioritize work.
If you recently upgraded your license and do not want to wait a day to get the new license information you can go to Settings → General and look for the License section of the page and click the Refresh button. If you have a multi-org installation and are a super admin you must instead navigate to the Settings → Admin page, find the license section and click the refresh button there.

Enterprise SSO

To enable SSO on your self-hosted GrowthBook instance, you will need an active license key (see above section), and then you may add the SSO settings for your provider. You can find the instructions on how to set up SSO for GrowthBook with most common providers on our SSO instructions page. The JSON object with the settings will need to be JSON encoded and then set to the environment variable SSO_CONFIG.

Multi-org

If your company has two or more largely independent products (e.g. Google has Search and Google Docs), you can set up multiple organizations per product. The following env vars control multi-org settings:
  • IS_MULTI_ORG - This defaults to false. Set this to true if you want to enable multiple organizations.
  • ALLOW_SELF_ORG_CREATION - This defaults to false. Set this to true to allow any users to create new organizations.
  • SHOW_MULTI_ORG_SELF_SELECTOR - This defaults to true. It allows all users to see a list of all organizations they can join. Upon selecting an organization, users will either automatically join it (if using SSO and self-join is enabled for that organization) or require an admin’s approval.

Logging

  • LOG_LEVEL - The API server’s log level: fatal, error, warn, info (default), debug or trace.

Observability (OpenTelemetry)

The GrowthBook API is instrumented with OpenTelemetry to publish observability metrics, traces, and logs. To enable, you must set the environment variable TRACING_PROVIDER=opentelemetry. The standard OTEL_* Environment Variables are supported, such as OTEL_SERVICE_NAME and OTEL_EXPORTER_OTLP_ENDPOINT. Logs collection is supported but disabled by default. You can set the GROWTHBOOK_OTEL_ENABLE_LOGS_COLLECTION environment variable to enable it. Set OTEL_LOG_LEVEL to control the OpenTelemetry SDK’s own diagnostic logs: NONE, ERROR, WARN, INFO (default), DEBUG, VERBOSE or ALL.

OAuth Authorization Server (MCP)

Enable GrowthBook as an OAuth 2.1 Authorization Server so remote MCP clients (and future CLI login) can sign users in via the dashboard session instead of pasting an API key.
  • OAUTH_AS_ENABLED - Set to 1 or true to expose the Authorization Server endpoints. Default off.
  • OAUTH_ISSUER - Optional. Issuer identifier advertised to clients (RFC 8414). Defaults to API_HOST when unset. Must be a stable absolute URL.
  • OAUTH_ACCESS_TOKEN_TTL_SECONDS - Access token lifetime in seconds (default 3600).
  • OAUTH_REFRESH_TOKEN_TTL_SECONDS - Refresh token lifetime in seconds (default 2592000 / 30 days).
When running the official MCP Docker image against your API, set OAUTH_AS_ENABLED=1 on the API so clients can complete the OAuth consent flow.

REST API Rate Limits

Each API key gets its own per-minute count. Requests from users signed in to GrowthBook aren’t rate limited. Each API server keeps its own counts in memory, so with several API servers a key can reach its limit on each of them.
  • API_RATE_LIMIT_MAX - Requests per minute for each API key (default 60).
  • API_RATE_LIMIT_MAX_BY_KEY - Limits for specific API keys, higher or lower than API_RATE_LIMIT_MAX, as comma-separated keyId:limit pairs, such as key_abc123:600, key_def456:20. Find a key’s id in the Internal ID column under Settings → API Keys. A copied or replacement key has a new id and needs its own entry. OAuth access tokens get a new id each time they’re issued, so they always use API_RATE_LIMIT_MAX.
  • API_RATE_LIMIT_SEPARATE_WRITES - Set to true to count each key’s writes (POST, PUT, PATCH and DELETE requests) apart from its reads, at the same limit, so reads can’t use up its writes. A key can then make up to twice its limit in total. A few read-only POST endpoints, such as searches and SQL queries, count as writes.
  • API_RATE_LIMIT_SEPARATE_REQUESTERS - Set to true to give each member named in a key’s X-GrowthBook-Requested-By header their own count, at that key’s limits. Requests that name nobody keep the key’s count. The header doesn’t prove who sent a request, so anyone holding the key can name different members to get more requests.
For example, in your docker-compose.yml:
Here every key can make 120 requests a minute, except key_abc123 (600) and key_def456 (20). Each key’s writes get a count of their own at the same limit, and so does each member a key names in X-GrowthBook-Requested-By. Invalid keyId:limit entries are skipped, with a warning in the API server’s log at startup. Entries for keys that don’t exist have no effect.

Other Settings

  • EXPERIMENT_REFRESH_FREQUENCY - Default update schedule for experiment results. Update when stale for X hours (default 6).
  • QUERY_CACHE_TTL_MINS - How long (in minutes) to cache and re-use SQL query results (default 60)
  • DEFAULT_CONVERSION_WINDOW_HOURS - How many hours after being put into an experiment does a user have to convert. Can be overridden on a per-metric basis. (default 72)
  • DISABLE_TELEMETRY - We collect usage telemetry to help us improve GrowthBook. This includes a hashed org/user identifier, IP address, and user agent. Set to “true” to disable.
  • STORE_SEGMENTS_IN_MONGO - If using the config.yml file, set to true if you want to store segments in Mongo. This is also useful if you have existing segments stored in Mongo that you need to access. When set, GrowthBook will ignore segments in the config.yml file and only use Segments stored in Mongo.
  • CDN_HOST - When set, this will update the implementation instructions within GrowthBook to override the API_HOST in cases where a CDN is used.
  • EXPRESS_TRUST_PROXY_OPTS - Express’ trust proxy setting value. Supports boolean (true/false), string values, and integer values for trusting the nth hop from the front-facing proxy server as the client. Leave empty or specify false to use Express’ default behavior. If you are running GrowthBook behind a proxy or load balancer, this is required to track the correct user IP for audit log events.
  • SDK_PAYLOAD_CACHE - Where SDK Connection payloads are kept between feature changes. mongo (default) caches each payload in MongoDB and rebuilds it when features change. none builds the payload on every request instead, which costs more per request but removes the payload size limit set by MongoDB’s maximum document size.
  • API_ALLOW_SKIP_PAGINATION - Set to true to let REST requests pass skipPagination=true when listing a Saved Group’s revisions, returning every revision in one response. Off by default, so those requests are refused.
  • MAX_WEBHOOK_TIMEOUT_SECONDS - Upper bound (in seconds) for the per-webhook request timeout that users can configure on SDK webhooks and event webhooks (default 120). Webhooks without a configured timeout wait 30 seconds.
  • KEEP_ALIVE_TIMEOUT_MS - How long (in milliseconds) the API server holds an idle keep-alive connection open before closing it (default 3605000, just over an hour). This must be longer than the idle timeout of any load balancer or reverse proxy in front of GrowthBook. If it is shorter, the proxy can reuse a connection GrowthBook has already closed, and the request fails with a 502 that never reaches your application logs.
  • ROBOTS_TXT_PATH - Define an absolute path to a robots.txt file that will be served on the /robots.txt path of your backend domain. If this env var is not defined, the app will look for a robots.txt file in the parent folder of the built server.js (which should be the packages/back-end directory in the default configuration)
  • DISABLE_API_ROOT_PATH - We include a default path in the API server to expose certain settings. Set to “true” to withhold that information. The AI Visual Editor however relies on the information in this path, so disabling it will prevent some of its features from working correctly.