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. Its compressed-size budget, real-browser behavior, and fresh-project tag-loader installation are enforced in CI.

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();
}

The manifest origin must also expose tenant public keys at /.well-known/jwks/{tenantId} (or pass manifestJwksUrl). init() verifies the strict schema, content hash, Ed25519 signature, and active key before returning a client. It fails closed when verification cannot be completed.

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