Skip to content
Shoal
Shoal

Guides

Migrating from v1

Every breaking change between v1 and v2, with before-and-after code.

Version 2 is a smaller, faster SDK with typed flags and rule-based targeting. Most apps migrate in under an hour.

Update the package

The package moved from shoal-js to @shoal/sdk.

Terminal
npm uninstall shoal-js && npm install @shoal/sdk

Client creation

TypeScript
import Shoal from "shoal-js";
const client = new Shoal(process.env.SHOAL_KEY, { refresh: 60 });
import { createClient } from "@shoal/sdk";
const client = createClient({ key: process.env.SHOAL_KEY!, pollInterval: 60_000 });

Renamed methods

  • client.enabled(key, user) → client.isOn(key, { user })
  • client.get(key, user, fallback) → client.variation(key, { user }, fallback)
  • client.all(user) → client.bootstrap(keys, { user })
  • refresh (seconds) → pollInterval (milliseconds)

Targeting

v1 targeted users by allow-lists only. In v2, existing lists become individual targets automatically, and you can add rules on top.

Was this page helpful?

Type to search. Results come from a local index — nothing leaves your browser.

↑ ↓ to navigate↵ to openMiniSearch · local