← Lessons

quiz vs the machine

Gold1390

System Design

Feature Flags for Safe Rollout

Decoupling deploy from release so you can ship code dark and turn it on slowly.

5 min read · core · beat Gold to climb

Deploy is not release

A feature flag is a runtime switch that decides whether a code path is active. It separates deploy, which puts code on servers, from release, which exposes behavior to users. With flags you can ship a feature turned off, then enable it for a few users without a new deploy.

What flags buy you

  • Gradual rollout: enable a feature for one percent of users, then ten, then everyone.
  • Instant kill switch: turn a broken feature off in seconds instead of rolling back a deploy.
  • Targeting: enable a flag for internal staff or one region first.

The cost of flags

Flags are technical debt if they live forever. Each flag is a branch in the code that must be tested in both states. The discipline is to remove flags once a feature is fully launched, keeping only long lived operational flags.

Key idea

Feature flags separate deploy from release, enabling gradual rollout and instant kill switches, but stale flags must be cleaned up.

Check yourself

Answer to earn rating on the learn ladder.

1. What do feature flags decouple?

2. What is a major advantage of a feature flag over a deploy rollback?

3. Why should flags be removed after launch?