Skip to content

Collaborative CRDT Editor

Published:

Table of contents

Open Table of contents

Description

A WebSocket-based server implemented in Python with a Rust-backed CRDT (Conflict-free Replicated Data Type) functionality, providing real-time data synchronization and persistence. The server enables clients to connect, add, update, and remove key-value pairs, with all operations broadcast to connected clients.

Check out the live demo here!

Source code is available on GitHub.

Features

Running Locally

Prerequisites

Build the CRDT Library

make build-lib

Run the Server

make run-server

Run the Client

make run-client

Run Tests

make test

Algorithm

The LWW-Element-Dictionary CRDT is a data structure that allows multiple replicas to manage data independently and concurrently, resolving any inconsistencies that may arise. Here’s a deeper look at its functionality:

Conflict Resolution

Each entry in the dictionary has:

When a key’s value is updated, if the incoming timestamp is later than the existing one, the new value overwrites the old one. If a remove operation is applied with a more recent timestamp, the key is marked as removed, and any additions with earlier timestamps are ignored.

Key Operations

The CRDT approach ensures that changes made by any client will eventually propagate to all others, and the Last-Write-Wins strategy guarantees deterministic conflict resolution.

Technologies Used