Automerge Automerge is a library which provides fast implementations of several different CRDTs, a compact compression format for these CRDTs, and a sync protocol for efficiently transmitting those changes over…
Automerge




Automerge is a library which provides fast implementations of several different
CRDTs, a compact compression format for these CRDTs, and a sync protocol for
efficiently transmitting those changes over the network. The objective of the
project is to support local-first applications in the same way that relational
databases support server applications - by providing mechanisms for persistence
which allow application developers to avoid thinking about hard distributed
computing problems. Automerge aims to be PostgreSQL for your local-first app.
On our website you'll find documentation for JavaScript,
complete with tutorials and an API reference.
This repository also contains the core Rust library which is compiled to WebAssembly and exposed in JavaScript,
the docs for which can be found on docs.rs.
Finally, there is a C library in rust/automerge-c — take a look at the README there for more details.
If you're familiar with CRDTs and interested in the design of Automerge in
particular take a look at the binary format spec.
Finally, if you want to talk to us about this project please join our Discord
server!
Status
This project is formed of a core Rust implementation which is exposed via FFI in
javascript+WASM, C, and soon other languages. Alex
(@alexjg) and Orion
(@orionz) are working full time on maintaining
automerge, other members of Ink & Switch are also contributing time and there
are several other maintainers. We recently released Automerge 3
which achieved around a 10x reduction in memory usage.
In general we try and respect semver.
JavaScript
A stable release of the javascript package is available as @automerge/automerge.
Rust
The rust codebase is currently oriented around producing a performant backend
for the Javascript wrapper and as such the API for Rust code is low level and
not well documented. We will be returning to this over the next few months but
for now you will need to be comfortable reading the tests and asking questions
to figure out how to use it. If you are looking to build rust applications which
use automerge you may want to look into
autosurgeon.
Repository Organisation
./rust- the rust implementation and also the Rust components of
automerge-wasm for the WASM API or
automerge-c for the C FFI bindings)
./javascript- The javascript library which usesautomerge-wasm
./scripts- scripts which are useful to maintenance of the repository.
./img- static assets for use in.mdfiles
Building
To build this codebase you will need:
rustnode
cmakecmockadoxygenninja
cargo install
wasm-bindgen-cliwasm-optcargo-deny
wasm32-unknown-unknown target for rust cross-compilation.
The various subprojects (the rust code, the wrapper projects) have their own
build instructions, but to run the tests that will be run in CI you can run./scripts/ci/run.
For macOS
These instructions worked to build locally on macOS 13.1 (arm64) as of
Nov 29th 2022.
bash
# clone the repo
git clone https://github.com/automerge/automerge
cd automerge
# install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# install cmake, node, cmocka
brew install cmake node cmocka
# install javascript dependencies
npm --prefix ./javascript install
# install rust dependencies
cargo install wasm-bindgen-cli wasm-opt cargo-deny
# get nightly rust to produce optimized automerge-c builds
rustup toolchain install nightly
rustup component add rust-src --toolchain nightly
# add wasm target in addition to current architecture
rustup target add wasm32-unknown-unknown
# Run ci script
./scripts/ci/run
If your build fails to find cmocka.h you may need to teach it about homebrew's
installation location:
export CPATH=/opt/homebrew/include
export LIBRARY_PATH=/opt/homebrew/lib
./scripts/ci/run
Nix Flake
If you have Nix installed, there is a flake available with all
of the dependencies configured and some helper scripts.
console
$ nix develop
____ _
/ ___|___ _ __ ___ _ __ ___ __ _ _ __ __| |___
| | / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` / __|
| |__| (_) | | | | | | | | | | | (_| | | | | (_| \__ \
\____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_|___/
build:deno | Build Deno-wrapped Wasm library
build:host | Build for aarch64-darwin
build:node | Build JS-wrapped Wasm library
build:wasi | Build for Wasm32-WASI
build:wasm:nodejs | Build for wasm32-unknown-unknown with Node.js bindgings
build:wasm:web | Build for wasm32-unknown-unknown with web bindings
docs:build:host | Refresh the docs
docs:build:wasm | Refresh the docs with the wasm32-unknown-unknown target
docs:open:host | Open refreshed docs
docs:open:wasm | Open refreshed docs
# ✂️ SNIP ✂️
$ rustc --version
rustc 1.82.0 (f6e511eec 2024-10-15) # latest at time of writing
Contributing
Please try and split your changes up into relatively independent commits which
change one subsystem at a time and add good commit messages which describe what
the change is and why you're making it (err on the side of longer commit
messages). git blame should give future maintainers a good idea of why
something is the way it is.
Releasing
There are four artefacts in this repository which need releasing:
- The
@automerge/automergeNPM package - The
@automerge/automerge-wasmNPM package - The automerge deno crate
- The
automergerust crate
JS Packages
The NPM package is released automatically by CI tooling whenever a new Github release
is created. This means that the process for releasing a new JS version is:
1. Bump the version in @automerge/automerge also in javascript/package.json
2. Put in a PR to main with the version bump, wait for tests to run and merge to main
3. Once merged to main, create a tag of the form js/automerge-
4. Create a new release on Github referring to the tag in question
This does depend on an access token available as NPM_TOKEN in the
actions environment, this token is generated with a 30 day expiry date so needs
(manually) refreshing every so often.
Rust Package
This is much easier, but less automatic. The steps to release are:
1. Bump the version in automerge/Cargo.toml
2. Push a PR and merge once clean
3. Tag the release as rust/automerge@
4. Push the tag to the repository
5. Publish the release with cargo publish
Members
-
automerge-repo ★ PINNED
No description.
TypeScript ★ 695 1d agoExplain → -
automerge ★ PINNED
A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.
JavaScript ★ 6.4k 2m agoExplain → -
automerge-swift ★ PINNED
Swift language bindings presenting Automerge
Swift ★ 318 3mo agoExplain → -
automerge-classic
A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.
JavaScript ★ 15k 3y agoExplain → -
hypermerge ▣
Build p2p collaborative applications without any server infrastructure in Node.js
TypeScript ★ 1.3k 3y agoExplain → -
pushpin
A collaborative corkboard app
TypeScript ★ 683 3y agoExplain → -
trellis
Trello clone / sample app for Automerge persistence library
JavaScript ★ 521 6y agoExplain → -
autosurgeon
No description.
Rust ★ 423 1mo agoExplain → -
mpl
a p2p document synchronization system for automerge
JavaScript ★ 284 8y agoExplain → -
pixelpusher
pushin' pix
JavaScript ★ 242 8y agoExplain → -
automerge-swift-archived ▣
Wrapper around Swift types that can be modified concurrently by different users, and merged again automatically (a CRDT).
Swift ★ 156 3y agoExplain → -
automerge-prosemirror
No description.
TypeScript ★ 129 4mo agoExplain → -
automerge-go
No description.
Go ★ 127 1y agoExplain → -
automerge-py
No description.
Python ★ 104 20d agoExplain → -
automerge-repo-rs
No description.
Rust ★ 78 9mo agoExplain → -
MeetingNotes
An example application that uses Automerge-Swift to provide collaborative note taking for meetings.
Swift ★ 75 1y agoExplain → -
beelay
No description.
Rust ★ 53 1y agoExplain → -
automerge-perf
Performance tests for Automerge
JavaScript ★ 49 1y agoExplain → -
automerge-java
No description.
Java ★ 45 2mo agoExplain → -
automerge-repo-sync-server
No description.
JavaScript ★ 45 8mo agoExplain → -
automerge-codemirror
No description.
TypeScript ★ 38 11mo agoExplain → -
automerge-repo-quickstart
No description.
TypeScript ★ 36 7mo agoExplain → -
automerge-repo-swift
Extends the Automerge-swift library, providing support for working with multiple Automerge documents at once, with pluggable network and storage providers.
Swift ★ 33 1y agoExplain → -
automerge-net ▣
Network examples for Automerge
JavaScript ★ 25 7y agoExplain → -
old-automerge-website ▣
No description.
JavaScript ★ 16 8mo agoExplain → -
automerge-connection
A generic network synchronisation protocol for Automerge
JavaScript ★ 16 3y agoExplain → -
sync-server
Simple WebSocket server for syncing Automerge clients
JavaScript ★ 14 2y agoExplain → -
automerge.github.io
The official website of the Automerge project, with docs, references, community links, and more!
JavaScript ★ 12 1mo agoExplain → -
pixelpusherd
An archiver daemon for pixelpusher
JavaScript ★ 8 8y agoExplain → -
prosemirror-quickstart
An example of using Automerge + Prosemirror
TypeScript ★ 7 2y agoExplain → -
automerge-repo-network-peerjs
Network adapter for automerge-repo using peerjs
TypeScript ★ 6 1y agoExplain → -
react-native-automerge
No description.
★ 6 1y agoExplain → -
contaaacts
An automerge-swifter demo app
Swift ★ 5 3y agoExplain → -
automerge-swift-backend ▣
A XCFramework wrapper for the rs-backend
Shell ★ 5 3y agoExplain → -
edit-automerge
No description.
TypeScript ★ 2 4mo agoExplain → -
wasm_utils
🦀 Rust utilities for working with Wasm
Rust ★ 1 24d agoExplain → -
automerge-binary-format-spec
No description.
CSS ★ 0 10mo agoExplain → -
.github
No description.
★ 0 10mo agoExplain → -
local-first-landscape-data
No description.
JavaScript ★ 0 1y agoExplain → -
crdt-benchmarks ⑂
A collection of CRDT benchmarks
★ 0 4y agoExplain →
No repos match these filters.