Quickstart
Create a project, add a flag, generate a server runtime key, and evaluate safely.
FeatureGate's first integration path is intentionally small: create a project, add a flag, create a server runtime key for one environment, then evaluate from your server. Browser and React SDKs build on the same flag model later with publishable client keys for client-exposed flags.
FeatureGate is invite-only during private beta. Request access from the public site if you do not
have an account yet, or use the /join/:token link from your invitation email before following
this setup path.
The integration path
Create or open a project in the console.
Add the standard environments or choose a custom environment key.
Create a boolean, string, number, or object flag.
Configure the flag for the environment your application will read from. The default is what FeatureGate serves when no targeting rule matches.
Create a server runtime key. New console keys start with both runtime:evaluate and
runtime:snapshot so you can run the activation check and then wire the SDK.
Copy the console's runnable /v1/evaluate request and send it once. This confirms the key,
environment, and flag can serve traffic before you add SDK code.
Install the TypeScript SDK and keep one shared client per runtime key. If your server only uses
local snapshot evaluation after setup, you can later narrow new keys to runtime:snapshot.
Install the SDK
Install the package and set the runtime key as an environment variable. Keep one client instance per process. It owns the snapshot cache.
npm install @featuregate/server
FEATUREGATE_RUNTIME_KEY=fg_sk_test_0123456789abcdef0123456789abcdef0123456789abcdefA server runtime key reads your full flag snapshot. Set it from an environment variable and never ship it to the browser — use a publishable client key with the Browser SDK for client-exposed flags.
Create the client
Use one shared client for the lifetime of your server process. The client keeps the latest snapshot in memory and evaluates flags locally.
import { FeatureGateClient } from "@featuregate/server";
export const featuregate = new FeatureGateClient({
runtimeApiKey: process.env.FEATUREGATE_RUNTIME_KEY!,
syncMode: "streaming",
});
await featuregate.waitForReady({ timeoutMs: 2_000 });Evaluate a flag
Every evaluation includes a production-safe default. FeatureGate returns that default before the first snapshot loads, if the flag is missing, or if the stored value does not match the typed helper.
const enabled = featuregate.isEnabled("new-checkout", {
defaultValue: false,
attributes: {
user: { id: "user_123" },
account: { plan: "pro" },
},
});For browser or React applications, create a publishable client key, add exact allowed origins, and mark each flag environment config as client-exposed before using the Browser or React SDK.