Flag Reference
| Flag | Type | Default | Description |
|---|---|---|---|
LOCAL_EXECUTION_ENABLED | boolean | false | Master switch for local execution |
SERVER_EXECUTION_ENABLED | boolean | true | Master switch for server execution |
CANARY_PERCENTAGE | number | 0 | Percentage (0-100) of users routed to local execution |
FORCE_LOCAL_EXECUTION | boolean | false | Force local for all users (overrides canary) |
KILL_SWITCH_LOCAL_EXECUTION | boolean | false | Disable local for all users immediately |
Functions
parseFeatureFlags(env?)
Parses flags from process.env or a custom key-value map. Never throws — all flags have safe defaults.
getFeatureFlags()
Shorthand for parseFeatureFlags(process.env).
isLocalExecutionEnabled(userId, flags?)
Determines whether local execution is active for a specific user. Checks in order:
- Kill switch → always
false - Force flag → always
true - Canary percentage → hash-based user bucketing
isServerExecutionEnabled(flags?)
Returns flags.SERVER_EXECUTION_ENABLED.
validateFlagConfiguration(flags)
Checks for invalid flag combinations.
FORCE_LOCAL_EXECUTIONandKILL_SWITCH_LOCAL_EXECUTIONboth enabled- Both
LOCAL_EXECUTION_ENABLEDandSERVER_EXECUTION_ENABLEDdisabled
getMigrationPhase(flags?)
Returns the current rollout phase as a string.
Migration Phases
| Phase | Condition |
|---|---|
rollback | Kill switch is active |
cutover | Server execution disabled, local is primary |
canary | Local enabled with CANARY_PERCENTAGE > 0 |
shadow | Local enabled but CANARY_PERCENTAGE === 0 |
unknown | No recognizable state |

