Feature Flags Explained

Toggle features at runtime without deploying — the key to gradual rollouts, safe releases, and instant rollbacks.

Feature Flags

Feature flags (also called feature toggles) are conditional switches in code that allow teams to enable or disable features at runtime without deploying new code. They decouple deployment from release, enabling gradual rollouts, A/B testing, and instant kill switches.

Explanation

Traditionally, deploying code and releasing features happen simultaneously — when code goes to production, users see the new feature immediately. Feature flags break this coupling. A feature flag wraps new code in a conditional check: if the flag is on, users see the new feature; if it is off, they see the old behavior. Flags can be toggled in a dashboard without redeploying. Feature flags enable several powerful workflows: gradual rollouts (enable a feature for 1% of users, then 10%, then 50%, then 100%), targeted releases (enable for beta users, specific regions, or enterprise customers), A/B testing (show variant A to 50% and variant B to 50%, measure which performs better), and kill switches (instantly disable a problematic feature without rolling back the deployment). Managing feature flags requires discipline. Flags should be short-lived (remove them once the feature is fully rolled out) to prevent technical debt. A flag management platform (LaunchDarkly, Unleash, Flagsmith) provides a dashboard, audit trail, and targeting rules. Without cleanup, codebases accumulate dead flags that make code harder to understand and test.

Bookuvai Implementation

Bookuvai uses feature flags for all major feature rollouts. During milestone delivery, new features are deployed behind flags and gradually rolled out during the review period. If a client identifies issues during milestone review, the feature can be disabled instantly while the team investigates. Our standard flag lifecycle includes a cleanup ticket that is created automatically when a flag reaches 100% rollout.

Key Facts

  • Decouples deployment (pushing code) from release (users seeing features)
  • Enables instant rollback without code changes or redeployment
  • Flags should be cleaned up within 2-4 weeks of full rollout to prevent technical debt

Related Terms

Frequently Asked Questions

How are feature flags different from environment variables?
Environment variables are set at deployment time and require a restart to change. Feature flags can be toggled at runtime, targeted to specific users, and managed through a dashboard. Feature flags are dynamic; environment variables are static.
Do feature flags add performance overhead?
Minimal. Flag evaluation is typically a dictionary lookup — sub-millisecond. Feature flag SDKs cache flag state locally and sync with the server periodically. The performance impact is negligible compared to any database query.
How do I test code behind feature flags?
Test both states — flag on and flag off — in your test suite. Feature flag SDKs provide test utilities to override flag values. In integration tests, run the critical user paths with the flag in both states.