This guide takes about five minutes. You need Node.js 18 or newer and a Shoal account.
-
Create a project
In the dashboard, click New project and give it a name. Shoal creates two environments for you —
developmentandproduction— each with its own SDK key. -
Install the SDK
Terminalnpm install @shoal/sdkTerminalpnpm add @shoal/sdkTerminalyarn add @shoal/sdkTerminalbun add @shoal/sdk -
Add your key
Copy the server key for
developmentfrom Project settings → Keys and add it to your environment:.env.localSHOAL_KEY=sk_dev_7f3a9c1e5b2d -
Create a flag
Create a boolean flag called
new-checkoutin the dashboard, or from your terminal:Terminalnpx shoal flags create new-checkout --type booleanTerminalpnpm dlx shoal flags create new-checkout --type booleanTerminalyarn dlx shoal flags create new-checkout --type booleanTerminalbunx shoal flags create new-checkout --type boolean -
Evaluate it
checkout.tsimport { createClient } from "@shoal/sdk"; const shoal = createClient({ key: process.env.SHOAL_KEY! }); export async function checkoutVariant(userId: string) { const on = await shoal.isOn("new-checkout", { user: { id: userId } }); return on ? "new" : "classic"; }Toggle the flag in the dashboard and call the function again — the result changes without a restart.