Overview
Jordan wires Fieldkit’s API to shipd. Flag checks are in-memory. The network is only for downloading the snapshot (evaluation payload) and optional realtime invalidation. This guide uses the flags from Define flags in code.Install
shipd_sdk_server_… and is shown once.
Server (Node, workers)
src/lib/shipd.ts
src/checkout.ts
ready() never rejects for network errors. On timeout it resolves anyway and you serve defaults until a snapshot arrives.
Browser
src/lib/shipd-browser.ts
anonymousId) in localStorage unless you pass persist: false.
Client and server keys currently receive the same targeting rules. Prefer server keys for backends. Client keys are safe to embed; reduced client snapshots come later.
Context on a check
userId, percentage rollouts cannot bucket — the user falls through. Set a default identity with identify.
Polling and realtime
GET /sdk/v1/snapshotwithIf-None-Match- 200 — replace the in-memory snapshot
- 304 — keep it
- Optional WebSocket
streamEndpoint→/sdk/v1/stream→ onsnapshot.updated, refetch - Poll every
refreshIntervalMs(default30_000) even if the socket is up
streamEndpoint for polling only. refreshIntervalMs: 0 fetches once.
If the edge is unreachable, the last good snapshot (or defaults) stays. Evaluation never throws.