Postgres

Version compatibility: PowerSync requires Postgres version 11 or greater.

Configuring your Postgres database with PowerSync generally involves three tasks:

  • Enable logical replication

  • Create a PowerSync database user

  • Create powersync publication

We have documented steps for some hosting providers:

For other providers and self-hosted databases:

Unsupported Hosted Postgres Providers

Due to the logical replication requirement, not all hosting providers are supported.

Notably, some “serverless Postgres” providers do not support logical replication, and are therefore not supported by PowerSync yet.

MongoDB (Beta)

Version compatibility: PowerSync requires MongoDB version 6.0 or greater.

Status of MongoDB support in PowerSync

In PowerSync nomenclature, Beta means the package is ready to be used for production given you have adequately tested your use case. We typically don’t make any breaking API changes when moving from Beta to V1 (learn more about feature states here).

Alpha (Completed)

Beta (Completed)

MongoDB is now supported for use in production environments.

See https://releases.powersync.com/announcements/mongodb-as-a-backend-database-now-in-beta for the full release notes.

V1 (In Progress — ETA 2025H1)

Our roadmap to V1 remains flexible and is strongly guided by customer feedback. Our focus includes enhancing usability, improving documentation such as migration guides, developing reference/demo applications, and exploring support for sharded MongoDB clusters and Atlas Private Endpoints. If you’d like to see any of these features, please visit our product roadmap and upvote/submit ideas.

Permissions required - MongoDB Atlas

For MongoDB Atlas databases, the minimum permissions are:

readWrite@<your_database>._powersync_checkpoints
read@<your_database>

To allow PowerSync to automatically enable changeStreamPreAndPostImages on replicated collections, instead use:

dbAdmin@<your_database>

If you are replicating from multiple databases in the cluster, you need read permissions on the entire cluster:

readAnyDatabase@admin

Permissions required - Self-hosted

For self-hosted MongoDB, PowerSync requires the find and changeStream permissions on the database being replicated.

PowerSync also requires createCollection, dropCollection, insert, update, and remove permissions to the _powersync_checkpoints collection.

Post-Images

To replicate data from MongoDB to PowerSync in a consistent manner, PowerSync uses Change Streams with post-images to get the complete document after each change. This requires the changeStreamPreAndPostImages option to be enabled on replicated collections.

PowerSync supports three configuration options for post-images:

  1. post_images: off: Uses fullDocument: 'updateLookup' for backwards compatibility. This was the default for older instances. However, this may lead to consistency issues, so we strongly recommend enabling post-images instead.

  2. post_images: auto_configure (Default for new instances): Automatically enables the changeStreamPreAndPostImages option on collections as needed.

  3. post_images: read_only: Uses fullDocument: 'required' and requires changeStreamPreAndPostImages: { enabled: true } to be set on every collection referenced in Sync Rules. Replication will error if this is not configured. This option is ideal when permissions are restricted.

  • To manually configure collections for read_only mode, run this on each collection:
db.runCommand( {
 collMod: <collection>,
 changeStreamPreAndPostImages: { enabled: <boolean> }
} )
  • You can view which collections have the option enabled using:
db.getCollectionInfos().filter(c => c.options?.changeStreamPreAndPostImages?.enabled)

Post-images can be configured for PowerSync Cloud instances under the connection settings in the Dashboard (right-click on your instance to edit it). For self-hosted PowerSync instances, configure post-images in the config.yaml file; see an example here.

MySQL (Alpha)

This section is a work in progress. More details for MySQL connections are coming soon. In the meantime, ask on our Discord server if you have any questions.

Version compatibility: PowerSync requires MySQL version 5.7 or greater.

MySQL connections use the binary log to replicate changes.

Generally, this requires the following config:

  • gtid_mode : ON

  • enforce_gtid_consistency : ON

  • binlog_format : ROW

PowerSync also requires a user with replication permissions on the database. An example:

-- Create a user with necessary privileges
CREATE USER 'repl_user'@'%' IDENTIFIED BY 'good_password';

-- Grant replication client privilege
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'repl_user'@'%';

-- Grant access to the specific database
GRANT ALL PRIVILEGES ON powersync.* TO 'repl_user'@'%';

-- Apply changes
FLUSH PRIVILEGES;

Next Step

Next, connect PowerSync to your database:

Database Connection

Self-hosting: If you are self-hosting PowerSync, refer to PowerSync Service Setup next.