Feature Flags
This recipe uses the first-party remote_config module for feature flags and live tuning values.
Dashboard setup
Section titled “Dashboard setup”- Open Modules and install
remote_config. - In Remote config → Configs, create configs. Each has a
keyand a typedvalue, for examplenew_shop_enabled=falseandreward_multiplier=1. - Add overrides (on the config’s detail page or in Remote config → Overrides) to change a value for some players or for a time window. An override has a
valueof the config’s type, an optionalsegment, an optionalscheduleand apriority.
Rows are live as soon as you save them; you do not need a release. Configs and overrides are separate in staging and prod; promote to copy them to prod.
Read flags in the game
Section titled “Read flags in the game”Generate a typed client with remote_config installed (see Generated module clients). get returns { values }: for every config key, its type (string, number, bool or json) and its value as text for the calling player. The generated file adds helpers that parse a value by key.
import { modules, remoteConfigBool, remoteConfigNumber } from './rudder.modules';
const config = await modules(client).remoteConfig.get({});
if (remoteConfigBool(config, 'new_shop_enabled') ?? false) { showNewShop();}const multiplier = remoteConfigNumber(config, 'reward_multiplier') ?? 1;using RudderSdk.Modules;
var m = new RudderModules(client);var config = await m.RemoteConfig.GetAsync(new RemoteConfigGetArgs());
RemoteConfigValues.TryGetBool(config, "new_shop_enabled", out var newShop);if (!RemoteConfigValues.TryGetNumber(config, "reward_multiplier", out var multiplier)) multiplier = 1;A helper returns nothing (undefined or false) when the key is missing or has another type, so a default in code acts as the fallback. json values are parsed with remoteConfigJson<T> / RemoteConfigValues.TryGetJson<T>.
The SDK does not cache module results. Call get again when you want fresh values, for example at login and when returning to the main menu.
How overrides resolve
Section titled “How overrides resolve”For each config, the module picks the override with the highest priority whose schedule is active (or empty) and whose segment matches the player (or is empty). If there is none, the config’s own value is used.
Examples:
- Weekend event. Override
reward_multiplierto2with a schedule on Saturdays and Sundays. The module’sweekend_double_rewardssample sets this up. - Gradual rollout. Override
new_shop_enabledtotruefor a segment that matches part of your players. - Kill switch. Set the config’s value to
false; clients pick it up on their nextget.
An override value must have its config’s type. The dashboard rejects an override whose value does not match.