synckit-core
High-performance sync engine for local-first applications. Powers the SyncKit collaboration SDK.
What is this?
synckit-core is the Rust/WASM core that implements SyncKit's CRDTs:
- Fugue CRDT - Collaborative text editing with minimal interleaving
- Peritext - Rich text formatting with conflict resolution
- LWW - Last-write-wins for document metadata
- PN-Counter - Increment/decrement counter
- OR-Set - Add/remove set operations
Built for JavaScript consumption via WASM, but usable as a native Rust library.
Installation
[]
= "0.2.0"
Usage
Document Operations
use ;
// Create a document
let mut doc = new;
// Insert text
doc.insert;
doc.insert;
// Get text
assert_eq!;
// Generate operations for sync
let ops = doc.pending_operations;
Text CRDT (Fugue)
use FugueReplica;
let mut replica = new;
// Insert text
replica.insert;
// Apply remote operations
replica.apply_operation;
// Convert to string
let text = replica.to_string;
Features
default- Core CRDTs with minimal dependenciestext-crdt- Fugue text CRDT with rope data structurefull- All CRDTs, rich text (Peritext), and binary protocolwasm- WASM bindings for JavaScript
See Cargo.toml for all available features.
Architecture
This crate is designed for:
- WASM compilation - Small bundle size with aggressive optimization
- Zero unsafe code - Pure safe Rust
- Deterministic behavior - Same operations produce same results
Optimized profiles:
release- Standard optimizationwasm-release- Size-optimized for WASM (opt-level = "z")
Documentation
Research
Based on published CRDT research:
- Fugue - Weidner, Gentle & Kleppmann (2023)
- Peritext - Litt, Lim, Kleppmann & van Hardenberg (2021)
License
MIT - see LICENSE