Node SDK
createFlagClient
Create the one client your process uses. It starts fetching the snapshot at once.
Create one client per process and share it, for example as a module singleton. It loads the cache file if you gave one, then fetches the snapshot from the delivery service and keeps polling.
Only sdkKey is required. Keep the server key on the server: it can read the environment’s full rules, segments and overrides.
createFlagClient(options: FlagClientOptions): FlagClientimport { createFlagClient } from '@rollkit/sdk';
export const flags = createFlagClient({
sdkKey: process.env.FLAGPILOT_SDK_KEY!,
baseUrl: process.env.FLAGPILOT_BASE_URL,
pollIntervalMs: 30_000,
cache: { file: '.flags-cache.json' },
onError: (err) => console.warn('flags:', err.message),
});The SDK is @rollkit/sdk in the repository (packages/sdk). It is for server-side Node; browsers use a client key with the delivery API.