What are feature flags?
A feature flag is a software development process used to enable or disable functionality remotely without deploying code. New features can be deployed without making them visible to users. Feature flags help decouple deployment from release, letting you manage the full lifecycle of a feature.
They eliminate the need to maintain multiple feature branches within your source code. All code changes can be made to the primary branch; only when the feature is ready will it be enabled via the flag.
For example, if you were redesigning your app and wanted to see how people would react to the changes, you could show the new design to only half of your active users. Or, if you built some functionality aimed at enterprise teams, you could target only those users who belong to a large organization.
You may have seen feature flags referred to by other names, such as:
- Feature toggle
- Feature flipper
- Conditional feature
- Feature switch
- Feature controls
- Release toggle
Regardless of the name, their purpose is to use known information to control how code works.
Beta programs and tier access control
You can even run a beta program with feature flags. A user could sign up to get access to a new, rough-around-the-edges feature, and a target feature flag would grant them access. This option takes the burden of maintaining a feature flag infrastructure off of your Ops teams, allowing them to focus on the more critical needs of your application.
Whenever a user navigates to a new page or route in your app, you can check for the value of the feature flag and choose to act on it. Conceptually, this flow is not much different than other authorization logic your app might have.
Consider, for example, a blogging site with support for both free- and premium-tier writers. Free-tier writers would have a limited number of features; meanwhile, premium-tier writers have access to additional features, such as the ability to customize their design. You can control the capabilities accessible only to paying customers with a feature flag.
For a simple case like this, a feature flag backed by a database might make sense, and cover this a bit later in the guide. However, the advantage of feature flags deployed through a feature management platform is that they scale much more easily, helping your organization to stay on top of flag maintenance and technical debt.