1. Install the zero-dependency evaluator
Switchboard ships native ESM with strict TypeScript definitions and no transitive packages.
Terminal
npm install @switchboard/edge Switchboard ships native ESM with strict TypeScript definitions and no transitive packages.
npm install @switchboard/edge Pass your compiled edge snapshot and request context. Evaluation executes synchronously with zero network I/O.
import { createEvaluator } from "@switchboard/edge";
import snapshot from "./switchboard.snapshot.json";
const flags = createEvaluator(snapshot, { verifySignature: true });
export default {
fetch(request: Request) {
const userId = request.headers.get("x-user-id") ?? "anonymous";
const enabled = flags.bool("checkout_v3_flow", {
key: userId,
region: request.headers.get("cf-ipcountry") ?? "US",
});
return Response.json({ checkoutV3: enabled });
},
}; Commit guardrail policies alongside application code so every rollout stage verifies error budgets.
flag "checkout_v3_flow" {
rollout = 35
salt = "sb_9042_v3"
guardrail "checkout_5xx" {
metric = "http.checkout.5xx_rate"
max_value = 0.004
window = "60s"
on_breach = "rollback_previous_snapshot"
}
}