We recommend starting with our Sync Rules from First Principles blog post, which explains on a high-level what Sync Rules are, why they exist and how to implement them.The remainder of these docs dive further into the details.
Each PowerSync Service instance has a Sync Rules configuration where Sync Rules are defined using SQL-like queries (limitations and more info here) combined together in a YAML file.This SQL-like syntax is used when connecting to either Postgres, MongoDB or MySQL as the backend source database.The PowerSync Service uses these SQL-like queries to group data into “sync buckets” when replicating data to client devices.
Sync rules are configured per PowerSync instance.
Functionality includes:
Selecting tables/collections and columns/fields to sync.
PowerSync replicates and transforms relevant data from the backend source database according to Sync Rules.Data from this step is persisted in separate sync buckets on the PowerSync 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.