• Start

Languages

/

Kotlin

Installation

The SurrealDB SDK for Kotlin is published to Maven Central and can be installed using Gradle or Maven.

The SurrealDB SDK for Kotlin is distributed through Maven Central under the com.surrealdb group. You can add it to your project using Gradle or Maven.

The SDK is a Kotlin Multiplatform library built with Kotlin 2.1.x. It supports the following targets:

TargetRequirement
JVMJava 11 or later
AndroidminSdk 26 or later, Java 11
iOSiosX64, iosArm64, iosSimulatorArm64

It depends on Kotlin Coroutines, kotlinx.serialization, kotlinx.datetime, and Ktor for transport. Embedded (in-process) databases are intentionally not included in this release; connect to a running SurrealDB instance over WebSocket or HTTP instead.

For a Kotlin Multiplatform project, add the metadata artifact com.surrealdb:kotlin to your commonMain source set. For a single-platform project, you may instead depend on the platform-specific variant (kotlin-jvm, kotlin-android, kotlin-iosarm64, kotlin-iossimulatorarm64, or kotlin-iosx64).

val surrealdbVersion = "0.1.0-SNAPSHOT"

dependencies {
implementation("com.surrealdb:kotlin:$surrealdbVersion")
}

After installing, import the client from the com.surrealdb.kotlin package.

import com.surrealdb.kotlin.SurrealClient
import com.surrealdb.kotlin.SurrealClientConfig

Was this page helpful?