Client-Side Setup

Include the PowerSync SDK in your project

The next step after configuring your database and connecting it to PowerSync is to include the appropriate PowerSync client SDK package in your app project. On a high level, this involves the following steps:

  1. Install the SDK (see below).

  2. Integrate with your Backend [Optional]

    1. Download data from your database

    2. Write mutations to your backend

PowerSync currently supports apps built in Flutter, React Native & Expo, JS Web, Kotlin (public alpha), and Swift (private alpha). Please see the steps based on your type of app:

Add the PowerSync pub.dev package to your project:

flutter pub add powersync

See the full SDK reference for further details and getting started instructions:

Flutter

PowerSync is not compatible with Expo Go. PowerSync uses a native plugin and is therefore only compatible with Expo Dev Builds.

Add the PowerSync React Native NPM package to your project:

Run the below command in your project folder:

npm npx expo install @powersync/react-native

Some peer dependencies and polyfills are required

This SDK connects to a PowerSync instance via HTTP streams (default) or WebSockets. Different polyfill configurations are required for each method.

  • See the Readme for the necessary peer dependencies and polyfills.

    • Also see this section for additional development requirements on Android and iOS.

See the full SDK reference for further details and getting started instructions:

React Native & Expo

Add the PowerSync JS Web NPM package to your project:

npm install @powersync/web

Some peer dependencies are required.

See the Readme for the necessary peer dependencies that need to be installed.

This SDK connects to a PowerSync instance via HTTP streams (default) or WebSockets.

  • When connecting via WebSocket, a polyfill is also required.

See the full SDK reference for further details and getting started instructions:

JavaScript Web

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

kotlin {
    //...
    sourceSets {
        commonMain.dependencies {
            api("com.powersync:core:$powersyncVersion")
            // If you want to use the Supabase Connector, also add the following:
            implementation("com.powersync:connectors:$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.

See the full SDK reference for further details and getting started instructions:

Kotlin Multiplatform (Alpha)

Next Steps

For an overview of the client-side steps required to set up PowerSync in your app, continue reading the next sections.

For a walkthrough with example implementations for your platform, see the Getting Started section of the corresponding SDK reference linked above.

Last updated