SDK Overview
@pluma-flags/sdk is the client SDK for evaluating feature flags from a
Pluma self-hosted feature flag server.
It fetches a flag snapshot from the Pluma API and evaluates flags locally — no round-trip per flag check. Supports per-subject targeting via allow/deny lists and deterministic rollout percentages.
Install
npm install @pluma-flags/sdk
# or
pnpm add @pluma-flags/sdkQuick start
import { PlumaSnapshotCache } from "@pluma-flags/sdk";
const client = PlumaSnapshotCache.create({
baseUrl: "http://localhost:2137",
token: "sdk_your_token_here", // Organisation → API Keys in the Pluma UI
ttlMs: 30_000, // optional; defaults to 30_000 ms
});
const evaluator = await client.evaluator({ subjectKey: "user-123" });
if (evaluator.isEnabled("my-feature")) {
// flag is enabled for this subject
}SDK tokens are scoped to a project and environment. Create them in the Pluma UI under Organisation → API Keys.
What’s next
- Express.js example — integrate Pluma into an Express app
- Next.js example — singleton setup with Server Components
- Targeting & Caching — per-subject evaluation, TTL cache, and parent flags
- API Reference — full method and options reference
Last updated on