Skip to content

Flags

A flag is a named toggle point in your code. mozhno supports two flag types, context constraints, segments, and percentage rollout.

Flag Types

RELEASE

Standard feature flag for gradual rollouts. Off by default — enabled for target audiences via activation rules.

KILLSWITCH

Emergency shutoff switch. On by default for everyone — disabled during incidents. Checked with isEnabled(): if it returns false, the feature is blocked.

When to Use Each

RELEASEKILLSWITCH
PurposeEnables new functionalityDisables broken functionality
Default stateOff (gradually enabled)On (instantly disabled)
Example keynew-checkoutkill-payment-gateway
RollbackSet enabled: false or 0%Set enabled: false

Context Constraints

Context constraints control who sees a flag based on attributes passed to the SDK. All constraints within a group are evaluated with AND logic — every one must match.

Each constraint references a context definition (via field), specifies a comparison operator, and lists acceptable values. The context type (string, number, time, semver) determines how the operator interprets the value.

See Contexts for details.

Segments

A segment is a reusable user group defined through the same context constraints. Instead of duplicating rules across flags, define a segment once and reference it.

A flag can reference multiple segments — matching any one is enough (OR). See Segments.

Percentage Rollout

Deterministic distribution via MurmurHash32 of flagKey + userId (or sessionId). The same user always lands in the same bucket.

Lifecycle

StateDescription
ActiveFlag created, available for SDK evaluation
ArchivedFlag archived. SDK does not receive its configuration

A flag can also be enabled (enabled: true) or disabled (enabled: false) independently on each environment.

What's Next

Released under the AGPL v3.0 License.