@featureflare/sdk-js
Runtime SDK for Node and browser contexts. Provides deterministic flag evaluation with cache, retry, stale fallback, bootstrap, and realtime update support.
More on this: React teams should layer this through @featureflare/react unless they need direct client control.
Install
pnpm add @featureflare/sdk-jsPackage page: npmjs.com/package/@featureflare/sdk-js
Primary API
- FeatureFlareClient constructor with apiBaseUrl, sdkKey, timeout/retry, cache, bootstrap, and realtime settings.
- bool(flagKey, user, defaultValue): fast boolean evaluation with fallback behavior.
- evaluate(flagKey, user, defaultValue): returns value plus diagnostics metadata.
- flags(user, defaultValue): bulk boolean map retrieval for a user context.
Minimal usage
import { FeatureFlareClient } from '@featureflare/sdk-js';
const client = new FeatureFlareClient({
sdkKey: process.env.FEATUREFLARE_SERVER_KEY
});
const enabled = await client.bool('new-nav', { id: 'user-123' }, false);Operational notes
- Cache-first order: fresh cache, stale cache with revalidate, bootstrap/persistent, then default.
- Kill-switch semantics win over positive evaluations.
- Realtime can use SSE with polling fallback for release-safe updates.
- Use server keys only in trusted server runtime.
Related docs
- @featureflare/react for provider/hooks integration.
- @featureflare/core for underlying evaluation model and rule semantics.