Config, create a client, call getFeatureConfig to resolve the right value for a given hierarchy, and close the client when your process exits. All SDKs poll the Foff API in the background and serve reads from an in-memory cache, so flag lookups are always fast and never block your request path.
TypeScript
Install via npm. Requires Node.js 18+. Works with any Node.js framework.
Python
Install via pip. Requires Python 3.10+. Supports both sync and async clients.
Go
Install via go get. Requires Go 1.22.10+. Thread-safe with goroutine-based polling.
Minimum runtime requirements
| SDK | Minimum version |
|---|---|
| TypeScript | Node.js 18+ |
| Python | Python 3.10+ |
| Go | Go 1.22.10+ |
Common integration pattern
All three SDKs follow the same steps regardless of language.Create a Config
Supply your API key, the base URL, your scope name, and an optional polling interval (in seconds). The polling interval defaults to 30 seconds. Set it to
0 to disable polling.| Field | Required | Description |
|---|---|---|
APIKey | Yes | Your Foff API key. |
BaseURL | Yes | https://foff.twospoon.ai/live |
Scope | Yes | The scope to fetch configs for (e.g. production). |
PollingInterval | No | Seconds between background refreshes. Default: 30. |
Create a client
Pass your config to the SDK’s client constructor. The client validates your config, makes an initial blocking fetch of all configs for the scope, and starts a background polling loop.
Resolve flags with getFeatureConfig
Call
getFeatureConfig(featureName, orderedHierarchy) anywhere in your code. Pass the feature name and an ordered list of hierarchy values from least-specific to most-specific (e.g. ["org-1", "team-a", "user-123"]). The SDK resolves the most specific match and falls back to the default value if no override exists.API endpoint
All SDKs call a single endpoint to fetch configs:getFeatureConfig.
Hierarchy resolution
When you callgetFeatureConfig, the SDK resolves the value from most-specific to least-specific:
- It checks the full combination first — e.g.
org-1 + team-a + user-123. - It then tries shorter prefixes —
org-1 + team-a, thenorg-1. - If nothing matches, it returns the feature’s default value.
- If the feature doesn’t exist at all, it returns
null(ornil/Nonein Go and Python).
Store your API key in an environment variable such as
FOFF_API_KEY. Never hard-code it in source files or commit it to version control.