PowerSync Docs
Search
⌃K

Sync Rules

Sync rules allow developers to control which data gets synchronized to which devices.

Defining Sync Rules

Each PowerSync instance has a sync rules configuration where sync rules are defined using SQL queries and combined together in a YAML file.
The cloud service will use these SQL queries to group data into "sync buckets" when replicating data to client devices.
Diagram showing how sync rules are configured per PowerSync instance.
Sync rules are configured per PowerSync instance.
Functionality includes:
  • Selecting tables and columns to sync.
  • Filtering data according to user ID.
  • Filter data with static conditions.
  • Filter data with custom parameters.
  • Transforming column values.

Replication Into Sync Buckets

PowerSync replicates and transforms relevant data from the source database according to sync rules.
Data from this step is persisted in separate sync buckets on the PowerSync cloud service. Data is incrementally updated so that sync buckets always contain current state data as well as a full history of changes.
Diagram showing how data is replicated from the source database into sync buckets.
Diagram showing how data is replicated from the source database into sync buckets.

Client Database Hydration

PowerSync asynchronously hydrates local databases embedded in the PowerSync SDK based on data in sync buckets.
Data flow showing sync buckets which are created based on sync rules.
Data flow showing sync buckets which are created based on sync rules.