Skip to main content

Feature Flags

A feature flag (also called a feature toggle) is a mechanism that lets you enable or disable functionality in your application without deploying new code. FeatureSignals supports multiple flag types for different use cases.

Flag Types

TypeValueUse Case
booleantrue / falseSimple on/off toggles
stringAny textConfig values, UI variants
numberInteger or floatLimits, thresholds, tuning
jsonAny JSON objectComplex configuration
abVariant assignmentA/B experiments with weighted variants

Flag Structure

Every flag has these properties:

PropertyDescription
keyUnique identifier used in SDK code (immutable)
nameHuman-readable display name
descriptionOptional description
flag_typeOne of: boolean, string, number, json, ab
default_valueValue returned when the flag is disabled
tagsArray of strings for organization
prerequisitesOther flags that must be enabled first
mutual_exclusion_groupGroup name for mutually exclusive flags
expires_atAuto-disable after this timestamp

Flag States

A flag's configuration is per-environment. The same flag can be ON in dev and OFF in production. Each environment state controls:

  • Enabled/Disabled — master toggle
  • Targeting Rules — conditional value delivery
  • Percentage Rollout — gradual rollout to a percentage of users
  • Variants — A/B experiment variant weights (for ab type)
  • Scheduled Enable/Disable — automatic toggling at a future time

Evaluation Flow

When an SDK evaluates a flag, the engine follows this order:

1. Flag exists?              → No: NOT_FOUND
2. Flag expired? → Yes: DISABLED (default value)
3. Environment state enabled? → No: DISABLED (default value)
4. Mutual exclusion winner? → No: MUTUALLY_EXCLUDED (default value)
5. Prerequisites met? → No: PREREQUISITE_FAILED (default value)
6. Targeting rules match? → Yes: TARGETED or ROLLOUT (rule value)
7. Percentage rollout? → In bucket: ROLLOUT / Out: FALLTHROUGH
8. A/B variant assignment? → Yes: VARIANT (variant value)
9. None of the above → FALLTHROUGH (default/state value)

Default Values

Default values work at two levels:

  1. Flag-level default — Defined when creating the flag. Returned when the flag is disabled.
  2. Environment-level default — Optional override per environment. Takes precedence when set.
  3. SDK fallback — The value you pass to boolVariation(..., fallback). Used when the flag doesn't exist or there's a network error.

Best Practices

  • Use descriptive keysenable-dark-mode is better than flag-1
  • Set expiration dates — Prevent stale flags from accumulating
  • Use tags — Organize flags by team, feature area, or release
  • Start with boolean — Only use complex types when needed
  • Clean up — Delete flags after full rollout