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.
- APP_ORIGIN - default http://localhost:3000
- API_HOST - default http://localhost:3100
If you want to run GrowthBook on a different host than localhost, you need to add the above environment
variables to your
- APP_ORIGIN=http://<my ip>:3000
- API_HOST=http://<my ip>:3100
In 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.
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
- "4000:3000" # example: use 4000 instead of 3000 for the app
- "4100:3100" # example: use 4100 instead of 3100 for the api
- APP_ORIGIN=http://<my ip or url>:4000
- API_HOST=http://<my ip or url>:4100
- NODE_ENV - Set to "production" to turn on additional optimizations and API request logging
- MONGODB_URI - The MongoDB connection string
- 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:
# If you didn't have an ENCRYPTION_KEY before, leave OLD_KEY blank below
docker-compose run growthbook yarn migrate-encryption-key OLD_KEY
When using GrowthBook in production, it is important to change the
NODE_ENVto to "production" and change the
JWT_SECRETto a random string. Using the
productionnode environment and the default
JWT_SECRETwill throw an error.
Email SMTP Settings
This is required in order to send experiment alerts, team member invites, and reset password emails.
- EMAIL_ENABLED ("true" or "false")
Google OAuth Settings
Only required if using Google Analytics as a data source
The UPLOAD_METHOD environment variable controls where to store uploaded files
and screenshots. The supported values are
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.
Store uploads in an AWS S3 bucket.
- S3_REGION (defaults to
- S3_DOMAIN (defaults to
- 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)
Store uploads in a Google Cloud Storage bucket.
- GCS_DOMAIN (defaults to
- GOOGLE_APPLICATION_CREDENTIALS (not required when deployed to GCP with an instance service account)
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 firstname.lastname@example.org to learn more.
If you have a license key, you can activate it in GrowthBook two different ways:
- Navigate to Settings > General and look for the License section of the page. There you can input or edit your license key string. (Recommended)
- Alternately, set the environment variable
LICENSE_KEYto your license key string. If using Docker, go to docker-compose.yml and add the variable to the growthbook > environment section.
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. If your provider is not listed below, you can use the generic Open ID Connect below. The JSON
object with the settings will need to be JSON encoded and then set to the environment variable
Generic Open ID Connect
- LICENSE_KEY - Your signed license key provided by the GrowthBook team
- SSO_CONFIG - A JSON-encoded string that configures SSO (using OpenID Connect). It should be an object with the following keys:
emailDomain(string, optional) - Allow auto-joining from a specified email domain
id_token_signing_alg_values_supported(array of strings)
code_challenge_methods_supported(array of strings)
extraQueryParams(object, optional) - Dictionary of extra query params to be passed along with the
additionalScope(string, optional) - Additional scopes to include, along with the default value:
openid profile email
For SSO, make sure the following callback URL is whitelisted:
For the best SSO user experience, enable offline access and refresh tokens in your Identity Provder.
With all the SSO providers listed below, replace the all caps values with values from the provider, JSON encode the object, and set to the
SSO_CONFIG environment variable for GrowthBook.
When setting up Auth0, please ensure that you've enabled offline access, and check the
OIDC Compliant checkbox.
In Azure, register an Application, instead of Enterprise, as we use OpenID Connect, not SAML.
See complete Azure instructions
- Register an Application (we use OpenID Connect, so choose regular app, not Enterprise)
- Enter the redirect URL as APP_HOST/oauth/callback
- Take note of your Application Id (CLIENT_ID) and Directory Id (TENANT_ID). You will need it later
- Generate a new Client Secret
- Take note of the Secret Value (CLIENT_SECRET). You will need it in the next step
- Construct the JSON configuration for GrowthBook. Replace CLIENT_ID, CLIENT_SECRET, EMAIL_DOMAIN, and TENANT_ID, as into the JSON object above.
- Pass the JSON string into the environment variable SSO_CONFIG of your GrowthBook container
- EXPERIMENT_REFRESH_FREQUENCY - Default update schedule for experiment results. Update when stale for X hours (default
- QUERY_CACHE_TTL_MINS - How long (in minutes) to cache and re-use SQL query results (default
- 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
- DISABLE_TELEMETRY - We collect anonymous telemetry data to help us improve GrowthBook. Set to "true" to disable.