P2PDocs: Building a Decentralized Collaborative Editor

A Distributed Systems Course Project at the University of Udine

Course: Distributed Systems Team: Alessandro De Biasi, Alessandro Minisini, Nazareno Piccin GitHub: Repository Link | Stack: Elixir, Node.js, Docker


๐Ÿ“š Project Overview

As part of our Distributed Systems course, we designed P2PDocs, a peer-to-peer collaborative text editor. The goal was to implement and evaluate core distributed algorithms:

  • Conflict-Free Replicated Data Types (CRDTs) for conflict resolution
  • Causal Broadcast for ordered message delivery

๐Ÿ” Key Technical Contributions

1. LSEQ CRDT Implementation

To achieve intention preservation (ensuring edits respect user intent across peers), we adopted the LSEQ strategy:

  • Position vectors as rational numbers for dense ordering
  • Peer-ID tagging to break ties in concurrent edits
  • AVL Order-Statistic Tree for O(log n) insertions/deletions

2. Network Layer

  • Echo-Wave Protocol: Reliable operation propagation in dynamic topologies
  • Neighbor Handshake: State synchronization for joining peers
  • Crash Recovery: ETS (Erlang Term Storage) for persistence

3. Validation & Testing

  • Unit Tests: ExUnit for module correctness
  • Multi-Node Tests: Dockerized network partitions and merges:
    ./start_n_instances_for_tests.sh 5  # Launch 5 peers  
    ./disconnect.sh 2                   # Simulate node failure  
    

๐Ÿ”ฎ Future Work

Suggestions from our final report:

  1. Add Markdown support
  2. Implement real-time cursor tracking
  3. Optimize vector clock size

๐Ÿ“š Learn More

For a detailed technical deep dive, including:

  • Full CRDT implementation details
  • Network protocol design choices
  • System validation methodology (unit/integration tests)

Check out the Project Report in the repository.


Explore the Code: GitHub | Connect: LinkedIn