Setup Source Postgres

This guide explains how to prepare your PostgreSQL database as a Source for use with ReJot. ReJot leverages PostgreSQL’s logical replication stream using the pgoutput native plugin to capture database changes.

Enabling Logical Replication

Logical replication is not enabled by default in PostgreSQL. The configuration that manages logical replication is called the wal_level, which must be set to logical. Note that changing this config requires a database restart.

There are two methods to enable this config, either through the postgresql.conf config file:

wal_level = 'logical'

Or you can set it through SQL directly:

SHOW wal_level;

-- inspect current setting
ALTER SYSTEM
SET
  wal_level = 'logical';
NOTE

Hosted PostgreSQL providers like Supabase, Neon, or Google Cloud SQL manage this setting via their own dashboards.

Creating a ReJot Database Role

We recommend creating a separate role for ReJot and giving access to that user. If you want to get started quickly locally you can continue with the default postgres superuser.

CREATE ROLE rejot_role
WITH
  REPLICATION LOGIN PASSWORD '<some secure password>';

GRANT
  SELECT, INSERT, UPDATE, DELETE
ON ALL TABLES IN SCHEMA public TO rejot_role;

Creating a PostgreSQL Publication

A PostgreSQL Publication is defined on a primary postgres node and defines which set of tables in a database can be replicated to other systems.

Creating a publication can be done as follows:

CREATE PUBLICATION rejot_publication FOR TABLE some_table,
another_table;

Often it is convenient to create a publication for all tables, a sync service will create this default publication for you on first launch.

CREATE PUBLICATION rejot_publication FOR ALL TABLES;