News for hackers. Stuff that matters.
Re:SQLite in the browser with WASM/JS - OFFICIAL by thruflo on Friday October 28, 2022 @05:23PM (#33378097)
> What I really want to see next is an eventually consistent sync system between browser and server

We’ve made one: https://electric-sql.com

Active-active SQLite to Postgres with transactional causal+ consistency based on CRDTs.

Disclaimer: founder.

Re:SQLite in the browser with WASM/JS - OFFICIAL by samwillis on Friday October 28, 2022 @05:32PM (#33378182)
That is awesome! I’m going to have to play with that.

I previously experimented with combining Yjs (CRDT toolkit) with Pouch/CouchDB to create an eventually consistent db, but decided that CouchDB was the wrong backend.

It looks like you have built exactly what I wanted to do if I had had time.

Re:SQLite in the browser with WASM/JS - OFFICIAL by thruflo on Friday October 28, 2022 @05:38PM (#33378242)
Very cool! Would love to swap ideas if you're up for a chat :)
Re:SQLite in the browser with WASM/JS - OFFICIAL by nrser on Friday October 28, 2022 @09:56PM (#33380229)
I clicked through to the technical intro, and it says you’re using AntidoteDB for the top-level replication

https://electric-sql.com/docs/overview/technical-intro

I happen across AntidoteDB just the other day, and my take-away was that it was still under development but not really ready for production use. Curious your opinion / experience with it?

Re:SQLite in the browser with WASM/JS - OFFICIAL by thruflo on Saturday October 29, 2022 @02:53AM (#33381669)
Yup, it’s a very rigorous system developed over ~10 years with solid testing, benchmarking and formal proofs. However it has some known issues, such as behaviour under high load and not currently handling node failure within a DC.

It’s not production ready and neither are we (we’re in developer preview mode, which is like a public alpha [0]).

There are also other aspects on the Antidote roadmap such as efficiently materialising consistent secondary indexes that are ongoing challenges but aren’t so relevant to how we’re using it as a replication layer.

We are working, alongside others, with the Antidote developers to help fix these issues and generally improve reliability / engineer correct behaviour under load. (Professor Annette Bieniusa, who leads the development, is our Chief Architect). We have a fork at electric-sql/vaxine [1].

We are also taking advantage of some simplifications which mitigate the known issues. We have an #antidote channel in the ElectricSQL discord [2] if you’d be interested in chatting more.

[0]: https://electric-sql.com/docs/overview/faqs

[1]: https://github.com/electric-sql/vaxine

[2]: https://discord.gg/B7kHGwDcbj

Re:SQLite in the browser with WASM/JS - OFFICIAL by techdragon on Saturday October 29, 2022 @07:32AM (#33383103)
I’m just going to put the idea here… C# and Blazor, with linq to sql, in the browser… automatically synced to the backend server… that just sounds like magic, but magic I would throw money at.
Re:SQLite in the browser with WASM/JS - OFFICIAL by farmin on Friday October 28, 2022 @11:07PM (#33380604)
This looks good. I’m currently exploring Firebase for offline support in Ionic/Angular app, but am much more familiar with SQL. Is capacitor support on the cards?
Re:SQLite in the browser with WASM/JS - OFFICIAL by thruflo on Saturday October 29, 2022 @03:12AM (#33381761)
Hey, yup, definitely. It should be very similar to the Cordova integration.

You can also follow the generic driver integration instructions [0]. Basically need to implement an adapter interface and compose the various utilities.

Happy to help with this — shout on Discord [1] if you’d be interested in collaborating on it.

[0]: https://electric-sql.com/docs/usage/drivers#generic

[1]: https://discord.gg/B7kHGwDcbj

Re:SQLite in the browser with WASM/JS - OFFICIAL by jasfi on Saturday October 29, 2022 @03:10AM (#33381751)
Very interesting! It looks like an Open Source core + Premium features business model (just guessing here).

How heavy is the download? What's the minified client size at the moment?

Re:SQLite in the browser with WASM/JS - OFFICIAL by thruflo on Saturday October 29, 2022 @03:43AM (#33381912)
Yup, open source (https://github.com/electric-sql) + managed replication-as-service. Some of our service code (eg: infra, control plane) is proprietary.

Download size depends on the driver (we support different SQLite drivers for different environments). The web is quite heavy as it loads the SQL.js WASM (as a separate file, it’s not bundled). I want to say ~350-400kb total but I need to check and it depends a bit on how you build/bundle and serve it.

One approach would be to look at the network tab of the browser console when running the web example: https://github.com/electric-sql/examples