Loading pattern...

What is Feature Flag?

A Feature Flag (or toggle) is an if/else statement in your code that lets you turn features on/off without deploying new code. You can show Feature X to 10% of users, or only beta users, or only on Tuesdays. This lets you deploy code safely, test with small groups, and kill bad features instantly without rolling back deploys. Essential for continuous deployment and A/B testing.

When Should You Use This?

Use feature flags when rolling out risky features (test with 5% of users first), doing A/B tests (show variant to 50% of users), or want to separate code deployment from feature release (deploy Friday, enable Monday). Also useful for beta features, gradual rollouts, or letting customer success enable features per customer. Every production app should have feature flags.

Common Mistakes to Avoid

  • Too many flags—old flags pile up, clean them up after full rollout
  • No flag management—use a system (LaunchDarkly, Flagsmith) or you'll lose track
  • Flags in database—flags should be config/code, not per-user database rows
  • No monitoring—watch metrics when you enable a flag, be ready to disable it
  • Skipping flags for "small" changes—small changes break things too

Real-World Examples

  • Facebook—Every feature behind flags, gradual rollout to billions
  • Stripe—Use flags for customer-by-customer enterprise feature access
  • GitLab—Ships everything flagged off, enables incrementally
  • Linear—Beta features available via flags before public launch

Category

Product Management

Tags

feature-flagdeploymentab-testingengineeringgradual-rollout

Permalink