Course contentsShow
← Software Engineering
Lesson 712 of 1,93322. Continuous Delivery and DeploymentFree lesson

Feature Toggles for Deployment

Deploy code with features disabled, then enable them independently from deployment using runtime configuration.

Feature Toggles for Deployment

What you'll learn: How to deploy code with features turned off, then activate them independently of your deployment process.

The Core Idea

A feature toggle (also called a feature flag) is a runtime configuration switch that lets you enable or disable functionality in your deployed code without redeploying. You ship code to production with new features present but inactive, then "flip the switch" to turn them on when you're ready—decoupling deployment from release.

Think of it like installing a dimmer switch before the light bulb arrives. The wiring (code) is in place, but you control when and how much light (feature) users actually see.

How It Works

Instead of conditional compilation or branching strategies, you wrap new features with runtime checks:

if (featureToggle.isEnabled('newCheckoutFlow')) {
  // New feature code
  showNewCheckout();
} else {
  // Existing code
  showOldCheckout();
}

The toggle state lives in configuration—a database, config file, or feature management service—that you can change without touching code.

Why This Matters for Deployment

Feature toggles enable safe, decoupled deployments:

  • Deploy incomplete features hidden behind a toggle—no half-finished code branches
  • Test in production with real data before releasing to all users
  • Instantly disable problematic features without rollback
  • Combine with canary releases: enable for 5% of users, then gradually increase
  • Support A/B testing and gradual rollouts

This separation means your deployment pipeline stays fast and clean while business decisions about releases happen independently.

Key Takeaway: Feature toggles let you deploy continuously while controlling feature releases through configuration, not code changes—enabling safer, more flexible delivery.