X Thread Advocating for Sync Engines (a la Meteor Live Data)

Here’s a link that was featured in the Syntax newsletter today:

Most apps should use a sync engine instead of doing RPC.

It’s more clear to me now than ever before: This will become the new default for future app development.

Gets rid of massive amounts of complexity and empowers frontend developers

The OP defines sync engines like this later in the thread:

An end-to-end system that syncs data directly into clients (often into a client-side database) instead of the client having to manually fetch/post data.

Correct me if I’m wrong, but doesn’t that sound like Meteor live data? If so, maybe we should add some posts to this thread. :slight_smile:

1 Like

You are partly correct. However, Meteor live data doesn’t cache or sync things yet. There needs to be more work so it could be considered a true sync engine. Right now, we only fetch the data (initial add) and then react to changes from the server.

Given that Meteor caches data in client-side MongoDB, what are one or two of the differences between Meteor live subscriptions, and a true sync engine?

We would need to have these:

  • Local caching or persistence, Minimongo is not persistent yet, if you reload the data is lost
  • Sync queue, with persistence so it works in offline too

Probably more things, but these are the main ones I can think of

This is a cool video about their work on Sync Engine and its architecture:

2 Likes

100% agree - Meteor provides this kind of developer experience as is

Surprised how long it took everyone else to figure this out :joy:

5 Likes

GitHub - jamauro/offline: An easy way to give your Meteor app offline capabilities and make it feel instant could be a good start ?

4 Likes

Yup, never used Meteor without adding persistence either.
I’d say with few packages/lines of codes, Meteor is exactly what they’re advocating for.
The only thing I’d really loved improved is subscription performance and decoupling of update queue, it was always pretty standard part of many boilerplate codebases to introduce offline-first/ssr/webpack to Meteor.

2 Likes

I wonder if this suggests some possible ways of positioning Meteor for marketing purposes, e.g:

  • The premier sync engine full-stack framework
1 Like

I see a lot of potential in that.

cc @fredmaiaarantes

3 Likes

Here’s a way to test different headlines on the Meteor home page - e.g. test headines that feature “the leading sync-engine framework” vs. 5-20 other headlines.

https://stevehanov.ca/blog/index.php?id=132

Javascript weekly is talking about sync engines today - featuring a library to help build them – but notes that this library can be hard to ‘get’ – which supports the case for Meteor as an easy-to-use full-stack sync-engine framework.

Learn Yjs and Building Realtime Collaborative Apps in JavaScriptYjs is a CRDT (Conflict-free replicated data type) library for building collaborative and local-first apps. CDRTs are powerful but can be tricky to ‘get’ which is why this new interactive Yjs tutorial is so valuable. A great way to learn about building collaborative, syncing webapps from the ground up.

Jamsocket

2 Likes

Yjs is a bit different than what Meteor does. Yjs is for when you are working on the same document with multiple people. Think Google Docs when working at the same time with multiple people. You see their cursors and their edit live. Where Yjs stands is the resolution of the changes, this allows multiple people to work on one sentence for example without it becoming totally crazy. It creates a queue of all the changes and then resolves it one change at a time. It also does conflict resolution.
Meteor saves the data as they come and updates everyone who is subscribed to that data. It is not really suited to editing documents where the latest change gets saved because you might be missing changes from somebody else who is editing the document.

1 Like

While Sync Engine can have different implementations, the main challenge with heavily relying on raw sync is that you’re exposing your database structure to your client, and creating a very big risk of accidentally exposing sensitive values if any one developer forgets to properly filter the fields (I’ve seen this happen countless times with my team over the 10 years we used Meteor).

To be more scalable, I would prefer a Sync Engine that lets you explicitly define all reactive dependencies (similar to React useEffect) and recalculate the output on the server when any of these change. This way it will always send the transformed version to the client without exposing all direct data - sometimes you just need to show a high level realtime stat based on large data and it doesn’t make sense to ship all of it to the client just to calculate a few fields.

I’d be curious to hear from everyone what you would want in your perfect version of Sync Engine - I’m actually building live data engine for full-stack JS (inspired by Meteor) and happy to take suggestions/preferences on what you would change compared to Meteor.

1 Like

It’s up to you to store CRDTs in MongoDB. I believe at least one such implementation exists on top of Meteor’s reactivity: GitHub - edemaine/coauthor: Coauthor supercollaboration/discussion forum.

BTW, you guys still using X?

I’m using it more than ever.