
Library for embedding NoSQL JSON document databases with features like SQL++ queries, observable entities, binary attachments, and data synchronization. Provides extensive API support for SQL++, key/value, full-text search, and peer-to-peer sync.
Kotlin Multiplatform library for Couchbase Lite
Kotbase pairs Kotlin Multiplatform with Couchbase Lite, an embedded NoSQL JSON document database. Couchbase Lite can be used as a standalone client database, or paired with Couchbase Server and Sync Gateway or Capella App Services for cloud to edge data synchronization. Features include:
Kotbase provides full Enterprise and Community Edition API support for Android and JVM (via Java SDK), native iOS and macOS (via Objective-C SDK), and experimental support for native Linux and Windows (via C SDK).
Add either the Community or Enterprise Edition dependency in the commonMain source set dependencies of your shared module's build.gradle.kts:
kotlin {
sourceSets {
commonMain.dependencies {
// Community Edition
implementation("dev.kotbase:couchbase-lite:3.2.4-1.2.0")
// or Enterprise Edition
implementation("dev.kotbase:couchbase-lite-ee:3.2.4-1.2.0")
}
}
}Note The Couchbase Lite Community Edition is free and open source. The Enterprise Edition is free for development and testing, but requires a license from Couchbase for production use. See Community vs Enterprise Edition.
Kotbase is published to Maven Central. The Couchbase Lite Enterprise Edition dependency additionally requires the Couchbase Maven repository.
repositories {
mavenCentral()
maven("https://mobile.maven.couchbase.com/maven2/dev/")
}Native platform targets should additionally link to the Couchbase Lite dependency native binary. See Supported Platforms for more details.
Targeting JVM running on Linux or native Linux, both require a specific version of the libicu dependency. (You will see
an error such as libLiteCore.so: libicuuc.so.71: cannot open shared object file: No such file or directory indicating
the expected version.) If the required version isn't available from your distribution's package manager, you can
download it from GitHub.
Kotbase documentation can be found at kotbase.dev, including getting started examples, usage guide, and API reference.
Kotbase's API aligns with the Couchbase Lite Java and Android KTX SDKs. Migrating existing Kotlin code can be
as straightforward as changing the import package from com.couchbase.lite to kotbase, with some exceptions:
File, URL, and URI APIs are represented as strings.Date APIs use Kotlin's Instant.InputStream APIs use kotlinx-io's Source.Executor APIs use Kotlin's CoroutineContext.ByteArrays or in platform-specific code.CouchbaseLite.init(). Initialization functions can still be called with custom
parameters in JVM and Android platform code.NSError may still leak
through on Apple platforms. Please report any occurrences that may
deserve addressing.Fragment subscript APIs are available in Kotbase, similar to Swift, Objective-C, and .NET.Kotbase includes some convenient extensions on top of Couchbase Lite's official API as additional library artifacts.
The KTX extensions include the excellent Kotlin extensions by MOLO17,
as well as other convenience functions for composing queries, mapping query results, creating documents, and observing
change Flows.
// Community Edition
implementation("dev.kotbase:couchbase-lite-ktx:3.2.4-1.2.0")
// or Enterprise Edition
implementation("dev.kotbase:couchbase-lite-ee-ktx:3.2.4-1.2.0")Kotbase Kermit is a Couchbase Lite custom logger which logs to Kermit. Kermit can direct its logs to any number of log outputs, including the console.
// Community Edition
implementation("dev.kotbase:couchbase-lite-kermit:3.2.4-1.2.0")
// or Enterprise Edition
implementation("dev.kotbase:couchbase-lite-ee-kermit:3.2.4-1.2.0")The paging extensions are built on Google's AndroidX Paging. Kotbase Paging provides a
PagingSource which performs
limit/offset paging queries based on a user-supplied database query.
// Community Edition
implementation("dev.kotbase:couchbase-lite-paging:3.2.4-1.2.0")
// or Enterprise Edition
implementation("dev.kotbase:couchbase-lite-ee-paging:3.2.4-1.2.0")NSInputStream interoperability @ObjCName, and/or @ShouldRefineInSwift
git config --global core.symlinks true.Kotlin Multiplatform library for Couchbase Lite
Kotbase pairs Kotlin Multiplatform with Couchbase Lite, an embedded NoSQL JSON document database. Couchbase Lite can be used as a standalone client database, or paired with Couchbase Server and Sync Gateway or Capella App Services for cloud to edge data synchronization. Features include:
Kotbase provides full Enterprise and Community Edition API support for Android and JVM (via Java SDK), native iOS and macOS (via Objective-C SDK), and experimental support for native Linux and Windows (via C SDK).
Add either the Community or Enterprise Edition dependency in the commonMain source set dependencies of your shared module's build.gradle.kts:
kotlin {
sourceSets {
commonMain.dependencies {
// Community Edition
implementation("dev.kotbase:couchbase-lite:3.2.4-1.2.0")
// or Enterprise Edition
implementation("dev.kotbase:couchbase-lite-ee:3.2.4-1.2.0")
}
}
}Note The Couchbase Lite Community Edition is free and open source. The Enterprise Edition is free for development and testing, but requires a license from Couchbase for production use. See Community vs Enterprise Edition.
Kotbase is published to Maven Central. The Couchbase Lite Enterprise Edition dependency additionally requires the Couchbase Maven repository.
repositories {
mavenCentral()
maven("https://mobile.maven.couchbase.com/maven2/dev/")
}Native platform targets should additionally link to the Couchbase Lite dependency native binary. See Supported Platforms for more details.
Targeting JVM running on Linux or native Linux, both require a specific version of the libicu dependency. (You will see
an error such as libLiteCore.so: libicuuc.so.71: cannot open shared object file: No such file or directory indicating
the expected version.) If the required version isn't available from your distribution's package manager, you can
download it from GitHub.
Kotbase documentation can be found at kotbase.dev, including getting started examples, usage guide, and API reference.
Kotbase's API aligns with the Couchbase Lite Java and Android KTX SDKs. Migrating existing Kotlin code can be
as straightforward as changing the import package from com.couchbase.lite to kotbase, with some exceptions:
File, URL, and URI APIs are represented as strings.Date APIs use Kotlin's Instant.InputStream APIs use kotlinx-io's Source.Executor APIs use Kotlin's CoroutineContext.ByteArrays or in platform-specific code.CouchbaseLite.init(). Initialization functions can still be called with custom
parameters in JVM and Android platform code.NSError may still leak
through on Apple platforms. Please report any occurrences that may
deserve addressing.Fragment subscript APIs are available in Kotbase, similar to Swift, Objective-C, and .NET.Kotbase includes some convenient extensions on top of Couchbase Lite's official API as additional library artifacts.
The KTX extensions include the excellent Kotlin extensions by MOLO17,
as well as other convenience functions for composing queries, mapping query results, creating documents, and observing
change Flows.
// Community Edition
implementation("dev.kotbase:couchbase-lite-ktx:3.2.4-1.2.0")
// or Enterprise Edition
implementation("dev.kotbase:couchbase-lite-ee-ktx:3.2.4-1.2.0")Kotbase Kermit is a Couchbase Lite custom logger which logs to Kermit. Kermit can direct its logs to any number of log outputs, including the console.
// Community Edition
implementation("dev.kotbase:couchbase-lite-kermit:3.2.4-1.2.0")
// or Enterprise Edition
implementation("dev.kotbase:couchbase-lite-ee-kermit:3.2.4-1.2.0")The paging extensions are built on Google's AndroidX Paging. Kotbase Paging provides a
PagingSource which performs
limit/offset paging queries based on a user-supplied database query.
// Community Edition
implementation("dev.kotbase:couchbase-lite-paging:3.2.4-1.2.0")
// or Enterprise Edition
implementation("dev.kotbase:couchbase-lite-ee-paging:3.2.4-1.2.0")NSInputStream interoperability @ObjCName, and/or @ShouldRefineInSwift
git config --global core.symlinks true.