Skip to content

Multiplayer mermaid diagram editor

License

Notifications You must be signed in to change notification settings

lirsacc/siren-chorus

Repository files navigation

SirenChorus

WebRTC based collaborative MermaidJS editor.

Why?

I've recently found myself in multiple meetings editing diagram with multiple people as we work through a problem and felt the need for this as the Mermaid Live Editor doesn't support this. It's also a good opportunity to play with WebRTC and CRDTs.

Other options:

  • There are multiple code based editor online but they don't support multiplayer so we're stuck watching one person write things down. E.g. Mermaid's live editor.
  • We could use a VSCode remote session but that only works if everyone has it setup and the firewall plays nice.
  • Many visual editors have multiplayer but I'd prefer editing in a text format for easy sharing, version tracking and inclusion in other tech docs later.
  • We can also use a collaborative Markdown editor with mermaid support, e.g. HackMD. This is honestly pretty close to what I want with very few rough edges.

Architecture

TODO

Development

Locally

  • Install bun. The version used is documented in .tool-versions.
  • Run bun dev and bun run ws-server in 2 separate shells.
  • Head to http://localhost:1234

Other development tasks such bun run lint are available under package.json:scripts.

GitHub actions

Linting and type-checking will run on pull requests against the main branch and pushed to main.

Deployment

Docker

There's no public live deployment yet but there is a Docker image available.

To build the docker image:

bun run build
docker build -t siren-chorus:latest .

fly.io

Deploying against fly.io is also possible by copying the example config and creating a new app.

bun run build
fly launch
fly scale count 1

After the first launch you should be able to just do fly deploy --ha=false.

Disabling HA is required as the websocket server needs to have a single instance for now.