SDKs
One integration, five platforms
The SDKs are open-source and ship in this repository. Public registry releases (npm, pub.dev, Maven Central, SPM, NuGet) are planned but not shipped yet — today you vendor via a local path or project reference.
Beta · local source only
Source lives in this repo as @ctrlapp/sdk. No public npm release yet — vendor via the documented local path.
Install (local)
// package.json
"@ctrlapp/sdk": "file:../packages/ctrl-sdk"Initialize · read · track
import { Ctrl } from "@ctrlapp/sdk";
const ctrl = Ctrl.init({
apiKey: "ck_sdk_...",
deviceId: getOrCreateDeviceId(),
platform: "web",
});
await ctrl.register(); // ensures the device exists server-side
await ctrl.load(); // resolved controls map
ctrl.startPolling(); // background refresh (default 60s)
if (ctrl.flag("checkout_v2").isOn) showNewCheckout();
ctrl.track("checkout_v2", "impression");See full docs for per-type reads, streaming, and offline behavior.
Behavior
Same contract, platform-appropriate lifecycle
| Aspect | Web / .NET | Flutter / iOS / Android |
|---|---|---|
| Sync cadence | Poll (default 60s) + SSE stream when supported | Poll + SSE stream; app foreground triggers refresh |
| Offline cache | Browser localStorage / on-disk JSON | Platform-native persistent store |
| Screen capture | Best-effort visual mask | OS-level (FLAG_SECURE / iOS masking) |
| Public REST endpoints | /register, /session, /sync, /controls (+ delta / SSE stream), /controls/events, /flags/ruleset, /flags/impressions | |
Vendor the SDK, create an account, ship a control.
Each SDK exposes a small, identical surface: initialize, read a flag, track an event.