
PowerSync handles the read path. The dashed lines show the write path through your mutation uploader and write endpoint.
How a Write Reaches Your Source Database
You implement steps 3 and 4. The client SDK and the PowerSync Service handle the other steps.- When your app writes to a synced table in the client-side SQLite database, the client SDK also adds the write to the upload queue.
- The client SDK calls your mutation uploader to upload the queued writes. You never call it directly. See When
uploadData()is Called. - Your mutation uploader sends the queued writes to your write endpoint. After a successful response, it calls
complete()on the transaction or batch it sent, which removes those writes from the upload queue. If the request fails with an error that a retry can fix, such as a network error, it throws instead. The writes stay in the queue, and later writes wait behind them until a retry succeeds. - Your write endpoint applies the writes to your source database before it responds. Otherwise, the change can disappear from the device until the write reaches the source database and syncs. See Applying Writes Before Responding.
- The PowerSync Service replicates the changes from your source database and syncs them to every client whose Sync Streams include the changed rows.