SDKs
JavaScript SDK
Use the core client in any JavaScript or TypeScript application.
JavaScript SDK
The @openflagsdev/js package is the core integration point for JavaScript and TypeScript applications.
Create a client
import { createClient } from "@openflagsdev/js"
const flags = await createClient({
apiUrl: "http://localhost:4000",
project: "my-app",
userId: "user_123",
refreshIntervalMs: 60_000,
})Evaluate a flag
if (flags.isEnabled("new_checkout")) {
renderModernCheckout()
}Useful capabilities
- Synchronous
isEnabled()checks after the client has been created getAll()access when you need a full view of the current flag setrefresh()when your app wants to refetch flag data explicitly
Best practices
- Keep flag keys stable and descriptive.
- Pass a
userIdwhen targeting matters. - Prefer local evaluation for latency-sensitive application paths.