Feature flags
Code ships turned off and opens by audience, with instant rollback.
Typed Feature flags (boolean, string, number and JSON) with variants, per-environment audience rules, reusable segments and percentage rollout. Each evaluation returns the value, the variant, the reason and the metadata, following the OpenFeature model, so your code talks to an open standard rather than a proprietary API.
Evaluation order is fixed and predictable: kill switch, flag off, rules in the order they were written and, finally, the default rule. The kill switch is an environment state, not a version state: it turns the feature off immediately, without publishing anything and without a new deploy.
How it works
- Rules with conditions on context attributes (equals, not equals, in list, greater and less than, starts with, ends with, contains and semver comparison) and up to 5 segments per rule.
- Segments with conditions and lists of included and excluded keys, shared across the workspace flags.
- Percentage rollout with stable distribution: the bucket comes from the SHA-256 of the flag key, the salt and the context key, across 10,000 buckets. The same context always lands on the same variant.
- OpenFeature providers for server and browser in the JS/TS SDK, which evaluates locally from a snapshot with the same engine the server uses.
- One SDK key per environment, shown only once; generating a new one revokes the previous one. Every call also carries an API credential with the flags:evaluate scope.
- Per-environment flag state readable through API v1 and the MCP server. Each published version is immutable and records who published it; rolling back is a new publication.
import { OpenFeature } from '@openfeature/server-sdk'
import { AiubyFlagsServerProvider, createFlagsClient } from '@aiuby-ia/flags'
await OpenFeature.setProviderAndWait(new AiubyFlagsServerProvider(createFlagsClient({ credential, sdkKey })))
const value = await OpenFeature.getClient().getBooleanValue('checkout-novo', false, { targetingKey: 'cliente-42', plan: 'pro' })What it does not do
- Rules do not accept regular expressions: use starts with, ends with or contains.
- Changes are not pushed over SSE: they reach the SDK through polling with ETag (5 s minimum, 30 s default).
- The official SDK is JS/TS, for the browser and Node 18+. Other languages use the remote evaluation route.
- The credential does not go to the browser: the snapshot includes the segment key lists, so the front end receives it through a route on your backend.