Production-ready collaborative CRDT demo powered by Automerge (Rust), WASI, and wazero (Go).
Build truly collaborative apps without complex backend infrastructure. This project solves the hardest problems in distributed systems:
- โ No conflict resolution logic - CRDTs mathematically guarantee consistency
- โ Offline-first by default - Work disconnected, sync seamlessly when reconnected
- โ Local-first architecture - Data stays on your device, no cloud dependency
- โ Cross-platform from one codebase - Desktop, mobile, and web from the same Go server
- โ Real-time collaboration - Like Google Docs, but you control the infrastructure
Perfect for:
- ๐ฑ Mobile apps that need offline capability
- ๐ฎ Real-time multiplayer experiences
- ๐ Collaborative editing tools
- ๐ฅ Healthcare/field apps with intermittent connectivity
- ๐ Privacy-focused apps where data stays local
Core Architecture:
- CRDTs handle data merge - Automerge automatically merges changes without conflicts
- Any transport works - HTTP, WebSockets, Bluetooth, files on USB drives... it doesn't matter!
- Great with NATS - Pair with NATS for lightweight pub/sub signaling (separate project)
Device A makes changes โโ> Automerge CRDT state
โ
โโโ> Share via ANY transport โโ> Device B
โ (NATS, HTTP, files, etc.)
โ
โโโ> Automerge merges changes
โ
Guaranteed consistency
Why this matters: Traditional sync needs complex operational transforms, vector clocks, or central coordination. CRDTs just need to exchange state - the math guarantees consistency regardless of network timing or failures. You could use HTTP polling, WebSockets, file sharing, or pair with NATS for real-time pub/sub signaling. Each device runs its own local Go server with embedded CRDT state.
The Stack: This project demonstrates running Automerge - a mature CRDT library - compiled to WebAssembly (WASI) and hosted in a Go server using wazero. Features a complete web UI showcasing 8 different CRDT types with real-time collaboration via Server-Sent Events (SSE).
After running make run, open http://localhost:8080 to see all 8 CRDT types in action:
Basic collaborative text editing with character count and real-time sync.
Key-value storage with CRDT conflict resolution. Put, get, delete, and list keys.
Ordered list with CRDT semantics. Push, insert at index, and delete operations.
Conflict-free counter with increment/decrement. Features animated display and quick action buttons.
Stable position tracking across concurrent edits. Interactive demo shows cursor adjusting as text changes.
View version history, heads (DAG tips), and changes. Download .am snapshots for offline storage.
Plus ๐ Sync Protocol (M1) and โจ Rich Text (M2) tabs!
- Rust (stable): Install via rustup
- Go 1.21+: Download Go
- Make: Usually pre-installed on macOS/Linux
# Clone the repository
git clone https://github.com/joeblew999/automerge-wazero-example.git
cd automerge-wazero-example
# Build and run (builds WASI module + starts server)
make runThe server will start on http://localhost:8080 ๐
Open multiple browser tabs to see real-time collaboration!
Perfect 1:1 mapping across 6 layers - every file has an exact counterpart in each layer:
Web UI โ HTTP API โ Go Server โ Go API โ Go FFI โ Rust WASI โ Automerge Core
(*.js) (api/*.go) (server/*) (automerge/*)(wazero/*)(*.rs)
Key Stats:
- ๐ฏ 57 WASI exports covering ~80% of Automerge API
- ๐ 13 modules with perfect 1:1 file mapping
- ๐งช 103+ tests (36 Rust + 67+ Go), all passing
- ๐ฆ Binary persistence with
.amsnapshots - ๐ Real-time SSE broadcasts to all clients
- ๐ 8-tab web UI with gradient design
| Feature | WASI Exports | Go API | HTTP | Web UI | Status |
|---|---|---|---|---|---|
| Text | 4/4 | โ | โ | โ | 100% |
| Map | 6/6 | โ | โ | โ | 100% |
| List | 8/8 | โ | โ | โ | 100% |
| Counter | 3/3 | โ | โ | โ | 100% |
| Cursor | 3/3 | โ | โ | โ | 100% |
| History | 4/4 | โ | โ | โ | 100% |
| Sync | 5/5 | โ | โ | โ | 100% |
| RichText | 7/7 | โ | โ | โ | 100% |
Total: 57/57 WASI exports implemented!
curl http://localhost:8080/api/text
curl -X POST http://localhost:8080/api/text -H 'Content-Type: application/json' -d '{"text":"Hello!"}'curl -X POST http://localhost:8080/api/map -d '{"path":"ROOT","key":"user","value":"Alice"}'
curl "http://localhost:8080/api/map?path=ROOT&key=user"
curl "http://localhost:8080/api/map/keys?path=ROOT"curl -X POST http://localhost:8080/api/counter -d '{"path":"ROOT","key":"clicks","delta":1}'
curl "http://localhost:8080/api/counter?path=ROOT&key=clicks"23 HTTP endpoints total - see HTTP API Complete Guide
.
โโโ Makefile # Build automation + tests
โโโ CLAUDE.md # AI agent instructions
โโโ README.md # This file
โ
โโโ go/ # Go server
โ โโโ cmd/server/ # HTTP server (23 routes)
โ โโโ pkg/
โ โโโ automerge/ # High-level API (13 files)
โ โโโ server/ # Server layer (13 files)
โ โโโ api/ # HTTP handlers (13 files)
โ โโโ wazero/ # FFI wrappers (13 files)
โ
โโโ rust/automerge_wasi/ # Rust WASI module
โ โโโ src/ # 13 modules (1:1 with Go)
โ
โโโ web/ # Modern web UI
โ โโโ index.html # Tab navigation
โ โโโ js/ # 8 component modules
โ โโโ components/ # 8 HTML templates
โ
โโโ docs/ # Comprehensive docs
โ โโโ tutorials/ # Getting started
โ โโโ how-to/ # Recipes
โ โโโ reference/ # API docs
โ โโโ development/ # Testing, roadmap
โ
โโโ screenshots/ # Component screenshots
make test-go # 67+ Go tests โ
make test-rust # 36 Rust tests โ
make verify-web # Web structure โ
make verify-docs # Doc links โ
All tests passing! See Testing Guide
- Getting Started - Tutorial
- Architecture - Deep dive
- API Reference - Complete API
- Testing - Test guide
- STATUS - Project status and future plans
๐ Full Documentation Index โ
make build-wasi # Build Rust WASI
make run # Build + start server
make test-go # Run Go tests
make test-rust # Run Rust tests
make clean # Clean artifacts- โ M0: Core CRDTs (Text, Map, List, Counter, Cursor, History)
- โ M1: Sync protocol (delta-based sync)
- โ M2: Rich text (marks/spans)
- โ Web UI: All 8 components with screenshots
- ๐ง M3: NATS transport (planned)
- ๐ง M4: Datastar UI (planned)
- Automerge - CRDT library
- wazero - Go WASM runtime
- WASI - WebAssembly System Interface
- NATS - Messaging system (great transport partner)
This project is part of a larger local-first architecture combining:
- Automerge CRDTs (this repo) - Conflict-free data layer
- NATS - Lightweight messaging and sync signaling
- Datastar - Reactive UI components
- goup-util - Cross-platform app bundling (iOS, Android, macOS, Windows, Linux)
- wellknown - Data sovereignty and platform-agnostic publishing
Complete Stack = Own Your Data, Reach Everyone:
- Write once โ HTML/CSS/JS deploys to mobile, desktop, and web
- Own your data โ CRDTs sync locally, you control the infrastructure
- Publish optionally โ Use wellknown URIs to route to your apps or mirror to Google/Apple services
- Stay portable โ Your links work regardless of which platforms you use
- ~95% web tech, ~4% Go backend, ~1% build commands
Looking for partners and organizations interested in:
- Building local-first applications
- Offline-capable mobile/desktop solutions
- Privacy-focused collaborative tools
- Edge computing and distributed systems
Open to collaboration, consulting, and commercial partnerships. Reach out via GitHub Issues or explore the codebase to see if it fits your needs.
MIT License - See LICENSE
Built with โค๏ธ using Rust, Go, and WebAssembly
Perfect 1:1 mapping across 6 layers with 103+ passing tests





