Lurker News
Hi HN, James, Valter, Sam and the team from ElectricSQL here.

We're really excited to be sharing ElectricSQL with you today. It's an open source, local-first sync layer that can be used to build reactive, realtime, offline-capable apps directly on Postgres with two way active-active sync to SQLite (including with WASM in the browser).
Electric comprises a sync layer (built with Elixir) placed in front of your Postgres database and a type safe client that allows you to bidirectionally sync data from your Postgres to local SQLite databases. This sync is CRDT-based, resilient to conflicting edits from multiple nodes at the same time, and works after being offline for extended periods.
Some good links to get started:
- website: https://electric-sql.com
- docs: https://electric-sql.com/docs
- code: https://github.com/electric-sql/electric
- introducing post: https://electric-sql.com/blog/2023/09/20/introducing-electri...
You can also see some demo applications:
- Linear clone: https://linear-lite.electric-sql.com
- Realtime demo: https://electric-sql.com/docs/intro/multi-user
- Conflict-free offline: https://electric-sql.com/docs/intro/offline
The Electric team actually includes two of the inventors of CRDTs, Marc Shapiro and Nuno Preguiça, and a number of their collaborators who've pioneered a lot of tech underpinning local-first software. We are privileged to be building on their research and delighted to be surfacing so much work in a product you can now try out.

Comments (170) 71 threads

Earlier comments
jorroll1 reply#
The docs indicate[1] that electric's syncing logic, "shapes", are handled transactionally. How would electric handle an initial sync of 500mb or an initial sync of 10gb?

  [1]: https://electric-sql.com/docs/usage/data-access/shapes#data-loading
vbalegas#
Apps with large dataset have their own characteristics: they are more tolerant to slower initial sync. We can resume replication at point-in-time, so even if a shape takes long to load, we can resume replication at the point we started synching the shape.

We will be working on the engineering to handle transferring large shapes.

CuriouslyC1 reply#
Pretty interesting, what's the benefit of using a check expression rather than row level security?
paulharter#
We do row (and column) level security, the check expression provides an optional additional granularity for controlling which roles can make certain writes
adrianotadao#
Congrats to the team. I’ve tried https://rxdb.info/ and it wasn’t funny at all to do the remote replication (PG) and to deal with conflicts. I do need to check this one out!
35235829081 reply#
I am extremely, extremely excited about this.

I was wondering: what is the difference between VLCN and ElectricSQL?
Thank you!

thruflo2 replies#
Hey,

James here, one of the co-founders of Electric.
Both projects are doing active-active CRDT-based sync. Our focus is on sync via Postgres and on compatibility with existing Postgres-backed applications. So you can drop Electric onto an existing Postgres-backed system and it works with your existing data model.
There's also quite a lot of difference in the development model, how we handle migrations, shape-based partial replication, etc. And we're not focused on p2p sync -- for us, everything goes through Postgres.
Hope that helps -- you can read a bit more about the system design here: https://electric-sql.com/docs/reference/architecture

35235829081 reply#
Thank you for the help! It is quite useful. Another question while I still have you:

On the clientside, is SQLite running in a separate thread? Or is it running on the main thread? Is this the same or different for an electron app vs running in the browser?

thruflo#
With wa-sqlite in IndexedDB mode we're main thread. In OPFS mode it's a worker thread. With the mobile drivers you go over a native bridge.

With Electron / Tauri it's the same as the browser. You're running in Chromium / native WebView on the front-end side.

ako#
How do you deal with schema migrations, and software updates (SQLite or Postgres)?

Load more comments