Client-Side Setup
Integrate with your Backend
The PowerSync ‘backend connector’ provides the connection between your application backend and the PowerSync client-slide managed SQLite database.
It is used to:
- Retrieve a JWT token which can be used by the PowerSync Client SDK to authenticate against your PowerSync Service instance.
- 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:
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.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.
Was this page helpful?