Sqkon
Type-safe JSONB-powered key-value store for Kotlin Multiplatform.
Install
// build.gradle.kts
dependencies {
implementation("com.mercury.sqkon:library:{{ site.sqkon_version }}")
}
30-second taste
Android needs a Context; JVM needs a CoroutineScope. See Platform setup for both.
@Serializable
data class Merchant(
val id: String,
val name: String,
val category: String,
)
// Android needs a Context + scope; JVM needs a scope only.
val sqkon = Sqkon(context = applicationContext, scope = appScope)
val merchants = sqkon.keyValueStorage<Merchant>("merchants")
// Insert (sync) — Sqkon dispatches the SQLite work internally.
merchants.insert("m_1", Merchant("m_1", "Chipotle", "Food"))
// Observe — emits whenever the store changes. Collect from a coroutine.
appScope.launch {
merchants.selectAll().collect { list ->
println("Now have ${list.size} merchants")
}
}
// One-shot reads use Flow.first() inside a suspend block.
suspend fun loadFood(): List<Merchant> =
merchants.select(where = Merchant::category eq "Food").first()
Why Sqkon?
Kotlin Multiplatform
One codebase, Android + JVM. iOS on the roadmap.
JSONB queries
Query nested fields and lists with a type-safe DSL — no manual SQL, no DAOs.
Reactive Flows
Every read returns a
Flow. Writes auto-invalidate observers.
AndroidX Paging
Built-in keyset and offset PagingSources for Compose and views.
TTL / Expiry
First-class expiry on every entry. Perfect for caches.
Built on SQLDelight
Battle-tested SQLite, with type-safe codegen underneath.