Star
Start here

How it works

Five nouns, one evaluation order, and two kinds of SDK. That's the whole model.

What featurekit stores

Project one product or team, like acme Flag key, kind, variations Segment a named list of keys Environment development, production… Flag configuration one per flag per environment: on/off, targets, rules, rollout, version SDK keys server, client, mobile
ThingWhat it is
ProjectHolds flags and segments. Most teams have one.
EnvironmentDevelopment, staging, production. Each has its own configuration for every flag, its own keys and its own snapshot. Marking one isProduction turns on secure mode and production warnings.
FlagA key, a kind (boolean, string, number, json) and 2 to 100 variations, the values it can serve. Shared by every environment.
Flag configurationPer environment: on or off, what to serve when off, targets, rules, prerequisites, and what everyone else gets. Has a version that goes up on every change.
SegmentA list of context keys, like "beta testers", that rules can target.

Contexts

A context is whoever you're asking about: a user, an organization, a device. It has a key and any attributes you want rules to read.

flags.get("new-checkout", { key: "usr_123", plan: "pro", country: "DE" }, false);

A plain object is a user. To target several kinds at once, pass a multi-context. See targeting rules.

How a flag is evaluated

The same fixed order every time. The first step that answers wins.

#StepServesreason
1The flag isn't in the snapshotYour defaultFLAG_NOT_FOUND
2The flag is offThe off variationOFF
3A prerequisite isn't metThe off variationPREREQUISITE_FAILED
4The context's key is listed in a targetThat target's variationTARGET_MATCH
5A rule matches (first one wins)The rule's variation or rolloutRULE_MATCH
6Nothing matchedThe fallthrough variation or rolloutFALLTHROUGH

Anything that goes wrong (a malformed context, a value of the wrong type) returns your default with ERROR. Evaluation never throws, and one broken flag never affects another.

Two kinds of SDK

 Server SDKClient SDK
Packagefeaturekit-server/sdkfeaturekit-client
Runs inYour backend (Node)Browsers, React Native, Deno, Bun, edge
Keyfk_srv_…, secretfk_clt_… or fk_mob_…, public
ReceivesEvery rule, compiledEvaluated values for one context
A checkget(key, context, default), any context, in memoryget(key, default), its one context

This split is the security boundary. The server routes refuse client keys and the client routes refuse server keys, so a browser can never be handed your rules.

From toggle to your app

  1. You change a flag

    In the dashboard, the API, the MCP server or the flags file. The configuration, its new version and an audit row are written in one transaction.

  2. It compiles into a snapshot

    Changes are batched for 200ms, then compiled into a versioned snapshot of the whole environment. A compile that fails leaves the last good snapshot serving.

  3. Every SDK hears about it

    Server SDKs get a patch over their stream; client SDKs get new values only if theirs changed. Other control-plane nodes are told through Postgres NOTIFY. The kill switch skips the 200ms wait.

  4. Your next get() sees it

    No restart, no redeploy, no request on the check itself.

When something breaks

The SDK steps down one level at a time and keeps answering.

Serving fromWhen
The streamed rulesNormally.
The last good snapshot, in memoryThe control plane or Postgres is down, or a change won't compile.
The snapshot saved to diskYour app restarted while the control plane was unreachable. Needs persist.
Your defaultNothing else is available. That's why the default is required.

Next