SDK Reference
The runtime SDK evaluates flags locally, in-memory. Flag checks take microseconds and never touch the network. If the service is unreachable, the SDK returns your default values — your app never breaks because of us.
Installation
Section titled “Installation”pnpm add @shipdit/sdkInitialization
Section titled “Initialization”import { createClient } from "@shipdit/sdk";
const flags = await createClient({ sdkKey: process.env.YOURFLAGS_SDK_KEY!,});Evaluating Flags
Section titled “Evaluating Flags”// Boolean flagsif (flags.isEnabled("my-first-flag")) { // new behavior}
// Variant flags (type-safe from generated types)const variant = flags.getVariant("search-variant");// ^? "control" | "semantic" | "hybrid"
// With evaluation context (required for targeting rules)flags.isEnabled("beta-feature", { userId: user.id, plan: user.plan,});Defaults and Failure Modes
Section titled “Defaults and Failure Modes”Every evaluation accepts an implicit or explicit default. The SDK never throws on a flag check:
- Service unreachable → default returned
- Flag not found → default returned, warning event reported
- Malformed update → last known good state retained
Shutdown
Section titled “Shutdown”await flags.close(); // flushes analytics, closes connectionsFramework Adapters
Section titled “Framework Adapters”Coming soon: @shipdit/react.