Skip to main content
@repo/feature-flags controls feature rollouts with boolean and multivariate flags. Supports per-user targeting, percentage-based rollouts, and A/B testing.

Usage

Server-side:
import { getFlag } from "@repo/feature-flags";

const showNewEditor = await getFlag("new-editor");
Client-side:
"use client";
import { useFlag } from "@repo/feature-flags";

const showBeta = useFlag("beta-features");

Defining Flags

import { defineFlags } from "@repo/feature-flags";

export const flags = defineFlags({
  "new-editor": {
    defaultValue: false,
    description: "Enable the new rich text editor",
  },
  "beta-features": {
    defaultValue: false,
    targeting: { percentage: 10 },
  },
});

Environment Variables

VariableDescription
FLAGS_SECRETSecret key for flag evaluation

Learn More