Skip to main content

Feature Flags

Flux feature flags let you ship code without releasing it. Roll features out gradually, run A/B tests, and target specific users, organizations, or entitlement tiers — all without a deploy.

Creating a Flag

Flags are created from the Flags dashboard or via the API. Each flag has a key (e.g. new-dashboard), a type (boolean or multivariate), and a default value.

Boolean Evaluation

The simplest flag type — on or off.

use flux_sdk::Flux;

let flux = Flux::init("your-api-key");

if flux.flags().is_enabled("new-dashboard", &user)? {
    // Render new dashboard
}

Python

import flux

flux.init("your-api-key")

if flux.flags.is_enabled("new-dashboard", user):
    # Render new dashboard
    pass

Multivariate Evaluation

Return one of several string variants — useful for A/B tests or configuration values.

let variant = flux.flags().get_variant("checkout-flow", &user)?;

match variant.as_str() {
    "control"   => render_current_checkout(),
    "variant-a" => render_streamlined_checkout(),
    _           => render_current_checkout(),
}

Targeting Rules

Targeting rules let you enable a flag for a subset of users or organizations without a full rollout. Rules are evaluated in order; the first match wins.

Common targeting dimensions:

  • User attribute — email domain, country, plan tier
  • Organization — specific org IDs or org attributes
  • Percentage rollout — gradual ramp by user ID hash
  • Entitlement — only users on plans that include a given entitlement

Rules are configured from the Flags dashboard with no SDK changes required.

Tenant Overrides

You can override a flag’s value for a specific organization — useful for beta customers or enterprise-specific behavior.

// Check flag with org context (tenant override takes priority)
let enabled = flux.flags().is_enabled_for_org("new-dashboard", &org.id)?;

Entitlement-Aware Flags

Link a flag to an entitlement so it is automatically enabled only for organizations whose billing plan includes that entitlement.

Configure the entitlement link in the Flags dashboard. The SDK evaluation call is the same — Flux resolves the entitlement check server-side.

Next Steps