Kaiten

Feature Flags

Feature Flags

Control which features are available to which instances with typed variants, CEL targeting rules, and OpenFeature compatibility.

What are feature flags?

Feature flags in Kaiten let you control which features are available to which instances — without redeploying your application. Kaiten flags support typed variants, CEL-based targeting rules, and OpenFeature compatibility.

Feature Flag: "delivery-tracking-enabled"
├── Type: boolean
├── Variants: on (true), off (false)
├── Default: off
├── Targeting Rules:
│   └── "Delivery tracking entitlement granted"
│       __kaiten.entitlements['delivery-tracking'] == true → on
└── Evaluation: POST /ofrep/v1/evaluate/flags/delivery-tracking-enabled

The rule reads the License instead of naming customers: Sakura Tokyo and Kappa Kyoto, on Premium, resolve to on; Ninja Osaka, on Starter, and Demo Restaurant, on the first version of Standard, resolve to off.


Key capabilities

CapabilityDescription
Typed variantsboolean for on/off toggles, string and number for named modes and limits, object for structured configuration (A/B tests, gradual rollouts)
CEL targetingWrite rules using Common Expression Language to target specific instances
OpenFeature (OFREP)Standard evaluation protocol — use any OpenFeature SDK, no vendor lock-in
Per-instance evaluationEach flag resolves independently based on the calling instance's context
Master switchDisable a flag globally — always returns the default variant regardless of rules

How it works

  1. Create a flag with variants (the possible values it can resolve to)
  2. Define targeting rules using CEL expressions to match instances
  3. Evaluate the flag via OFREP — Kaiten resolves the correct variant for the given context
  4. React in your application based on the returned variant value
Evaluation request (context: { targetingKey: "sakura-tokyo", kaiten: { instanceSlug: "sakura-tokyo-prod" } })
  │
  ├── Is flag enabled? → Yes
  ├── Rule 1: __kaiten.entitlements['delivery-tracking'] == true
  │           Premium grants delivery-tracking → MATCH → variant "on"
  │
  └── Response: { key: "delivery-tracking-enabled", variant: "on", value: true, reason: "TARGETING_MATCH" }

Feature flags are organization-scoped — each organization manages its own flags independently.


In this section


API endpoints overview

CRUD

MethodEndpointDescription
GET/api/feature-flagsList all feature flags
POST/api/feature-flagsCreate a feature flag
GET/api/feature-flags/{slug}Get a feature flag
PUT/api/feature-flags/{slug}Replace a feature flag's definition
DELETE/api/feature-flags/{slug}Delete a feature flag

Evaluation (OFREP)

MethodEndpointDescription
POST/api/ofrep/v1/evaluate/flags/{key}Evaluate a single flag
POST/api/ofrep/v1/evaluate/flagsBulk evaluate all flags

OpenFeature

MethodEndpointDescription
GET/api/openfeature/v0/manifestGet the OpenFeature flag manifest

Events

Every feature flag mutation emits a domain event via the transactional outbox, and each evaluation is recorded as one too, for the organization and best effort:

Event nameEvent type
FEATURE_FLAG_CREATEDcom.kaiten.feature_flag.v1.created
FEATURE_FLAG_UPDATEDcom.kaiten.feature_flag.v1.updated
FEATURE_FLAG_DELETEDcom.kaiten.feature_flag.v1.deleted
FEATURE_FLAG_EVALUATEDcom.kaiten.feature_flag.v1.evaluated

On this page