Killswitches (`getKillswitch`)
A killswitch is an operational on/off control that ships in the same KV blob as gates and configs. It is not user-bound — it answers a global "is this…
/docs/ — also served raw at https://shipeasy-ai.github.io/sdk-ts/pages/killswitches.md.A killswitch is an operational on/off control that ships in the same KV blob as gates and configs. It is not user-bound — it answers a global "is this killed?" question.
Read a killswitch
import { configure, Client } from "@shipeasy/sdk/server"; // or /client
configure({ apiKey: process.env.SHIPEASY_SERVER_KEY! });
const flags = new Client(req.user);
if (flags.getKillswitch("payments")) {
// the "payments" killswitch is KILLED — short-circuit the feature
return showMaintenanceNotice();
}getKillswitch(name) returns true when the killswitch is killed as a whole,
false otherwise (including for an unknown killswitch).
Named switches
A killswitch can carry per-key override switches — each named switch is
configured on the killswitch in the dashboard and holds its own boolean. Pass
the variable you want to gate as the switchKey to read that one switch:
flags.getKillswitch("checkout", "apple_pay"); // reads the "apple_pay" switchThe fallback contract (shared across every Shipeasy SDK): a configured switch
key returns that switch's own value; an unconfigured switch key falls back to
the killswitch's top-level killed value. So calling
getKillswitch(name, variable) is always safe — before anyone publishes a
per-key override for variable, it simply tracks the whole killswitch.
// "apple_pay" not yet configured on the "checkout" killswitch:
flags.getKillswitch("checkout", "apple_pay"); // === flags.getKillswitch("checkout")Browser facade
In the browser, the top-level facade also exposes the short alias ks(...),
which is SSR-bootstrap aware (reads the hydrated bootstrap value synchronously
on first render):
import { ks } from "@shipeasy/sdk/client";
if (ks("payments")) { /* killed */ }Dynamic configs (`getConfig`)
A dynamic config is a typed JSON value (with targeting) you read at runtime — remote config without a deploy.
Error reporting (`see()`)
see (shipeasy error) is the structured error reporter. Every handled exception documents its product consequence, not just its stack. It works in vanilla JS…