Evaluate flags at runtime
Two ways, both standard OpenFeature — pick by language:
| Path | For | Eval runs | Resilience |
|---|---|---|---|
| In-process provider (recommended) | JS / TS | inside your app, from memory | control plane down → fine; storage down after load → last-known-good |
| OFREP (remote) | any language | on the server, over HTTP | run the standalone next to your app + ETag/304 caching |
In-process — JS/TS, memory-first (recommended)
Section titled “In-process — JS/TS, memory-first (recommended)”import { OpenFeature } from "@openfeature/server-sdk";import { createOpenFeatureProvider } from "@xtandard/flags/openfeature";import { createRedisStorage } from "@xtandard/flags/storage/redis";
OpenFeature.setProvider( createOpenFeatureProvider({ projectKey: "default", environmentKey: "production", storage: createRedisStorage({ url: process.env.REDIS_URL!, prefix: "flags:runtime" }), refreshIntervalMs: 10_000, }),);
const client = OpenFeature.getClient();const theme = await client.getStringValue("theme", "normal", { targetingKey: user.id, country: user.country, plan: user.plan,});After the first load the provider serves from memory. If the admin panel goes
away, evaluation is unaffected. If storage goes down after the first load, the
provider keeps serving the last-known-good snapshot (marked stale). Missing
flags return the caller’s default with FLAG_NOT_FOUND. The evaluator is pure and
never throws — invalid config falls back to the caller default with ERROR. This
is the path to use for JS/TS services.
Any language — OFREP (remote evaluation)
Section titled “Any language — OFREP (remote evaluation)”Go, Python, Rust, Java, .NET, … evaluate over OFREP, the OpenFeature Remote Evaluation Protocol — a standard HTTP contract. Point any OpenFeature SDK’s generic OFREP provider at your panel; there’s no vendor library to write or install.
# pip install openfeature-sdk openfeature-provider-ofrepfrom openfeature import apifrom openfeature.contrib.provider.ofrep import OFREPProvider
api.set_provider(OFREPProvider(base_url="https://flags.example.com"))enabled = api.get_client().get_boolean_value("new-checkout", False, ctx)The panel serves OFREP bulk + single evaluation with ETag/304 caching and an
opt-in SSE stream for live updates. Runnable clients (Python / Go / plain TS) are
in examples/ofrep-clients (bun run examples:ofrep-clients);
full details in docs/OPENFEATURE.md.
Which should I use? For JS/TS, prefer the in-process provider above — it’s memory-first and keeps working if the control plane is down. OFREP puts the server in the request path, so for the same resilience run the standalone server next to your app and lean on ETag/304 caching.