Skip to main content

Overview

Maya is wiring feature flags into Fieldkit’s web-app. In this guide she creates a boolean toggle called new-checkout, syncs it to production, and evaluates it in a Node process. Time: a few minutes. You need Node.js 20+ and a shipd account.

1. Install the CLI

2. Log in

The CLI opens /auth/device/code. Pick organization → project → environment (Maya picks fieldkitweb-appproduction). Approval stores a management API key in ~/.config/shipd/credentials.json.
CI does not use shipd login. Create a management API key in the dashboard and set SHIPD_API_KEY. See Push flags from CI.

3. Define the flag

Create shipd.config.ts next to package.json:
shipd.config.ts
shipdit is the SDK package. defineFlags lives at shipdit/config.

4. Push and generate types

shipd push diffs local definitions against the server, applies them, then writes src/generated/flags.ts.
Creating or updating a definition (type, variants, tags, lifecycle) needs production permission even when --env is staging. Defaults are per environment. See Environments.

5. Evaluate it

src/checkout.ts
Create the SDK key in the dashboard (sdkKey.create). Server keys look like shipd_sdk_server_…. The secret is shown once. A misspelled key is a TypeScript error:

Next

Define more flags

Variants, numbers, JSON — still in shipd.config.ts.

Evaluate in the browser

shipdit/client, polling, and WebSocket invalidation.

Target a user

identify, traits, and userId.

React

ShipdProvider + useFlag.