Install Flaggr SDK and configure your development environment
Last updated November 21, 2026
Installation
TypeScript / JavaScript
Install the Flaggr SDK:
npm install @flaggr/sdkThe SDK includes:
- Core client —
createFlaggr, with remote evaluation (poll), batched refreshes (batch), or streaming with local evaluation (stream) - React hooks —
@flaggr/sdk/react:FlaggrProvider,useBooleanFlag,useStringFlag,useNumberFlag,useObjectFlaganduseFlag - OpenTelemetry plugin —
@flaggr/sdk/otel - Browser telemetry plugin —
flaggrTelemetry(), which links Web Vitals and errors to flag variants - Script-tag bundle —
https://cdn.flaggr.dev/sdk.js, for pages without a bundler
Use 0.5.0 or later: 0.4.0 fails to load as an ES module. See TypeScript SDK for details, the script tag and every option.
Go and Python
Flaggr's Go and Python SDKs evaluate flags through Flaggr's evaluation API:
| Language | Install |
|---|---|
| Go | go get github.com/flaggr-dev/flaggr-go@latest (guide) |
| Python | pip install "flaggr @ git+https://github.com/flaggr-dev/flaggr-python@v0.1.1" (guide). It isn't on PyPI yet |
Other Languages (OpenFeature)
Flaggr is compatible with the OpenFeature standard. Any OpenFeature SDK evaluates Flaggr flags with its OFREP provider, which talks to Flaggr's OFREP endpoint. Java uses this route, and so can code in other languages that already uses OpenFeature:
| Language | Packages |
|---|---|
| Java | dev.openfeature:sdk and dev.openfeature.contrib.providers:ofrep (guide) |
| Python with OpenFeature | pip install openfeature-sdk openfeature-provider-ofrep (guide) |
| Go with OpenFeature | go get github.com/open-feature/go-sdk github.com/open-feature/go-sdk-contrib/providers/ofrep (guide) |
| Node.js with OpenFeature | npm install @openfeature/server-sdk @openfeature/ofrep-provider (guide) |
Configuration
Environment Variables
The SDK's global client (flag() without configure()) and FlaggrProvider without props read these from process.env:
| Variable | Description | Required |
|---|---|---|
FLAGGR_SERVICE_ID | Your service identifier | Yes |
FLAGGR_API_KEY | API token for authentication | Yes with the default FLAGGR_API_URL: the data plane refuses requests without a token. Only https://flaggr.dev evaluates isPublic flags without one |
FLAGGR_ENVIRONMENT | Target environment (development, staging, production) | No (the data plane uses production without one) |
FLAGGR_API_URL | Flaggr API endpoint | No (defaults to https://api.flaggr.dev) |
Each also works with a NEXT_PUBLIC_ prefix. From 0.5.0, Next.js inlines the NEXT_PUBLIC_ values set at build time into browser bundles. 0.4.0 looks them up at run time and finds none there, so with 0.4.0 pass the values to configure() or FlaggrProvider yourself.
Update Modes
| Mode | Description | Best For |
|---|---|---|
poll (default) | Each evaluation asks the data plane once its cached value has expired | Servers, simple setups |
batch | On an interval, every flag the client has cached or watches is refreshed, up to 100 flags per request | Many flags, fewer requests |
stream | Flag configurations pushed over SSE, evaluated locally | Low latency, live updates |
See Provider Architecture for how to choose.