ff4k
0.3.0indexedFeature-flagging toolkit with type-safe properties, DSL configuration, serialization support, custom stores, auto-create behavior, conditional ifEnabled helpers, group management, and extensible property retrieval.
Feature-flagging toolkit with type-safe properties, DSL configuration, serialization support, custom stores, auto-create behavior, conditional ifEnabled helpers, group management, and extensible property retrieval.
FF4K is a Kotlin Multiplatform port of the ideas behind FF4J (Feature Flipping for Java): feature flags, flipping strategies and typed properties behind a small, coroutine-first API. The JVM target ships today; other Kotlin targets can be added from the same common code.
Alpha. FF4K is pre-1.0. Public APIs, the JSON format and store schemas change between releases without a deprecation cycle.
dependencies {
implementation(platform("com.yonatankarp:ff4k-bom:<version>"))
implementation("com.yonatankarp:ff4k-core")
}
import com.yonatankarp.ff4k.*
com.yonatankarp.ff4k.strategy.*
ff4k = FF4k()
ff4k.features.put(Feature(, enabled = , group = ))
ff4k.features.put(
Feature(
id = ,
enabled = ,
strategy = ContextFilterStrategy(, setOf()) and UserPercentageStrategy(),
),
)
ff4k.properties.put(Property(, ))
(ff4k.check()) enableDarkMode()
ff4k.check(, mapOf( to , to user.id))
retries: ? = ff4k.property()
ff4k.features.disableGroup()
Features and properties can also be loaded from JSON:
val ff4k = FF4k(FF4kConfiguration.fromJson(File("ff4k.json").readText()))
Stores are pluggable: ff4k-core ships in-memory stores, ff4k-store-jdbc persists to PostgreSQL or MySQL on any DataSource, and ff4k-store-sqlite to SQLite through SQLDelight. Wrap a database store with cached() to keep flag checks off the database. Implement FeatureStore and for anything else and verify it with .
See the documentation for strategies, configuration and custom stores.
Contributions are welcome! Please read our Contributing Guidelines before submitting a pull request.
To report a security vulnerability, please see our Security Policy.
This project is licensed under the Apache License 2.0.
{
"features": [
{ "id": "dark-mode", "enabled": true, "group": "ui" },
{ "id": "beta-checkout", "enabled": true,
"strategy": { "type": "contextFilter", "key": "region", "allowed": ["eu"] } }
],
"properties": [
{ "name": "max-retries", "type": "int", "value": 3 }
]
}
PropertyStoreff4k-contract-testSurfaced from shared tags and platforms — no rankings paid for.