uploadData() method that you implement in your backend connector. Your implementation sends queued changes (mutations) to your application backend, where you retain control over authorization, validation, and business logic before applying them to your source database. The resulting backend state then syncs to clients through PowerSync. If connectivity is interrupted, writes remain available locally and queued until the SDK can retry them.
Basic Write Operations
Best practice: Use UUIDs when inserting new rows on the client side. UUIDs can be generated offline/locally, allowing for unique identification of records created in the client database before they are synced to the server. See Client ID for more details.
ORM Support
PowerSync integrates with popular ORM libraries, which provide type safety and additional tooling. Using an ORM is often preferable to writing raw SQL queries, especially for common operations. See ORM Support to learn which ORMs PowerSync supports and how to get started.Write Operations and Upload Queue
The upload queue records each write to a synced table as aPUT (for INSERT), PATCH (for UPDATE), or DELETE operation. See Write Operations for what each operation contains.
For when and how the SDK calls uploadData(), including triggers, throttling, retry behavior, and error handling, see When uploadData() is Called. To set up your backend to accept these writes, see Choosing Your Setup.
To wait until a write has uploaded and its result has synced back, for example before showing values your backend generates, use a checkpoint request.
Advanced Topics
- Usage Examples - Code examples for common use cases