FabricFabricExperiments
Getting started

Add the web SDK

Use the lightweight browser SDK to fetch manifests, assign users, and emit exposure events.

The web SDK is intentionally small and delivery-focused. At M5.1 it is about 1.78 KB gzipped and covered by real-browser tests plus a fresh-project tag-loader smoke (pnpm run smoke:new-project:browser).

import { init } from "@fabricorg/experiments-web";

const fx = await init({
  manifestUrl: "https://manifests-staging.example.com/acme/manifest",
  subjectId: currentUser.id,
  beaconEndpoint: "https://exposure-staging.example.com/v1/exposure",
});

const variantKey = fx.treatment("homepage-cta");
if (variantKey === "treatment") {
  renderNewCta();
}

Delivery contract

  • Fetch the current signed manifest.
  • Deterministically assign the user.
  • Keep sticky assignment across reloads.
  • Emit exposure once per client activation.
  • No-op safely for paused or malformed experiments.
  • Capture variant execution failures without breaking the page.

The SDK is not a full feature-flag platform. It is the delivery layer for governed experiments managed by the control plane.

On this page