ZIO OpenFeature
A ZIO-native wrapper around the OpenFeature Java SDK for Scala 2.13 and Scala 3.
Why ZIO OpenFeature?
ZIO OpenFeature wraps the OpenFeature Java SDK, giving you access to the entire OpenFeature ecosystem while providing a type-safe, functional API designed for ZIO applications.
- Use Any Provider - Works with all OpenFeature providers: LaunchDarkly, Flagsmith, Flipt, flagd, and more
- Type Safety - Compile-time guarantees with the
FlagTypetype class - ZIO Native - Effect-based API with proper resource management
- Transactions - Scoped flag overrides with caching and evaluation tracking
- Testkit - In-memory provider for testing without external dependencies
Quick Example
import zio.*
import zio.openfeature.*
import dev.openfeature.contrib.providers.flagd.FlagdProvider
object MyApp extends ZIOAppDefault:
val program = for
enabled <- FeatureFlags.boolean("new-feature", default = false)
_ <- ZIO.when(enabled)(Console.printLine("Feature enabled!"))
yield ()
def run = program.provide(
Scope.default >>> FeatureFlags.fromProvider(new FlagdProvider())
)
Documentation
| Section | Description |
|---|---|
| Getting Started | Installation and basic usage |
| Architecture | Core design and components |
| Providers | Using OpenFeature providers |
| Evaluation Context | Targeting and context hierarchy |
| Hooks | Cross-cutting concerns |
| Transactions | Flag overrides and tracking |
| Testkit | Testing utilities |
| Spec Compliance | OpenFeature specification compliance |
Modules
| Module | Description |
|---|---|
| core | ZIO wrapper around OpenFeature SDK |
| testkit | In-memory provider for testing |
Requirements
- Scala 2.13+ or Scala 3.3+
- ZIO 2.1+
License
ZIO OpenFeature is distributed under the Apache 2.0 License.