A local-first multiplayer web app powered by Automerge and Alpine.js

With Automerge it is surprisingly easy to build web apps which work offline.

Automerge is a local-first sync engine for multiplayer apps that works offline, prevents conflicts, and runs fast (automerge.org). It is a JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically GitHub.

The core of Automerge is written in Rust and made available in Javascript through WASM. That is why the setup can be somewhat challenging, especially if you like to write plain Javascript without build tooling.

To play around with Automerge, I created a simple multiplayer counter combining Automerge and Alpine.js which works offline and synchronizes its state to any visitor given the same URL. It just took 43 lines of Javascript code.

Take a look at the demonstration page and source code.

Update: I moved the site and source code to Codeberg.