I'm building feature flags and I feel like architecture decisions for this is a solved problem and would love to hear anecdotes. How did you go about building feature flags at your company?
I work for Flagsmith these days, but formerly I was in charge of managing a lot of Trust and Safety related concerns for Clubhouse. This involved deleting a lot of records to appease regulators and creating custom features to handle stuff like CSAM and we used a lot of feature flags there to keep systems safe in case of an event.<p>The most important architectural decision that we made was pushing some of the feature flagging into the software layer. So, for example, every task had a module name and a task name that together would form the feature flag name. So out of the box any task could be disabled without adding further code. Combined with other good practices it went a long way. Another good option is to enable local evaluation mode[0] which allows a balance between keeping your feature flags up to date while avoiding API calls frequently.<p>[0] As an aside, I've worked on the implementation of local evaluation mode for one of our clients (I think Python?) at Flagsmith.
Easiest way is a DB entry / Environment Variable / Config that turns a feature on and off, some central class/object that reads it and is a source of truth and a bunch of "if" statements in the right place to hide the feature and make it unavailable via APIs if turned off.
Choosing a good solution heavily relies on whether your product is multi-tenant or not.<p>If multi-tenant things get complicated quite quickly. It may be worth looking into existing packages/libraries for your stack. I would be careful about using a third party service for this due to the latency it may introduce.<p>If not then just have a FEATURES constant. The value can be as primitive as an associative array, dict, hashmap, or struct. The keys are your flags and their values are booleans.<p>Not your forever choice, but very simple, quick, and easy to use.
For Ruby on Rails there is: <a href="https://github.com/flippercloud/flipper">https://github.com/flippercloud/flipper</a>
Disclaimer: I work at Amplitude, where we offer a feature flagging and experimentation platform<p>Hey hahnbee, I echo a bunch of other folks sentiment that local evaluation mode is pretty important so you’re not constantly making network calls to figure out the state of your flags, that’s one of the biggest things.<p>The other thing I’d add is that it’s pretty important (esp as a homegrown system) to build user tracking into your flags so you know that for a given flag, which user saw which version at what time. This is so critical for debugging and issue resolution so you’re not left guessing (and doubly important for experiments where you want to run stats on different populations).<p>You probably will not be surprised to find out that we have this stuff built into our system, and that you can get started with our flags for free! So here’s my shameless plug to head over to Amplitude.com and check out our stuff
We at <a href="https://flipt.io" rel="nofollow">https://flipt.io</a> are putting on a buy vs build webinar in a couple of weeks to discuss this very thing as it's a common question that engineering teams seem to have.<p>If you're interested in attending its taking place on LinkedIn on April 17: <a href="https://www.linkedin.com/events/buildvs-buy-pickingafeatureflag7175518829639331842/" rel="nofollow">https://www.linkedin.com/events/buildvs-buy-pickingafeaturef...</a>
I'm pretty happy with our setup, though we use flags mostly for feature releases and only have a few long-lived ones.<p>State kept in a database table indexed on customer. One row per customer/flag name, only there when the flag is set.<p>We keep active flags names as constants and put into an array for easy looping in our admin ux. This makes it easy to find usage and clean them up after launch.<p>These are passed to the browser so the frontend can check flags, and via grpc context to any downstream services.
We have below setup.<p>There are Global, Org, Store, User level settings type of <string,any> each. User has the highest priority over others and values are read of highest to least priority and one final set of flags are fetched. When page loads we fetch them from cache(Browser + Backend - Redis) OR DB.<p>This works well with two tables in DB, CRUD APIs, UI for settings on various level.
Don't build this in-house if you can help it.<p>I worked at an adtech company that had our own feature flag system built. Absolute pain to work with. To be fair, it had been built 6 years prior, and I worked there 4 years ago, so there were less off the shelve solutions at the time.<p>Switched to a company that used an off the shelve solution and it was 100x easier to work with.
I don't think there can be 1 fits all solution. Feature flag is at its core is nothing but a piece of your product code.<p>There are millions variants to implement a product, even within the same environment/infra constraints.<p>If you elaborate your specific goals and products - that may be a very fruitful topic.
Depending on you use-case you can also use <a href="https://vykee.co" rel="nofollow">https://vykee.co</a> for this (project of mine) – setup is <5mins. Let me know if you need help.