PowerSync Overview
Sync Engine for Local-First & Offline-First Apps
PowerSync is a service and set of client SDKs that keeps backend databases in sync with on-device embedded SQLite databases.
It enables local-first & offline-first apps with instantly-responsive UIs that remain available even when network connectivity is poor or non-existent.
For a general overview of how PowerSync works, continue reading.
For quick start options, see our Quickstart Guide.
Supported Backend Databases
PowerSync is designed to be backend database agnostic and currently supports:
Supported Client SDKs
PowerSync is designed to be client-side stack agnostic, and currently has client SDKs available for:
Kotlin Multiplatform (beta)
Swift (alpha)
See our Examples / Demo Apps for reference implementations and example code snippets.
Roadmap
PowerSync is designed to support any combination of backend database and frontend software framework, with additional backend database support and SDKs on the way.
Authentication
Before using PowerSync, an application's existing architecture may look like this:
The PowerSync Service uses database native credentials and authenticates directly against the backend database using the configured credentials:
When the PowerSync client SDK is included in an app project, it uses existing app-to-backend authentication to retrieve a JSON Web Token (JWT):
The PowerSync client SDK uses the retrieved JWT to authenticate directly against the PowerSync Service:
Reading and Writing Data
From the client-side perspective, there are two data flow paths:
Reading data from the server / downloading data (to the SQLite database)
Writing changes back to the server / uploading data (from the SQLite database)
Reading Data
App clients always read data from a local SQLite database. The local database is asynchronously hydrated from the PowerSync Service.
A developer configures Sync Rules for their PowerSync instance to control which data is synced to which users.
The PowerSync Service connects directly to the backend databases and uses a change stream to hydrate dynamic data partitions, called sync buckets. Sync buckets are used to partition data according to the configured Sync Rules. (In most use cases, only a subset of data is required in a client's database and not a copy of the entire backend database.)
The local SQLite database embedded in the PowerSync SDK is automatically kept in sync with the backend database, based on the Sync Rules configured by the developer:
Writing Data
Client-side data modifications, namely updates, deletes and inserts, are persisted in the embedded SQLite database as well as stored in an upload queue. The upload queue is a blocking FIFO queue that gets processed when network connectivity is available.
Each entry in the queue is processed by writing the entry to your existing backend application API, using a function defined by you (the developer). This is to ensure that existing backend business logic is honored when uploading data changes. For more information, see the section on integrating with your backend.
Last updated