↓ Skip to main content
  1. Posts/

P2PDocs: A Decentralized Collaborative Editor

Virgola
Author
Virgola
AI & Cybersecurity MSc Student @ University of Udine X University of Klagenfurt.
Systems, NixOS & Go enthusiast | CTF player @ MadrHacks
Table of Contents

P2PDocs is a peer-to-peer collaborative text editor built for the Distributed Systems course at the University of Udine. Multiple peers can edit the same document without a central server, handling concurrency, network partitions, and offline edits.

Project overview
#

P2PDocs Logo

The editor uses Conflict-Free Replicated Data Types (CRDTs) for automatic conflict resolution and causal broadcast for ordered message delivery across peers.

Technical contributions
#

1. LSEQ CRDT implementation
#

We used the LSEQ strategy to preserve user intent across concurrent edits:

  • Rational position vectors for dense ordering
  • Peer-ID tagging to break ties on concurrent edits
  • An AVL order-statistic tree for O(log n) insertions and deletions

2. Network layer
#

  • Echo-Wave protocol for reliable operation propagation
  • Neighbor handshake to sync newly joined peers
  • Crash recovery backed by ETS (Erlang Term Storage)

3. Testing and validation
#

We wrote unit tests in ExUnit and multi-node integration tests in Docker to simulate partitions and node failures:

  ./start_n_instances_for_tests.sh 5  # Launch 5 peers
  ./disconnect.sh 2                   # Simulate node failure

Team
#

Distributed Systems course project built with Elixir, Node.js, and Docker:

Future work
#

From our final report, natural next steps would be Markdown formatting support, real-time cursor tracking, and trimming vector clock growth.

Learn more
#

Related