Feature flag SDKs and OpenFeature providers - Featurevisor
Featurevisor

Evaluate in your application

SDKs

An SDK evaluates features and variables inside your application, from a datafile it holds in memory and the context you pass. No decision needs a network request.

How evaluation works

Your application fetches a datafile, creates an SDK instance with it, and asks for values with a context. In JavaScript:

your-app/index.js
import { createFeaturevisor } from '@featurevisor/sdk'
const f = createFeaturevisor({
datafile: datafileContent,
})
const context = {
userId: 'user-4',
country: 'nl',
}
f.isEnabled('checkout', context)
f.getVariation('pricing', context)
f.getVariable('buyButton', 'label', context)
f.getVariable('supportEmail', context)

isEnabled reads a flag and getVariation a variation. getVariable reads a feature variable when given a feature and a variable key, and a global variable when given one key. For user-4, a Dutch user, they return:

CallReturns for user-4
isEnabled('checkout')true
getVariation('pricing')'control'
getVariable('buyButton', 'label')'Nu kopen'
getVariable('supportEmail')'[email protected]'

Other languages have the same calls with their own naming, and some read global variables with a separate method.

Create one instance and reuse it. When a newer datafile arrives, give it to the same instance, as Deployment describes. Check your SDK's datafile API for whether an update merges or replaces, since a merge keeps definitions the new file left out.

The SDK makes no network requests. The context you pass, such as a user's country or plan, stays in your application unless your own code sends it somewhere.

A datafile in a browser or a mobile app can be read by its users. Keep secrets out of it.

Choose an SDK

LanguageInstall
JavaScriptnpm install @featurevisor/sdk@^4.0.0
Gogo get github.com/featurevisor/featurevisor-go/[email protected]
Pythonpip install 'featurevisor>=4.0.0,<5.0.0'
PHPcomposer require featurevisor/featurevisor-php:^4.0.0
Rubygem install featurevisor -v '~> 4.0'
JavaMaven, from GitHub Packages. See Installation.
SwiftSwift Package Manager. See Installation.
Rustcargo add [email protected]
ElixirMix. See Installation.

Frameworks

Framework guides build on the JavaScript SDK, with helpers that fit each framework:

OpenFeature

If your application already uses OpenFeature, a Featurevisor provider plugs into it. Providers exist for Node.js, browsers, Go, Swift, Java and Kotlin, Ruby, Python, PHP, Rust and Elixir. They are optional. See OpenFeature.

Previous
Promotions