Announcing the Distilled Statsig SDK
Manage feature gates, experiments, metrics, and release workflows through Statsig's Console API from Effect.
Feature delivery becomes far more powerful when configuration is programmable: teams can create gates from infrastructure workflows, audit stale flags, coordinate staged rollouts, and keep experiment definitions synchronized. @kevinmichaelchen/distilled-statsig exposes Statsig’s Console API as 312 Effect-native operations.
Statsig, at a glance
Statsig provides feature gates, experimentation, product analytics, and release tooling. Its Console API is the CRUD surface behind actions offered in the Statsig console, enabling programmatic management of gates, experiments, metrics, segments, layers, reports, teams, and release pipelines. Statsig maintains its public documentation in statsig-io/docs.
Statsig
Console API docs
Distilled implementation
Official-spec mirror
20240601 OpenAPI document at an exact commit.Why Effect and Distilled?
Feature-management automation is policy automation. It deserves explicit failures, bounded retries, auditable inputs, and observable execution—especially when a script can enable a gate or start an experiment. Effect makes those controls composable. Distilled validates the API boundary, injects the Console API key as a redacted dependency, sends the pinned version header, decodes Statsig errors, and preserves retry guidance.
The type signature shows what an operation needs and how it can fail. That makes destructive or rollout-changing programs easier to review than a chain of loosely typed HTTP calls.
How we made the SDK
Pin Statsig's dated contract
20240601 OpenAPI document, matching the API-version header sent at runtime.Fix the shared seam
operationId on every route. The shared generator now derives stable names from tags and summaries and detects collisions.Generate the full Console API
Keep the vendor boundary small
Code Examples
Set STATSIG_API_KEY, then install:
npm install @kevinmichaelchen/distilled-statsig effectpnpm add @kevinmichaelchen/distilled-statsig effectbun add @kevinmichaelchen/distilled-statsig effectimport * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
import {
CredentialsFromEnv,
experimentsListExperiments,
gatesCreateGate,
gatesListGates,
} from "@kevinmichaelchen/distilled-statsig";
const StatsigLive = Layer.mergeAll(FetchHttpClient.layer, CredentialsFromEnv);
Audit temporary feature gates
List temporary gates for a cleanup report or ownership review.
const temporaryGates = gatesListGates({
type: "TEMPORARY",
includeArchived: "false",
limit: 100,
});
const auditTemporaryGates = temporaryGates.pipe(Effect.provide(StatsigLive));
Create a feature gate
Provision a disabled temporary gate that can move through review and rollout policy before receiving traffic.
const createCheckoutGate = gatesCreateGate({
id: "checkout-redesign",
name: "Checkout redesign",
description: "Controls the new checkout experience.",
type: "TEMPORARY",
isEnabled: false,
tags: ["checkout", "web"],
idType: "userID",
}).pipe(Effect.provide(StatsigLive));
List active experiments
Build an experiment inventory for dashboards, governance, or automated health checks.
const listActiveExperiments = experimentsListExperiments({
status: "active",
fields: ["id", "name", "status", "teamID", "createdTime"],
limit: 100,
}).pipe(Effect.provide(StatsigLive));
The same package can manage rules and overrides, retrieve pulse results, and coordinate release pipelines—without changing runtime conventions.
Because Statsig omits operation IDs, Distilled derives these names from tags and summaries. The shared generator normalizes them to lower camelCase while retaining collision detection and deterministic output.
Available now
Read the Statsig SDK guide, inspect the implementation, or install @kevinmichaelchen/distilled-statsig.