Configs2026年7月5日·1 分钟阅读

Loro — High-Performance CRDTs for Local-First Collaboration

A reimagined Conflict-free Replicated Data Type (CRDT) library built in Rust with bindings for JavaScript/TypeScript. Enables real-time and async collaboration with document-level version control.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Loro CRDT
直接安装命令
npx -y tokrepo@latest install c6580a10-782b-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

Loro is a CRDT library that makes building local-first, collaborative applications practical. Written in Rust for performance, it provides rich data types (text, lists, maps, trees, counters) that merge automatically without a central server, along with built-in document history and time travel.

What Loro Does

  • Provides rich CRDT containers including text with formatting (Peritext-based), lists, maps, trees, and counters
  • Merges concurrent edits from multiple users automatically without conflicts
  • Tracks full document history with time-travel capabilities for undo, versioning, and audit trails
  • Encodes documents into compact binary snapshots for efficient storage and network transfer
  • Offers first-class JavaScript/TypeScript and Rust APIs with Swift and Python bindings in progress

Architecture Overview

Loro implements a novel event graph-based CRDT architecture. Each edit is recorded as an operation in a directed acyclic graph (the event graph), which preserves causality. This design separates the merge semantics from the storage format, enabling compact encoding and fast replay. The Rust core is compiled to WebAssembly for browser use, delivering near-native performance in JavaScript environments.

Self-Hosting & Configuration

  • Install via npm (loro-crdt) for JavaScript or add loro as a Cargo dependency for Rust
  • No server required for basic local-first use; documents sync peer-to-peer via exported binary diffs
  • For server-mediated sync, use doc.export({ mode: "updates" }) to send incremental changes
  • Apply remote changes with doc.import(bytes) on any peer to merge state automatically
  • Persist documents as snapshots to any storage backend (file system, IndexedDB, S3)

Key Features

  • Peritext-based rich text CRDT that correctly handles concurrent formatting changes
  • Movable tree container for hierarchical data like outlines, file trees, and kanban boards
  • Sub-document composition for modular, independently-syncable document sections
  • Compact binary encoding that is significantly smaller than JSON-based CRDT formats
  • Full event graph history enables branching, merging, and checkout of any past version

Comparison with Similar Tools

  • Yjs — mature and widely adopted text CRDT library; Loro adds richer data types, built-in history, and a Rust core for higher throughput
  • Automerge — another Rust-based CRDT with a JSON document model; Loro offers more specialized containers and different merge semantics for text
  • Diamond Types — high-performance text CRDT focused on a single data type; Loro provides a full suite of composable containers
  • ShareDB — OT-based real-time collaboration that requires a central server; Loro is decentralized by design

FAQ

Q: Does Loro work in the browser? A: Yes. The Rust core compiles to WebAssembly, and the npm package works in all modern browsers and Node.js.

Q: How does Loro handle conflicts in rich text? A: Loro implements the Peritext algorithm, which correctly merges concurrent bold, italic, and other formatting operations according to user intent.

Q: Do I need a server to use Loro? A: No. Loro is transport-agnostic. You can sync over WebSocket, WebRTC, HTTP, or even sneakernet via exported binary files.

Q: How large are Loro documents? A: Loro uses a compact binary format. A document with thousands of edits typically compresses to a few kilobytes, much smaller than equivalent JSON representations.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产