Repository navigation
Feature Flags 101
New to feature flags? This page covers everything Flag Responder relies on, with no assumed knowledge.
if (flags.isFeatureEnabled('new_checkout')) {
return 'one-page checkout';
}
return 'classic checkout';The code ships with both paths. A service, here Flagsmith, decides at runtime which path each user gets. Turning new_checkout off in Flagsmith switches users back to the classic checkout in seconds, with no build and no deploy.
| Word | Meaning | Example |
|---|---|---|
| Flag (feature) | A named switch, optionally with a value |
new_checkout, value "one_page"
|
| Environment | A separate copy of every flag's state | Development, Production |
| Default (environment default) | What everyone gets unless something more specific applies | Off in Production |
| Segment | A group of users defined by rules on their traits |
internal_staff: email contains @example.com
|
| Segment override | "For this segment, the flag is on (or off), with this value" | On for internal_staff
|
| Identity | One user, as Flagsmith knows them | priya@example.com |
| Identity override | A setting for exactly one user | On for priya@example.com only |
| Trait | A fact about a user, sent by your app |
plan=pro, email=priya@example.com
|
| Multivariate flag | A flag whose value is split across variants by percentage | 70% "a", 30% "b"
|
| A/B test (experiment) | Flagsmith Experimentation splits users between variants and measures which does better | Half of shoppers: classic vs one_page
|
When your app asks "is new_checkout on for this user?", Flagsmith checks the most specific rule first:
flowchart TD
Q["App asks: new_checkout for priya@example.com?"] --> I{"Identity override<br/>for this user?"}
I -- yes --> IV["Use it"]
I -- no --> S{"Does she match a segment<br/>with an override?<br/>(checked in priority order)"}
S -- yes --> SV["Use that segment's setting"]
S -- no --> D["Use the environment default<br/>(and its % split, if multivariate)"]
An A/B test is served the same way, through a hidden segment that Flagsmith creates for the test (named experiment-<id>-rollout). It covers the test's share of users and splits them between control and variant.
Take the demo's new_checkout in Production:
| Rule | State | Who it covers |
|---|---|---|
| Default | off | everyone else |
Segment override internal_staff
|
on | staff |
| A/B test "One-page checkout" (hidden segment) | on | half of all shoppers |
The dashboard's main switch shows off, yet staff and half your shoppers get the new checkout. When it breaks, flipping that switch changes nothing for them. This is the problem How the Kill Switch Works solves. Try it yourself in the interactive explainer.
Flagsmith's Feature Health receives alerts from monitoring tools through a webhook URL. An alert names a flag (and usually an environment) and says unhealthy or healthy. Flagsmith records it as an event, and Flag Responder reads those events. See Alerting Setup to wire up Prometheus or Grafana.
Flagsmith can keep a history of every change to a flag in an environment (v2 feature versioning). Changes then go in as a new published version rather than an edit in place. Flag Responder handles both kinds, and the tests run on both.
Repository · Latest release · Report an issue · Wiki sources live in docs/wiki: edit them there and republish.