---
title: "Deploy GrowthBook"
description: "Feature flags and A/B testing, pinned 5.2.1, MongoDB and uploads on volumes"
category: "Analytics"
url: https://railway.com/deploy/growthbook-1
---

# Deploy GrowthBook

Feature flags and A/B testing, pinned 5.2.1, MongoDB and uploads on volumes

**[Deploy GrowthBook on Railway](https://railway.com/template/growthbook-1)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/growthbook-1/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** Analytics

## Template content

### MongoDB https://devicons.railway.com/i/mongodb.svg

- **Image:** mongo:7.0.48@sha256:884c055bff8b7144ca44830d01826facd3083b33c4dea44b94a1476c62de3c32
- **Start command:** `docker-entrypoint.sh mongod --ipv6 --bind_ip ::,0.0.0.0 --setParameter diagnosticDataCollectionEnabled=false`

### GrowthBook https://raw.githubusercontent.com/growthbook/growthbook/v5.2.1/docs/static/images/white-growthbook-icon-purple-bg-256.png

- **Source:** https://github.com/aalfath/growthbook-railway-template
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# Deploy and Host GrowthBook on Railway

GrowthBook is an open-source platform for feature flags, A/B testing and product analytics. You roll out features gradually, run experiments, and analyse the results with its statistics engine against your own data warehouse or event data. SDKs exist for JavaScript, React, Python, Go, PHP, Ruby, Java, mobile and more.

## About Hosting GrowthBook

This template deploys GrowthBook 5.2.1 from the official image, pinned by version and digest, plus MongoDB 7.0 for its data. Both keep their state on Railway volumes: MongoDB at `/data/db` and uploaded images at the GrowthBook uploads folder. GrowthBook normally needs two public addresses, one for the web app and one for the API, and its login cookies break when they are on two `*.up.railway.app` domains. Here a small proxy serves both on one domain, with the API under `/backend`, so nothing has to be pasted after deploy. Secrets are generated at deploy, and a health check at `/healthz` waits for both parts.

## Common Use Cases

* Turn features on and off, or roll them out to a percentage of users, without redeploying your app
* Run A/B tests and multi-armed bandits, and analyse them with Bayesian or frequentist statistics
* Keep feature flag and experiment data on your own infrastructure instead of a SaaS

## Dependencies for GrowthBook Hosting

* MongoDB 7.0 (included, with a volume)
* A Railway volume for uploaded images (included)

### Deployment Dependencies

* GrowthBook self-hosting docs: https://docs.growthbook.io/self-host
* Environment variables: https://docs.growthbook.io/self-host/env
* Release notes: https://github.com/growthbook/growthbook/releases/tag/v5.2.1
* Template source: https://github.com/aalfath/growthbook-railway-template

### Implementation Details

**After deploy:** open the public URL and register straight away. The first account becomes the admin, and there is no default login. In your SDKs, use `https://YOUR-DOMAIN/backend` as the API host; GrowthBook's SDK setup pages show it for you.

**Variables:** none to fill in. `JWT_SECRET`, `ENCRYPTION_KEY` and the MongoDB password are generated, and `APP_ORIGIN` comes from the Railway domain. If you add a custom domain, set `APP_ORIGIN` to it. Never change `ENCRYPTION_KEY` once you have added a data source.

**Optional features:** add them as variables on the GrowthBook service. Email for invites and password resets uses `EMAIL_ENABLED=true`, `EMAIL_HOST`, `EMAIL_PORT`, `EMAIL_HOST_USER`, `EMAIL_HOST_PASSWORD` and `EMAIL_FROM`. `DISABLE_TELEMETRY=true` turns off usage telemetry. AI features take `OPENAI_API_KEY` or `ANTHROPIC_API_KEY`.

**Updates:** the GrowthBook service builds from the template's GitHub repo. When we bump the pinned version, Railway shows you an update notice, and the repo's CHANGELOG.md lists what changed. GrowthBook migrates its data itself on start. Upstream recommends about 2 GB of RAM.

## Why Deploy GrowthBook on Railway?


Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying GrowthBook on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.



## Similar templates

- [Plausible WordPress](https://railway.com/deploy/deploy-plausible-for-wordpress-sites) — Cookie-free WordPress stats from your own Plausible
- [Typesense Multilingual](https://railway.com/deploy/deploy-typesense-multilingual-search) — Locale-aware multilingual search with Typesense
- [Formbricks](https://railway.com/deploy/formbricks-surveys) — Surveys, NPS and in-app feedback on your own Postgres, Hub and Cube

Open this page in a browser: https://railway.com/deploy/growthbook-1
