Why We Migrated to Launch Darkly for Feature Flagging
May 09, 2023·Last updated on May 09, 2023Share this article:
By Hassan Ali, Technical Lead, Ecommerce
Feature flags are a software development technique that allow teams to enable or disable certain features in an application or service without changing code.
At Unstoppable Domains, we used an in-house feature flag solution for several years. While it got the job done, we were starting to encounter some limitations and issues that made us consider other options. After some research and testing, we decided to migrate to Launch Darkly, a popular feature flagging service.
In this post, we’ll discuss why we made the switch and how we’ve benefited from using Launch Darkly.
Challenge
Our in-house solution for managing feature flags was very simple: a database table with two main columns, flag_name and is_enabled. This was easy to use, but also limited the functionality.
To empower non-developers to toggle feature flags, we added a user interface within our Admin Panel. While the user interface worked well, it became challenging to navigate once the list of feature flags grew. Documenting and managing the extensive list of feature flags was an ever-growing task. Not all of the flags were documented, and we started having multiple flags with similar names. At one point, a bug was introduced in our UI that enabled all flags, which was really scary! Luckily our team caught and reverted what could’ve been a costly mistake.
Additionally, we started receiving increased traffic on our site, and our feature flag table was getting queried too often. As a result, the database became a bottleneck, and we began to see high latency on the backend. Users were at times unable to perform basic actions on the website, such as searching for domains or logging in. To overcome this issue, we invested resources into caching feature flags, opening up the bottleneck.
Overall, what started as a simple solution for managing our in-house feature flag system ended up increasing our internal maintenance workload and leading us to look for other options.
Solution
At first, our team looked at building a more robust in-house solution, adding a feature flag that could be enabled on a per-domain basis. For example, we could turn on new features for our dev teams and whales to test out and give us feedback before we opened it up more broadly. However, the engineering cost to build out a robust feature flag management platform was higher than an out-of-the-box solution.
After some research and testing, we decided to migrate to Launch Darkly, which is a leading feature management platform and is much more reliable than our previous implementation. The transition was smooth - we migrated a batch of feature flags every week and completed the full transition of 50 flags within a quarter.
Code before LaunchDarkly:
// Database query to fetch the feature flagconst ecommerceServiceEnablePurchaseGiftCodes = await FeatureFlag.findOne({name: 'ecommerceServiceEnablePurchaseGiftCodes'});// Feature is either enabled/disabled for all usersif (ecommerceServiceEnablePurchaseGiftCodes) {// Allow users to purchase gift codes}
Code with LaunchDarkly:
// Feature flag can be enabled on a per-user, per-wallet, or per-domain basisconst featureFlags = await getLaunchDarklyFeatureFlags({domainName: 'sandy.crypto'});if (featureFlags.ecommerceServiceEnablePurchaseGiftCodes) {// Allow user(s) to purchase gift codes}
Results
The adoption of Launch Darkly has brought several benefits to our team, enhancing our development process and productivity.
The platform's flexibility allows us to enable flags on a per-user, per-wallet, or per-domain basis, providing granular control over feature deployment. Adding a new flag takes mere seconds, significantly improving development velocity compared to our previous in-house solution.
Launch Darkly's built-in analytics offer insights into feature flag usage, helping maintain a clean codebase and reduce technical debt. The percentage rollout feature enables controlled testing, minimizing risk and ensuring a seamless user experience.
We leveraged Launch Darkly flags for several recent features, including the UD.me token gallery, AI Avatars (where we were able to provide early access to community members), Sponsored Badges, and our Email Messaging Service.
Overall, we’ve been extremely happy with our decision to migrate to Launch Darkly for feature flagging. Its robust capabilities, improved reliability, and visibility features have all made our development process smoother and more efficient.