It is used to:

  1. Retrieve a JWT token which can be used by the PowerSync Client SDK to authenticate against your PowerSync Service instance.
  2. Upload writes to your backend: Writes that are made to the local SQLite database are sent to your backend application, where you control how they’re applied to your backend database (Postgres or MongoDB)

Accordingly, the connector must implement two methods:

  1. fetchCredentials() — This is called every couple of minutes and is used to obtain JWT credentials from your app backend API. See Authentication Setup for instructions on how the credentials should be generated.
  2. uploadData() — Use this to upload client-side changes to your app backend. See Writing Client Changes for considerations on the app backend implementation.

Example implementation

For an example implementation of a PowerSync ‘backend connector’, see the Getting Started section of the SDK reference for your platform:

Flutter

React Native & Expo

JavaScript Web

Kotlin Multiplatform

Swift

More Examples

For additional implementation examples, see the Example / Demo Apps section.