Live data from Hacker News

Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

electric-sql.com

1–10 of 173 posts

Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#1
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.

Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps
electric-sql.com

Re: Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#3
I’m going to have to check this out.

I still maintain that we need an interchange standard for write ahead logs, but tools like this are a step in the right direction.

I would like to point out thought why you may be underselling this. Local-first yes, but that dynamic can also apply to edge-networked apps (at least before everyone started equating edge networking with Lambda).

Re: Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#7

I am extremely, extremely excited about this. I was wondering: what is the difference between VLCN and ElectricSQL? Thank you!

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

Re: Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#8
EletricSQL is very cool, congratulations and thanks for the work!

I was thinking about using it for an app that I'm developing but decided to not ship a 2mb binary to every user.

And that led me to discover that IndexedDB is actually quite interesting.

Any plans to integrate EletricSQL with IndexedDB?

Re: Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#9
Is there any validation or authorization for changes being merged back into the root database?

In a traditional client / server model, the server has an opportunity to validate each request and optionally reject it. The lower level you go with the sync protocol (data changes vs high level requests) the more difficult that becomes.

Have you addressed that and, if so, how? What prevents a malicious client from send arbitrary data streams to get synced into the root database?

Re: Show HN: ElectricSQL, Postgres to SQLite active-active sync for local-first apps

#10

EletricSQL is very cool, congratulations and thanks for the work! I was thinking about using it for an app that I'm developing but decided to not ship a 2mb binary to every user. And that led me to discover that IndexedDB is actually quite interesting. Any plans to integrate EletricSQL with IndexedDB?

Hey, thank you :)

We currently use IndexedDB for the virtual filesystem underneath the wa-sqlite [1] WASM SQLite driver in the browser. But yup, that means a ~1.1MB WASM download.

We'll definitely stay with SQLite in the client. One of our key principles is full SQL support (any Postgres supported SQL on the server, any SQLite supported SQL on the client). So we won't go pure IndexedDB without a database on top.

There's a lot of cool stuff going on with OPFS and WASM SQLite atm, so the technical options are evolving fast.

[1] https://github.com/rhashimoto/wa-sqlite

Post reply on HN