How to manage feature toggles with Squidex Headless CMS

Sebastian Stehle
Squidex
Published in
2 min readFeb 19, 2018

Have you heard about feature toggles (aka feature flag)? The idea is that when you roll out a new feature, you enable it only when a feature toggle is turned on. The advantage is that you can turn it off again if it does not work as expected or you can turn it on for some of your users only to check the acceptance of this feature or the conversion rate.

We integrated a new feature to Squidex to make it easier to manage this kind of data:

Inline Editing

When you create a schema you can define per field, if you want to allow inline editing. In this case we have three fields:

  1. The name of the feature (String, Input, Required).
  2. The field that indicates if the feature is turned on or off (Boolean, Toggle).
  3. The ratio of users to turn it on for. (Number, Default: 100)
The schema for our feature toggles

We also marked all three fields as list fields, so that we see all fields as columns in our content list, except for the feature name we also enable inline editing.

What you get is a nice list of features:

List of features

You see when we enable inline editing, we render the controls to edit the content directly inside the list now.

When you make a change, we show the save button to update your content directly.

If you want to build something similar, I recommend to fetch the feature toggles when your server starts and to keep them in memory as a hashset. You can also create a rule to push updates to your server, e.g. to a webhook. With this approach you can achieve high performance, because checking a feature toggle is just a lookup to a hashset.

--

--