FeatureGate

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.

Private beta access

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 a project

Create or open a project in the console.

Add an environment

Add the standard environments or choose a custom environment key.

Create a flag

Create a boolean, string, number, or object flag.

Set the environment default

Configure the flag for the environment your application will read from. The default is what FeatureGate serves when no targeting rule matches.

Generate a runtime key

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.

Send an activation check

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 SDK

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.

terminal
sh
npm install @featuregate/server

FEATUREGATE_RUNTIME_KEY=fg_sk_test_0123456789abcdef0123456789abcdef0123456789abcdef
Keep runtime keys server-side

A 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.

featuregate.ts
ts
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.

checkout.ts
ts
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.