Content Deep Dive

Evaluate feature flags locally in Node with the WorkOS runtime client

Blog post from WorkOS

Post Details
Company
Date Published
Author
Maria Paktiti
Word Count
1,607
Company Posts That Month
36
Language
English
Hacker News Points
-
Post removed?
No
Summary

WorkOS’s Node feature flags runtime client evaluates flags locally from in-memory configuration while synchronizing changes from the Dashboard in the background, avoiding remote calls on request paths and preventing large flag sets from consuming the 3,072-byte access-token claim budget. The alternative feature_flags access-token claim is suitable for small, stable sets of user-session-based flags and works across AuthKit-supported platforms, but updates only arrive after sign-in or session refresh and cannot serve jobs, webhooks, or other processes without a user session. The runtime client, available in @workos-inc/node version 12 or later and requiring Node 22.11+, should be created once at process startup, equipped with error handling, awaited for readiness when incorrect early evaluations are risky, and closed during shutdown. It evaluates flags using optional organization or user context, returns false or a supplied default for unknown flags, supports bootstrap data before its first synchronization, and refreshes configuration every 30 seconds by default with a five-second minimum interval. Operationally, recoverable sync errors preserve the last known configuration and retry with backoff, while a 401 triggers a failed event and stops syncing until valid credentials are used to recreate the client.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.