Node / TypeScript
@flagctl/sdk — server evaluation, snapshot pull, override write.
Install
pnpm add @flagctl/sdk
Server evaluation
import { Flagctl } from '@flagctl/sdk';
const fc = new Flagctl({
token: process.env.FLAGCTL_TOKEN!,
project: 'acme/web',
});
const value = await fc.evaluate('checkout.v2', {
userId: 'u_812',
env: 'production',
});Snapshot pull
const snapshot = await fc.snapshot({ env: 'production' });
const value = snapshot.evaluate('checkout.v2', { userId: 'u_812' });The snapshot is the same artifact the SDK caches in-memory for sub-millisecond evaluation. Pull it once at boot, refresh on every push event.
Override write
await fc.overrides.set('checkout.v2', true, {
pr: 482,
ttlSeconds: 86400,
});