Back to docsRecipe

Feature flag patterns

Ship features dark, test in production, and decouple deploy from release using Meridian's built-in flag engine.

Kill switch

Wrap any code path with a single boolean flag. Flip it in the dashboard to disable a feature globally without a redeploy.

if (await meridian.isEnabled("checkout-v2")) {
  // new flow
}

Percentage rollout

Expose a feature to a random slice of users. Increase the percentage as confidence grows.

meridian.rollout("ai-suggestions", 10); // 10%

Targeting rules

Enable a flag for specific user IDs, email domains, or license tiers. Combine rules with AND/OR logic.

{
  "key": "beta-dashboard",
  "targets": [
    { "attr": "email", "op": "endsWith", "val": "@getnimbus.net" }
  ]
}

Circuit breaker

Automatically disable a feature when error rate exceeds a threshold. Protects the rest of the system from cascading failures.

meridian.breaker("payment-provider", {
  threshold: 0.05,
  windowMs: 60_000
});

Flags are evaluated locally with zero latency. The SDK syncs rules every 30 seconds via a compressed delta. Read the SDK reference for full API details.