Skip to content

Backend connector split - #380

Draft
simolus3 wants to merge 4 commits into
consistent-sync-optionsfrom
backend-connector-split
Draft

simolus3 wants to merge 4 commits into
consistent-sync-optionsfrom
backend-connector-split

Conversation

@simolus3

@simolus3 simolus3 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

This implements a possible approach for the backend connector split (https://github.com/orgs/powersync-ja/discussions/787).

API changes

(These should not be considered final)

This splits PowerSyncBackendConnector into two new interfaces:

  1. Authenticator (used for downloads), exposing the resolveCredentials() and invalidateCredentials() methods. The name of resolveCredentials reflects that users won't necessarily fetch credentials everytime the method is called. In many cases, users manage the JWT as part of their app state and would simply return that. invalidateCredentials() is a hint from the SDK that the JWT has been rejected by the service.
  2. MutationUploader (used for uploads) exposes uploadMutations, called by SDKs to upload ps_crud records. This interface can also be implemented as a closure.

A new connect() overload takes independent authenticator and uploader instances, which allows implementing these independently and connecting in download or upload-only mode.

The streaming sync implementation skips the download or upload loop if the authenticator or uploader is not set.

# Conflicts:
#	common/src/commonMain/kotlin/com/powersync/db/PowerSyncDatabaseImpl.kt
#	common/src/commonMain/kotlin/com/powersync/sync/StreamingSyncClient.kt
#	common/src/commonMain/kotlin/com/powersync/sync/SyncOptions.kt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant