Neon

Instructions for configuring PowerSync on a Neon Postgres database. Neon is a serverless Postgres environment with an innovative pricing model that separates storage and compute.

Enable Logical Replication

Open your project and navigate to "Settings" -> "Beta", then click "Enable".

Create a PowerSync Database User

Create a PowerSync user on Postgres:

-- SQL to create powersync user
CREATE ROLE powersync_role WITH REPLICATION LOGIN PASSWORD 'myhighlyrandompassword';
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO powersync_role;

For read-only access, only the SELECT privilege is required — INSERT, UPDATE and DELETE can be removed.

To restrict read access to specific tables, explicitly list allowed tables for both the SELECT privilege, and for the publication (as well as for any other publications that may exist).

Create "powersync" Publication

-- Create publication to replicate tables. Specify a subset of tables if required.
-- NOTE: this must be named "powersync" at the moment
CREATE PUBLICATION powersync FOR ALL TABLES;

Connect PowerSync to Neon

Complete the instructions documented here to connect the PowerSync Service to your Neon environment:

Last updated