Yashveer Singh
Connect
<- All posts
SaaS Architecture and Scaling11 min read

Feature Flags: A SaaS Engineer's Best Friend

A feature flag is a runtime switch that controls whether a code path is active. The same deploy can have a feature off for some users and on for others. The pattern decouples deploy from release. Engineers ship code continuously. Product enables features when ready. Customer success rolls out gradually. The combination is dramatically more capable than the branch and wait alternative.

Written by Yashveer Singh, founder of Yashveer Labs.

What you actually need to know

  • Feature flags decouple deploy from release.
  • Simple flags work early. Dedicated services help past a handful.
  • Each flag has a planned end. Remove when the feature is fully rolled out.
  • Release flags are temporary. Permission flags are permanent.
  • Permanent flag debt is the most common failure mode.
Flag typePurposeLifetime
Release flagControl rollout of a featureDays to weeks
Experiment flagA or B testWeeks
Operational flagKill switch or circuit breakerPermanent if intentional
Permission flagCustomer entitlementPermanent
Configuration flagTenant or environment specificPermanent
Subscription flagPlan based accessPermanent

The core argument

Feature flags are one of those engineering disciplines that pay back immediately and compound over years. The team that flags new features by default ships continuously. The team that branches and waits for everything to be ready ships in big batches that break things.

The pattern is small. A boolean check around the new code path. The flag can be flipped at runtime. The team can ship the code on Tuesday and enable the feature on Friday. The team can enable for ten percent of customers, watch the metrics, and ramp to one hundred percent over a week. The team can disable instantly if something goes wrong.

The cost of the pattern is small. A few hours per feature to add and remove the flag. The benefit is the rollout control, the ability to ship without coordinating across teams, and the safety net of being able to disable a feature when it breaks. The math is consistently favorable.

The discipline that matters most is removal. Flags that stay in code forever accumulate as debt. The team has to know which flags can be removed. The flag at the time of creation should have a planned end. The removal is part of the feature work, not optional.

The teams that get this right ship many small changes per day with confidence. The teams that get it wrong ship big changes with anxiety. The pattern itself is small. The cultural shift is meaningful.

The flag lifecycle

PhaseDetail
CreationFlag is added with documentation of purpose and planned removal
ShipCode ships with flag off
Internal testFlag enabled for internal users
BetaFlag enabled for a small percentage
RampFlag percentage increases over days or weeks
FullFlag enabled for all customers
CleanupFlag and the old code path are removed
DocumentedThe flag and its removal are in the history

How much does this cost

ImplementationSetup costPer flag cost
Boolean in configHoursMinutes
Database backedDaysHours
Dedicated service self hostedSprintModest
Managed service (LaunchDarkly etc)Days to integrateModest plus subscription

Features the flag system must have

  • Runtime flag evaluation without deploy.
  • Targeting by user, tenant, or attribute.
  • Default value on unknown evaluation.
  • Logging of flag evaluations.
  • A way to list all current flags.
  • A removal process that audits old flags.
  • Documentation per flag.
  • A clear distinction between release and permission flags.

Expert opinion

Feature flags are one of the highest leverage engineering disciplines I have ever introduced to teams. The pattern is small. The benefits compound. The teams that adopt flagging by default ship many small changes per day with confidence. The teams that branch and wait ship anxious big bang releases. The cultural shift to flagging is meaningful but the technical work is light.

>

Yashveer Singh, founder of Yashveer Labs

How this played out on a real project

A client SaaS team was shipping large releases every two weeks. The releases were anxious events. Production incidents followed about a third of them. The team had no feature flag discipline.

We introduced flags. Every new feature shipped behind a flag. The release cadence increased to daily small ships. The flag percentages ramped on each new feature. Incidents dropped significantly because a problem with a new feature could be disabled instantly rather than rolled back through a deploy.

The team's velocity improved meaningfully over the next quarter. The big bang releases stopped. The continuous shipping replaced them. The team's confidence in deploys rose. The customer experience improved because issues were caught and disabled before most customers saw them.

For more on the related work, see feature flags as a deployment strategy and blue green deployments vs canary vs rolling a decision tree.

Common mistakes teams make

  1. No feature flags. Big bang releases.
  2. Flags that never get removed.
  3. No distinction between release and permission flags.
  4. No documentation per flag.
  5. Flags that depend on each other in unclear ways.
  6. No targeting capability. All or nothing rollout.
  7. No logging of evaluations.
  8. Treating flags as a substitute for testing.

A 30 day plan to adopt flagging

  1. Week one. Pick a flag service or build a simple one.
  2. Week two. Establish the convention. New features ship behind flags.
  3. Week three. Build the removal discipline. Audit old flags.
  4. Week four. Document the patterns. Train the team.

For more on the related work, read feature flags as a deployment strategy and AI feature flags rolling out generative features safely. On the broader deployment side, trunk based development for SaaS teams is the natural next read.

FAQ

Frequently asked

Author

Why Yashveer Singh is the right hire here

The right hire for the work in this article is someone who has done it, written about it, and is willing to back it up with their name. That is me. Yashveer Singh. Founder of Yashveer Labs. New Delhi. The work I have shipped is on the homepage. The work I am writing about is the work I do. There is no mismatch between the page and the engineer behind it.

Related reading