Skip to main content

Superposition OpenFeature Providers

OpenFeature provider implementations for Superposition, enabling feature flag management, context-aware configuration, and experimentation in multiple programming languages.

Featuresโ€‹

  • ๐Ÿšฉ Feature Flag Management โ€” Full OpenFeature compatibility for boolean, string, integer, float, and object flags
  • ๐ŸŽฏ Context-Aware Configuration โ€” Dynamic configuration based on user context and dimensions
  • โšก Multiple Refresh Strategies โ€” Polling and on-demand configuration fetching
  • ๐Ÿ”„ Real-time Updates โ€” Automatic configuration refresh with configurable polling
  • ๐Ÿ›ก๏ธ Error Handling โ€” Graceful fallbacks and stale data usage on errors
  • ๐Ÿงช Experimentation โ€” Built-in support for A/B testing and feature experiments
  • ๐Ÿ”Œ Pluggable Data Sources โ€” HTTP server, local files, or custom data sources

Supported Languagesโ€‹

LanguagePackageDocs
Rustsuperposition_providerRust Provider
Pythonsuperposition-providerPython Provider
JavaScriptsuperposition-providerJavaScript Provider
Javaio.juspay.superposition:openfeature-providerJava Provider
Haskellsuperposition-open-feature-providerHaskell Provider

Prerequisitesโ€‹

Before using any provider, ensure that:

  1. Superposition server is running โ€” See Quick Start
  2. Valid credentials are configured โ€” token, org_id, workspace_id
  3. Feature flags / default configs are set up in your Superposition workspace

Common Conceptsโ€‹

Provider Architectureโ€‹

All providers offer two approaches to flag evaluation:

VariantDescriptionWhen to Use
LocalResolutionProviderFetches config from a data source (HTTP server or local file), caches locally, and evaluates flags in-process. Recommended for most use cases.Production applications โ€” low latency, supports offline fallback, supports all refresh strategies
SuperpositionAPIProviderA stateless remote provider that calls the Superposition server on every evaluation. No local caching.Serverless, low-traffic, or always-latest requirements

The LocalResolutionProvider uses pluggable data sources (e.g. HttpDataSource, FileDataSource) and supports an optional fallback data source for resilient initialization.

Evaluation Contextโ€‹

All providers use an evaluation context โ€” a set of key-value pairs (dimensions) used to resolve the correct configuration:

  • targeting_key โ€” Used for experiment variant bucketing (typically a user ID)
  • Custom attributes โ€” Map to your Superposition dimensions (e.g. city, os, customers)

Refresh Strategiesโ€‹

Providers support multiple refresh strategies for keeping configuration up to date:

StrategyDescriptionAvailability
PollingPeriodically fetches config updates at a fixed intervalAll languages
On-DemandFetches on first access, then caches with a configurable TTLAll languages
WatchUses file-system notifications to reload on file changesRust only
ManualNo automatic refresh; user triggers refresh explicitlyRust only

Experimentationโ€‹

When experimentation options are configured, the provider will:

  1. Fetch running experiments from the server
  2. Use the targeting_key to determine which variant a user belongs to
  3. Apply experiment overrides to the resolved configuration

All providers support configurable ExperimentationOptions including refresh strategy, evaluation cache, and a default toss value.