Skip to main content

Active-active replication

In the previous steps on realtime multi-user and conflict-free offline, we've seen data sync between users and their devices. What we haven't yet seen is how it syncs via and with a Postgres database in the cloud.

SQLite <> Postgres

Below, we've again embedded a simple local-first demo app with a slider and some items you can add and clear. This time, below it, we've also displayed the access credentials to connect to a cloud Postgres database.

Live Editor

Run it a few times and watch the content sync in. It's fun!

More to the point, it turns your existing management interfaces (anything that writes to Postgres, be it Rails or Retool) into a content distribution tool for your local-first apps.

Schema evolution

You can also use Postgres to update your local database schema. Write your DDL migrations using your preferred web framework. Apply them to Postgres. ElectricSQL picks up on the changes and propagates them through the replication stream.

So we've seen active-active replication and schema propagation. Now let's see how you control these replication flows using dynamic sync controls »