Feature Flag
In one line
Feature flags toggle features on/off at runtime — decouple deploy from release, enable A/B testing and instant rollback.
In simple words
A feature flag turns a feature on or off at runtime, without deploying new code. This decouples deployment from release — you can deploy code that is off, then turn it on when ready.
Use cases: gradual rollout, instant rollback, A/B testing, environment control, kill switches. Tools: LaunchDarkly, Unleash, Flagsmith.
Example
const useNewPayment = await ldClient.variation('new-payment-flow', { key: user.id }, false);
if (useNewPayment) { return newPaymentFlow(cart, user); }
else { return oldPaymentFlow(cart, user); }
// Toggle in dashboard — no redeploy!The feature flag is checked at runtime. Toggle it in the dashboard — no redeploy. Roll out gradually, and turn off instantly if bugs appear.
Common confusions
Confused with: Canary Deployment
The difference: Canary deployment rolls out new CODE to a subset of servers. Feature flags roll out new FEATURES to a subset of users within existing code. Feature flags are more flexible but require code-level integration.
Related terms
Related Resources
Related Lessons
- Feature Flags
Feature flags.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.