website/blog/2025-06-27-enabling-feature-flags-ab-testing-growthbook-ferretdb.md
In modern software development, agile methodologies and data-driven decisions are key. Feature flags and A/B testing allow teams to release features safely, test ideas, and personalize user experiences without full-scale deployments. GrowthBook offers a powerful open-source solution for these critical tasks.
<!--truncate-->At FerretDB, we're dedicated to providing a truly open-source alternative to MongoDB, leveraging the reliability and power of PostgreSQL as its backend.
In this blog post, we explore how GrowthBook, an open-source feature flagging and A/B testing platform, seamlessly integrates with FerretDB, offering a robust and high-performing solution for your growth initiatives.
GrowthBook is an open-source platform designed to help product teams and developers manage feature flags and run A/B tests. It empowers organizations to:
GrowthBook focuses on providing a powerful, developer-friendly platform that integrates seamlessly into your existing workflow, enabling continuous experimentation and rapid iteration.
GrowthBook uses MongoDB as the supported database backend for its self-hosted deployments, enabling it to store login credentials, cached experiment results, and metadata. Given that FerretDB is designed to be a truly open source alternative to MongoDB, it can serve as a drop-in replacement in GrowthBook. This powerful combination offers several compelling advantages:
Connecting GrowthBook to your FerretDB instance is straightforward. Here's a step-by-step guide to get you started with a self-hosted GrowthBook instance:
Ensure FerretDB is running: Make sure your FerretDB instance is active and accessible. If you haven't set it up yet, refer to our FerretDB Installation Guide.
Set up GrowthBook: You can self-host GrowthBook using Docker – see GrowthBook Self-Hosting Documentation for more details. You can use the following Docker command to run GrowthBook with FerretDB:
docker run -d \
--name growthbook \
-p 3000:3000 \
-p 3100:3100 \
-v growthbook_uploads:/usr/local/src/app/packages/back-end/uploads \
-e MONGODB_URI="mongodb://<username>:<password>@<host-address>:27017/growthbook" \
growthbook/growthbook:latest
Replace <username>, <password>, and <host-address> with your FerretDB connection details.
The growthbook database will be created automatically if it doesn't exist.
Ensure that the FerretDB instance is accessible to the GrowthBook container.
Launch GrowthBook:
GrowthBook should connect to FerretDB, initialize its database, and be accessible via its web interface.
You can access it at http://localhost:3000 (or whatever port you specified in the Docker command).
You can now log into GrowthBook, define feature flags and create experiments, with all data seamlessly stored in FerretDB.
After setting up GrowthBook, create a feature flag or an experiment to see how GrowthBook interacts with FerretDB.
In the image below, an experiment named ferretdb-experiment is created.
GrowthBook creates various collections to manage its configuration, user data, feature flags, and experiment results; you can see these collections in the FerretDB instance. Connect to your FerretDB instance using a MongoDB shell or GUI tool (like MongoDB Compass or Mongo Express) and switch to the GrowthBook database (default growthbook):
Now, let's query the experiments collection to see the feature flags and experiments defined in GrowthBook:
This output demonstrates that GrowthBook successfully writes and reads its document-based data into FerretDB, which in turn stores it efficiently in PostgreSQL, providing a reliable backend for your feature flags and experiments.
The integration of GrowthBook and FerretDB provides a robust, scalable, and fully open-source solution for managing your feature flags and A/B tests. By leveraging FerretDB, you can run your entire workloads in open source, without vendor lock-in or restrictive licenses.