Skip to main content

Postgres

ElectricSQL requires a PostgreSQL database. Postgres is the world's most advanced open source relational database.

Compatibility

ElectricSQL works with standard Postgres version >= 14.0 with logical replication enabled. You don't need to install any extensions or run any unsafe code.

info

Specifically, right now, ElectricSQL works with a single database in a single Postgres installation with tables in the public schema.

Hosting

Many managed hosting providers support logical replication (either out of the box or as an option to enable). This includes, for example:

  • AWS RDS and Aurora (including Aurora Serverless v2)
  • Crunchy Data who have a free tier and logical replication enabled by default
  • Supabase who provide managed Postgres hosting with logical replication and a suite of other backend-as-a-service tools, including auth and edge functions.

See the Deployment section for more information about compatible Postgres hosts. There's also a long list of Postgres hosting providers here.

Self-host / run locally

You can run your own Postgres anywhere you like. See the Postgres Server Administration docs for more information.

Docker

For example, to run using Docker:

docker run \
-e "POSTGRES_PASSWORD=..." \
postgres -c "wal_level=logical"

Homebrew

To run locally using Homebrew, first install and start the service:

brew install postgresql
brew services start postgresql

Enable logical replication:

psql -U postgres \
-c 'ALTER SYSTEM SET wal_level = logical'
brew services restart postgresql

Verify the wal_level is logical:

psql -U postgres -c 'show wal_level'

Database user

The Electric sync service connects to Postgres as a database user. This user needs certain permissions. The exact permissions required depend on how you run the Sync service and are documented on API -> Sync service.