Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
A

automerge

> 编程语言
Open source

A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.

6.5K stars0 likes2 views
WebsiteGitHub

About

A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.

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 platform specific wrappers (e.g. automerge-wasm for the WASM API or automerge-c for the C FFI bindings)
  • ./javascript - The javascript library which uses automerge-wasm internally but presents a more idiomatic javascript interface
  • ./scripts - scripts which are useful to maintenance of the repository. This includes the scripts which are run in CI.
  • ./img - static assets for use in .md files

Building

To build this codebase you will need:

  • rust
  • node

And if you are interested in building the automerge-c library

  • cmake
  • cmocka
  • doxygen
  • ninja

You will also need to install the following with cargo install

  • wasm-bindgen-cli
  • wasm-opt
  • cargo-deny

And ensure you have added the wasm32-unknown-unknown target for rust cross-compilation. The wasm build also requires the nightly toolchain and the rust-src component (see the macOS instructions below for the exact commands); these are used by automerge-wasm and the JS package to build std with panic=unwind so panics surface as JS exceptions.

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.

…

If your build fails to find cmocka.h you may need to teach it about homebrew's installation location:

bash
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.

…

CI entry points are also exposed by the flake. GitHub Actions invokes these same commands, so on Linux the complete non-Windows CI suite can be run with:

bash
$ nix run .#ci

Individual jobs can be run while iterating, for example:

bash
$ nix run .#ci-fmt
$ nix run .#ci-lint
$ nix run .#ci-js-tests
$ nix run .#ci-node18-packaging-test

On macOS, nix run .#ci runs the native host test used by the macOS CI job. The native Windows job remains separate because Nix under WSL would test Linux rather than Windows.

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/automerge NPM package
  • The @automerge/automerge-wasm NPM package
  • The automerge deno crate
  • The automerge rust 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-<version>
  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@<version>
  4. Push the tag to the repository
  5. Publish the release with cargo publish

Issues· 95 open

View all issuesOpen on GitHub
  • #1569

    Benchmark(s) with many `ActorId`s

    rustperformanceUpdated Sep 21, 2026
  • #825

    New splice API issue with paths containing '/'

    rustUpdated Sep 11, 2026
  • #1546

    javascript: Resolve remaining API Extractor "forgotten exports"

    Updated Sep 9, 2026
  • #596

    Save and Load performance

    performanceUpdated Aug 28, 2026
  • #805

    patch state does not fully rollback when an error is thrown in the patchCallback

    bugUpdated Aug 28, 2026
  • #903

    Memory leak with `initSyncState`

    performanceUpdated Aug 28, 2026
  • #906

    Perf: Unexpected quadratic performance loading a collaborative text document

    performanceUpdated Aug 28, 2026
  • #946

    Degrading performance over time

    performanceUpdated Aug 28, 2026
  • #965

    JS time is 1000x smaller than expected

    javascriptUpdated Aug 28, 2026
  • #1041

    Performance issue with list operations in 3.0.0-beta

    performanceUpdated Aug 28, 2026

> Tags

JavaScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 24, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言