gitmyhub

loro

Rust ★ 6.0k updated 1d ago

Make your JSON data collaborative and version-controlled with CRDTs

Loro is a Rust library for building apps where multiple users can edit the same data at once, syncing changes automatically even when offline, using CRDTs to merge edits without a central server.

RustWebAssemblyJavaScriptSwiftsetup: moderatecomplexity 3/5

Loro is a library that helps developers build apps where multiple people can edit the same data at the same time, even without a constant internet connection. It is built around a concept called CRDTs (Conflict-free Replicated Data Types), which is a technique for keeping data in sync across different devices without needing a central server to arbitrate who made what change. When two people edit the same document offline and then reconnect, Loro merges their changes automatically without losing either person's work.

The library works with JSON-like data structures: lists, maps, and text. You can use it to build collaborative text editors, shared to-do lists, real-time whiteboards, or any other app where multiple users need to see and change the same state. Loro supports rich text editing, tree structures where items can be moved around, and a version history system that works similarly to how Git tracks changes in code.

Loro is written in Rust but can also be used from JavaScript (via a compiled WASM module) and Swift, making it accessible for web apps, mobile apps, and server-side code. The library includes a time-travel feature that lets you step through the history of a document and see what it looked like at any past point. It also supports a shallow snapshot mode, similar to Git's shallow clone, which lets you load a document's current state without pulling in its entire change history.

A visual inspector tool is available at a separate website, letting developers examine the internal state and history of a Loro document during development. The project has documentation, a getting-started guide, and an active Discord community. It reached version 1.0 and is actively maintained by the loro-dev team, who have published blog posts explaining the design decisions behind the library's text editing and tree algorithms.

Where it fits