Feature flags, also called toggles, let you change how the app behaves while it runs, without a new deploy. This separates deploy from release. You can ship code to production turned off. Then you turn it on for internal users, for a percentage of users, or for specific tenants (customer accounts).
Common kinds:
- Release toggles hide unfinished work. This keeps the main branch always releasable in trunk-based development.
- Experiment toggles run A/B tests.
- Ops toggles are kill switches. During an incident, you use them to turn off an expensive or failing feature.
- Permission toggles show features only to some plans or roles.
The costs:
- Every flag adds code paths that you must test.
- Combinations of flags can interact in surprising ways.
- Old flags become technical debt.
Keep release flags short-lived. Give each one an owner and a removal date. Check flags in one place, not scattered all over the code.
- Feature flags separate deploying code from releasing it to users.
- The main kinds are release, experiment, ops (kill switch) and permission toggles.
- Flags allow a gradual rollout to some users or tenants.
- The cost is more code paths and more testing.
- Remove short-lived flags quickly, or they become technical debt.
Read more