Skip to content

Feature Toggles Backend

Medium — good to knowBackend

ELI5 — The Vibe Check

Feature toggles on the backend let you turn features on or off without redeploying. Ship the code to production, but keep it hidden behind a flag. Enable it for 5% of users to test, then gradually roll it out. If it breaks, flip the toggle off instantly. No deploy needed.

Real Talk

Backend feature toggles (feature flags) are conditional branches in code controlled by external configuration. They enable trunk-based development, gradual rollouts, A/B testing, and instant kill switches. Toggle state can be stored in databases, config files, or dedicated services (LaunchDarkly, Unleash). Types include release toggles, experiment toggles, ops toggles, and permission toggles.

Show Me The Code

async function getCheckoutFlow(req, res) {
  const flags = await featureService.getFlags(req.user);
  
  if (flags.isEnabled('new-payment-flow')) {
    return newPaymentFlow(req, res);
  }
  return legacyPaymentFlow(req, res);
}

When You'll Hear This

"Enable the new pricing engine for 10% of users via feature toggle." / "Kill the toggle immediately — the new search is returning wrong results."

Made with passive-aggressive love by manoga.digital. Powered by Claude.