Before you proceed, this guide assumes that you have already signed up for free accounts with both Neon and PowerSync Cloud (our cloud-hosted offering). If you haven’t signed up for a PowerSync (Cloud) account yet, click here (and if you haven’t signed up for Neon yet, do so now).
For web apps, this guide assumes that you have pnpm installed.
This guide takes 10-15 minutes to complete.
Architecture
Upon successful integration of Neon + PowerSync, your system architecture will look like this: (click to enlarge image)
For more details on PowerSync’s general architecture, see here.
Integration Guide/Tutorial Overview
We will follow these steps to get an offline-first ‘Notes’ demo app up and running:1
Configure Neon:
- Create a Neon project with Auth and Data API
- Set up the database schema
- Configure logical replication
2
Configure PowerSync:
- Create connection to Neon
- Configure authentication
- Configure Sync Rules
3
Test the configuration
Test the configuration using our provided PowerSync-Neon ‘Notes’ demo app.
Configure Neon
Create a Neon Project with Auth and Data API
- Go to pg.new to create a new Neon project.
- In the Neon Console, navigate to your project and enable:
- Neon Auth — Go to the Auth page in the left sidebar and enable it
- Data API — Go to the Data API page in the left sidebar and enable it
Set Up the Database
The demo app uses Drizzle ORM for schema management. The schema includesnotes and paragraphs tables with Row Level Security (RLS) policies.
Clone the demo repository and run the migration:
.env file in the project root with your database connection string:
Configure Logical Replication, User and Publication
PowerSync uses logical replication to sync data from your Neon database.1. Ensure logical replication is enabled
To Ensure logical replication is enabled:- Select your project in the Neon Console.
- On the Neon Dashboard, select Settings.
- Select Logical Replication.
- Click Enable to Ensure logical replication is enabled.
2. Create a PowerSync database user
SELECT privilege, and for the publication mentioned in the next step (as well as for any other publications that may exist).
3. Create “powersync” publication
Configuring PowerSync
Create a PowerSync Cloud Instance
When creating a project in the PowerSync Dashboard, a Development and Production instance will be created by default. Select the instance you want to configure. If you need to create a new instance, follow the steps below.- In the dashboard, select your project and open the instance selection dropdown. Click Add Instance.

- Give your instance a name, such as “Production”.
- [Optional] You can change the default cloud region from US to EU, JP (Japan), AU (Australia) or BR (Brazil) if desired.
- Note: Additional cloud regions will be considered on request, especially for customers on our Enterprise plan. Please contact us if you need a different region.
- Click Create Instance.
Connect PowerSync to Your Neon Database
-
From your Neon Console, select Connect in the top navigation bar. Ensure the format is set to “Connection string”, and click on “Copy snippet”:

- In the PowerSync Dashboard, select your project and instance and go to the Database Connections view.
- Click Connect to Source Database and ensure the “Postgres” tab is selected.
- Paste the connection string into the URI field. PowerSync will automatically parse this URI to populate the database connection details.
-
Update the Username and Password fields to use the
powersync_roleand password you created when configuring your Neon for PowerSync (see Source Database Setup). -
Note: PowerSync includes Neon’s CA certificate by default, so you can use
verify-fullSSL mode without additional configuration.

Your Neon connection details should look similar to this.
- Verify your setup by clicking Test Connection and resolve any errors.
- Click Save Connection.
Configure Neon Auth
After your database connection is configured, enable Neon Auth:- In the PowerSync Dashboard, go to the Client Auth view.
- Enable “Enable development tokens” (useful for testing).
- Populate the “JWKS URI” with the value from the “JWKS URL” field in the Neon Console → Auth → Configuration page.
- Populate the “JWT Audience” with your Neon Auth project root URL (e.g.,
https://ep-restless-resonance-adom1z4w.neonauth.c-2.us-east-1.aws.neon.tech).
- Click Save and Deploy to apply the changes.
Configure Sync Rules
Sync Rules allow developers to control which data gets synced to which user devices using a SQL-like syntax in a YAML file. For the demo app, we’re going to specify that each user can only see their own notes (plus any shared notes).- In the PowerSync Dashboard, select your project and instance and go to the Sync Rules view.
- Edit the Sync Rules in the editor and replace the contents with the below:
- Click “Validate” and ensure there are no errors. This validates your Sync Rules against your Postgres database.
- Click “Deploy” to deploy your Sync Rules.
Test Everything (Using Our Demo App)
In this step you’ll test your setup using the ‘Notes’ demo app. This is a modified version of Neon’s demo app.Configure Environment Variables
In the demo project directory (powersync-js/demos/react-neon-notes-tanstack), update your .env file with the following:
Run the App
Start the development server:
Test Sync (Optional)
During development, you can use the Sync Test feature in the PowerSync Dashboard to validate your Sync Rules:- Click on “Sync Test” in the PowerSync Dashboard.
- Enter the UUID of a user in your Neon Auth database to generate a test JWT.
- Click “Launch Sync Diagnostics Client” to test the sync rules.