Technology
Feature Flags: Ship Code Without Betting the Company on Every Release
Picture a Friday afternoon. The feature is merged, the tests are green, and a nervous silence settles over the team. Someone asks, "Are we really deploying today?" Now imagine a different world: the code ships every day, but nothing changes for users until you flip a switch, and if something looks wrong, you flip it back in seconds. That world is built on feature flags.
What is a feature flag?
A feature flag (also called a feature toggle) is a conditional in your code that decides at runtime whether a piece of functionality is active. In its simplest form it looks like this:
if (flags.isEnabled("new-checkout")) { showNewCheckout(); } else { showOldCheckout(); }
The important part is where the value of new-checkout comes from. It lives in configuration or a flag service, not in the compiled code. That means you can change behaviour without a new deployment.
The big idea: separate deploy from release
Traditionally, shipping code and exposing a feature to users were the same event. Feature flags split them apart:
- Deploy is a technical act: the code reaches production, switched off.
- Release is a business act: the feature is turned on for some or all users when you are ready.
This lets engineers merge small changes often, while product and business teams choose the right moment to launch, such as a campaign date or a partner announcement.
Where flags shine
1. Gradual rollouts
Turn a feature on for internal staff first, then a small group of customers, then everyone. If error rates or support tickets climb, you pause and investigate before most users ever see the problem.
2. Kill switches
A kill switch is a flag whose job is to turn something off fast. If a new payment provider integration misbehaves, you disable it with a config change instead of waiting for a rollback build to finish.
3. A/B experiments
Flags can serve different variants to different groups, so you can compare two designs with real behaviour rather than opinions in a meeting.
4. Targeted access
Beta programmes, premium-tier features, or region-specific functionality can all be driven by flags that check user attributes.
5. Trunk-based development
Instead of long-lived branches that become painful to merge, teams commit unfinished work to the main branch behind a flag. Integration problems surface early, when they are cheap to fix.
The catch: flags are debt if you ignore them
Flags are powerful, but every flag adds a branch to your code and doubles the paths you could test. A few habits keep them healthy:
- Name flags clearly and record an owner and a purpose for each one.
- Separate short-lived from long-lived flags. Release flags and experiments should be removed once the decision is made. Kill switches and permission flags may stay, but deliberately.
- Set an expiry. When you create a release flag, create the ticket to delete it at the same time.
- Test both states. A path that is "off" today will be "on" tomorrow, so it needs coverage too.
- Avoid tangled combinations. When flags depend on other flags, behaviour gets hard to reason about. Keep them independent where you can.
- Fail safe. Decide what happens if the flag service is unreachable. A sensible default, usually the old, proven behaviour, prevents an outage from a configuration problem.
Build or buy?
You can start with a simple config file or database table and a small helper function. That is often enough for a handful of flags. As the number of flags and teams grows, you will likely want things like per-user targeting, audit logs showing who changed what, role-based permissions, and a friendly dashboard for non-engineers. That is the point where a dedicated flag platform or open-source tool is worth evaluating. Pick based on your scale, not on hype.
Security and governance
A flag is a production control. Treat changes to it like any other production change: restrict who can edit it, keep an audit trail, and avoid putting secrets in flag values. For regulated products, being able to show who enabled what and when is a real advantage.
Practical takeaways
- Start with one risky upcoming feature and put it behind a flag.
- Roll it out to internal users first, then widen gradually while watching your metrics.
- Add a kill switch to any integration that touches payments, messaging, or third-party services.
- Create a clean-up task for every temporary flag the moment you create it.
- Review your flag list regularly and delete what is no longer needed.
Done well, feature flags turn releases from high-stakes events into routine, reversible decisions. That is good for developers' sleep and for the business's confidence.
Want to ship faster without the release-day anxiety? Talk to the Annz Tech team and we will help you design a rollout strategy that fits your product.
Deploying code and releasing a feature are two different decisions, so stop making them with the same button.

