Cloud
Feature Flags
Deterministic runtime feature toggles with tenant and user scoping.
Overview
The feature flag system provides runtime feature toggles with deterministic, identity-based rollout using FNV-1a hashing. The same user always gets the same result across requests and server instances — no random flipping.
Basic Usage
typescript
Deterministic Rollout
Unlike random percentage rollouts, AxilJS uses a stable hash of the flag name and user identity to assign users to buckets. This means:
- User A always sees the feature ON (or OFF)
- No UI flickering between requests
- Consistent behaviour across horizontally scaled instances
typescript
Tenant and User Targeting
Whitelisted tenants and users bypass the rollout percentage entirely.
typescript
Scheduled Activation
Flags can be scheduled to activate and expire automatically.
typescript
Custom Manager Instance
For isolated flag scopes or testing, create a separate manager.
typescript
API Reference
define(flag)
| Property | Type | Default | Description |
|---|---|---|---|
name | string | — | Unique flag identifier |
enabled | boolean | — | Global on/off switch |
rolloutPercentage | number (0–100) | 100 | Deterministic rollout bucket |
allowedTenants | string[] | — | Tenant whitelist (bypasses %) |
allowedUsers | (string | number)[] | — | User whitelist (bypasses %) |
startAt | string (ISO 8601) | — | Activation date |
endAt | string (ISO 8601) | — | Expiration date |
isEnabled(name, context?)
Returns boolean. Evaluation order: enabled → schedule → tenant list → user list → rollout hash.
get(name) / getAll() / remove(name)
Retrieve or delete flag definitions.