Code-first Feature Flags

You know what's annoying about using today's typical feature flag services such as LaunchDarkly, Flagsmith, and others? In order to create and manage feature flags, I have to leave my IDE and log in to their website and use their UI. I think we can do better.

What if I never had to leave my IDE? After all, that's where the feature flag is actually consumed.

But first, let's rewind and walk through what creating and managing a feature flag using one of these services looks like:

Let's say I'm working on implementing a new version of a feature that I know we'll want to feature flag. I've picked out the spot in my code where the logic will fork.

if (true) {  // new behavior} else {  // old behavior}

I'm forced to log in to their UI, and only from there can I create the feature flag.

Creating a feature flag

Finally, I can return to my ide and start consuming my feature flag

if (flagsmith.hasFeature('my_feature')) {  // new behavior} else {  // old behavior}

That was annoying. I was forced to context switch away from code to the feature flag UI.

Why can't I just define my feature flag in the code, and have it appear in the UI for non technical folks to interact with?

const flags = setupFlags([  {    name: 'my_feature',    description: 'Determines whether or not to enable my feature',    default: false,  },])if (flags.hasFeature('my_feature')) {  // new behavior} else {  // old behavior}

By the way, I'm on Twitter if you want to follow along with my work!