Skip to content

OpenFeature SDK

Last updated View as MarkdownAgent setup

Evaluate Flagship feature flags using OpenFeature.

OpenFeature ↗︎ is the CNCF standard for feature flag interfaces. It provides a vendor-neutral API so you can switch between flag providers without changing evaluation code.

Flagship provides official OpenFeature-compatible SDKs for TypeScript, Python, Go, and Rust. The source code is available on GitHub ↗︎.

SDK Package Runtime Evaluation modes
TypeScript @cloudflare/flagship ↗︎ Workers, Node.js, browsers Workers binding, HTTP, browser prefetch cache
Python cloudflare-flagship ↗︎ Python server applications HTTP
Go github.com/cloudflare/flagship/sdks/go ↗︎ Go server applications HTTP
Rust cloudflare-flagship ↗︎ Async Rust server applications HTTP, local evaluation

SDKs

Flagship SDKs are organized by language. The TypeScript SDK has separate setup guides for server-side and browser usage because they use different OpenFeature packages and runtime behavior.

  • TypeScript Server SDK — For Workers, Node.js, and other server-side JavaScript runtimes.
  • TypeScript Client SDK — For browser applications that need synchronous OpenFeature web SDK evaluation.
  • Python SDK — For Python server applications.
  • Go SDK — For Go server applications.
  • Rust SDK — For async Rust server applications.

Context support

The TypeScript, Python, and Go SDKs support structured context from version 0.6.0. The Rust SDK supports it in all versions. Context support depends on the evaluation client and transport:

Client or API Context support
Direct Workers binding Recursive JSON values; valid Date values normalize to strings
TypeScript server provider Recursive JSON values and Date, with binding or HTTP evaluation
TypeScript client provider Recursive JSON values and Date
Python provider Recursive JSON values and datetime
Go provider Recursive JSON values and time.Time
Rust provider Recursive JSON values and OpenFeature date-time values
Wrangler String values from each --context argument
Evaluation API POST Recursive JSON values

The SDKs send structured context over HTTP using POST. Context containing only strings, numbers, booleans, or dates uses GET query parameters. Dates normalize to strings, including within nested objects and arrays.

Use the evaluation API POST endpoint when sending structured context without an SDK.

Installation

For TypeScript server-side usage:

npm i @cloudflare/flagship @openfeature/server-sdk

For TypeScript browser usage:

npm i @cloudflare/flagship @openfeature/web-sdk

For Python:

uv add cloudflare-flagship

For Go:

go get github.com/cloudflare/flagship/sdks/go

For Rust:

cargo add cloudflare-flagship

Next steps

  • Set up the server provider for Workers, Node.js, or other server-side runtimes.
  • Set up the client provider for browser applications.
  • Set up the Python SDK for Python server applications.
  • Set up the Go SDK for Go server applications.
  • Set up the Rust SDK for async Rust server applications.

Was this helpful?