Skip to content

FlagDiligence docs

Core concepts

The few ideas that everything else is built on.

How things are organised

TermWhat it is
OrganizationThe top-level workspace for your company or team. It holds projects and members.
ProjectThe flags for one application or service.
EnvironmentA deployment stage such as Development, Staging or Production. Each has its own flag settings, rules and SDK keys.
FlagA switch in your code that FlagDiligence controls.
VariationA value a flag can return.
SegmentA reusable group of users that you can target from many flags.
SDK keyThe key that connects your code to one environment.

Flag types

TypeUse it forExample values
BooleanOn or offtrue, false
StringChoosing between named options"control", "variant-a"
NumberLimits and thresholds10, 2.5
JSONSeveral settings at once{"theme":"dark","limit":10}

Environments are independent

A flag can be on in Staging and off in Production. Rules, rollout percentage and variations are set per environment, and each environment has its own SDK keys. A key from one environment never reads another environment’s flags.

Each environment has a server key (keep it secret, use it only on servers) and a client key (safe to ship in front-end code). Regenerating a key invalidates the old one immediately.

How a flag is evaluated

  1. Is the flag on?If it is off in this environment, the user gets the OFF variation.
  2. Does a rule match?Rules are checked in priority order, lowest number first. The first rule that matches decides the value.
  3. OtherwiseThe user gets the default (fallthrough) value, which can include a percentage rollout.

Percentage rollouts are sticky. A given user key always lands in the same bucket, so the same person gets the same experience until you change the percentage. This is why every user needs a stable key.

Why a value was returned

The Node.js SDK can tell you the reason with variationDetail:

ReasonMeaning
OFFThe flag is off in this environment.
FALLTHROUGHNo rule matched, so the default was used.
TARGET_MATCHThe user was targeted directly.
RULE_MATCHA targeting rule matched.
PREREQUISITE_FAILEDA flag this one depends on was not satisfied.
ERROREvaluation failed and the default was returned.

← Getting startedTargeting and segments →

Need help with FlagDiligence?

Open the app, or tell us what you are trying to do.