Getting started

Core concepts

FlagFish is built around four objects. Understanding how they fit together is all you need to model any rollout — from a simple on/off toggle to a percentage-based experiment.

Flag

A named switch your code reads. Has a type (boolean, string, number, JSON) and a default value.

Environment

An isolated context — development, staging, production — each with its own flag values.

Segment

A reusable group of users defined by attributes — plan == "pro", region, and more.

Rule

An ordered condition that decides which value a user gets. First match wins; the default is the fallback.

How evaluation works

When your app calls useFlag, FlagFish evaluates rules top-to-bottom against the current user context and returns the first matching value — all locally, in microseconds.

// user context passed to the SDK
{ key: 'user_8f2', plan: 'pro', region: 'eu' }

Always pass a stable key per user — percentage rollouts hash on it, so the same user stays in the same bucket across sessions.

Next Targeting rules →