powersync-kotlin

PowerSync is a sync engine for building local-first apps with instantly-responsive UI/UX and simplified state transfer. Syncs between SQLite on the client-side and Postgres, MongoDB or MySQL on the server-side.

PowerSync Kotlin Multiplatform SDK

This is the PowerSync client SDK for Kotlin Mutliplatform. This SDK currently supports Android and iOS as targets.

See a summary of features here.

Structure: Packages

Demo Apps / Example Projects

The easiest way to test the PowerSync KMP SDK is to run one of our demo applications.

Demo applications are located in the demos/ directory. See their respective README’s for testing instructions:

Current Limitations / Future work

Current limitations:

Installation

Add the PowerSync Kotlin Multiplatform SDK to your project by adding the following to your build.gradle.kts file:


kotlin {
    //...
    sourceSets {
        commonMain.dependencies {
            api("com.powersync:core:$powersyncVersion")
        }
        //...
    }
}

If want to use the Supabase Connector, also add the following to commonMain.dependencies:

    implementation("com.powersync:connector-supabase:$powersyncVersion")

Cocoapods

We recommend using Cocoapods (as opposed to SMP) for iOS targets. Add the following to the cocoapods config in your build.gradle.kts

cocoapods {
    //...
    pod("powersync-sqlite-core") {
        linkOnly = true
    }

    framework {
        isStatic = true
        export("com.powersync:core")
    }
    //...
}

Note: The linkOnly attribute is set to true and framework is set to isStatic = true to ensure that the powersync-sqlite-core binaries are only statically linked.

Formatting and Linting

This repo uses ktlint to handle formatting and linting. If you would like the IDE to automatically format your code and show linting errors install the ktlint plugin. Then in Settings go to Tools -> Ktlint -> Select Distract free (recommended) mode. It will automatically use the rules set in the .editorconfig file.

Getting Started

Our full SDK reference contains everything you need to know to get started implementing PowerSync in your project.

Examples

For example projects built with PowerSync and Kotlin Multiplatform, see our Demo Apps / Example Projects gallery. Most of these projects can also be found in the demos/ directory.