Regarding compatibility with our databases, we do have some internal experiments of running a Triplit Server in front of existing databases as almost like a syncing cache. Still very experimental but maybe you'd be more into that use case.
563 karma · joined February 14, 2017
Regarding compatibility with our databases, we do have some internal experiments of running a Triplit Server in front of existing databases as almost like a syncing cache. Still very experimental but maybe you'd be more into that use case.
Do you have a specific use case in mind?
I'd recommend reading this: https://drewdevault.com/2020/07/27/Anti-AGPL-propaganda.html
However, when it comes to collaborative text you're absolutely right and support is on our roadmap. A researcher in this space has already implemented his collaborative sequence library on top of Triplit with the Quill text editor and you can check it out here: https://github.com/mweidner037/list-positions-demos/tree/mas...
In terms of scaling to a million-ops per day we are probably not quite there yet but one advantage to having the server be the authority is that, in the future, the Triplit server could track the timestamps that each client last synced at and progressively prune the history similar to how Postgres handles VACUUM'ing dead tuples.
It's actually running two clients and the server inside the browser window so even though it's simulating real-world, it's the actual code that powers Triplit.
I personally think all apps benefit from being less reliant on a stable internet connection and that's why there's a growing local-first movement and why I'm working on Triplit[1].
[1] www.triplit.dev
"... what I implemented is similar to what Yjs does. Some high-level differences are that a) Yjs doesn't store delete sets explicitly and sends all of them all over again each time syncing starts and b) Yjs gives each insert an additional rightward pointer for resolving ordering between children with the same parent."
My hunch is that the winning strategy in this space is going to be a CRDT version of a Piece Table (the data structure that VS Code uses). Big advantage is that you can separate content (text buffer) from the ordering.
I also hope there's more energy spend thinking about how to adapt these data structures to popular databases which is the biggest hurdle in adopting them. I'm personally invested; trying to create the best first party solution for Triplit.
A researcher at CMU has been thinking about this and got his sequence CRDT working with Triplit among other database systems. https://mattweidner.com/2024/04/29/list-positions.html
Certainly, Supabase is living proof that there's major demand for the ergonomics of Firebase with the established SQL ecosystem; however, there still seems to be a gap of a real-time, syncing, relational data store.
That's what we are still hard at work creating at Triplit[1] while others are making strides to add this functionality to Postgres directly[2].
[1] https://github.com/aspen-cloud/triplit [2] https://electric-sql.com/
I'm biased but you should definitely try Triplit[2] if you want a super easy way to make real-time collaborative software that works seamlessly even when offline or on unreliable networks (like on mobile).
If you run an identical query engine on client and server and then sync data between them, a client can just write a normal query on the client and you get an optimistic response instantly from a local cache and then later a response from the authoritative server. Frankly, this is where most highly interactive apps (like Whatsapp, Linear, Figma, etc) end up anyway with bespoke solutions we're just making it general purpose.
Regarding similar projects there are a few you can find on https://localfirstweb.dev/ but Triplit stands out in a few ways: * Support for an authoritative server * Provides an optional hosted cloud service * Relational querying without SQL * Partial replication (this is a big one) * Typescript schemas and type hinting in queries in return types
For more advanced CRDT stuff, the creator of the Fugue List CRDT, created [a Triplit-powered collaborative text editor](https://github.com/mweidner037/list-demos/blob/master/tripli...) using Quill and his [List Positions](https://github.com/mweidner037/list-positions) library that we plan to have tighter integrations with.
In the future, we'll have an easier way to accomplish what Matt did out of the box so you can create re-orderable lists and collaborative text that are fast and seamlessly handle conflicts automatically
So Triplit does this all for you automatically with the mental model that your database queries automatically update when any data changes happen even if you're offline. Triplit takes care of reconciling this whether the request succeeds on the server and with concurrent changes from other users.