Skip to content

DevelopersCoffee/collaborative-doc-quic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Real-Time Collaborative Editor with QUIC Protocol

A production-ready, real-time collaborative document editor demonstrating the power of QUIC protocol for ultra-low latency synchronization. Built with Go, this project showcases modern networking protocols and distributed systems concepts.

QUIC Protocol Go Version WebSocket License

🎯 What Makes This Special?

This project is a complete implementation of a collaborative editing system that demonstrates:

  • QUIC Protocol: Google's modern transport protocol (HTTP/3 foundation) for multiplexed, low-latency communication
  • Operational Transformation (OT): Industry-standard algorithm for conflict-free collaborative editing
  • Hybrid Architecture: QUIC for high-performance + WebSocket for broad compatibility
  • Production-Ready Storage: Event sourcing with compaction, metadata DB, and object storage
  • Session Management: Fun random names for each editing session (e.g., "Happy Eagle", "Clever Penguin")

🌟 Key Features

Real-Time Collaboration

  • Multiple users can edit the same document simultaneously
  • Instant synchronization across all connected clients
  • Conflict resolution using Operational Transformation
  • Visual feedback showing active users with unique names and avatars

QUIC Protocol Implementation

  • Multiplexed streams - multiple documents over single connection
  • 0-RTT connection establishment - faster than TCP+TLS
  • Built-in encryption - TLS 1.3 by default
  • Connection migration - survives network changes

Robust Architecture

  • Event Sourcing: All edits stored as immutable events
  • Automatic Compaction: Periodic snapshot creation for performance
  • Persistent Storage: Metadata DB + Object Store for documents
  • Vector Clocks: Causal ordering of operations
  • Lamport Timestamps: Global ordering across distributed clients

πŸš€ Quick Start

Prerequisites

  • Go 1.21+ - Download here
  • Modern browser - Chrome, Firefox, Safari, or Edge

Installation & Running

```bash

Clone the repository

git clone https://github.com/DevelopersCoffee/collaborative-doc-quic.git cd collaborative-doc-quic

Install dependencies

go mod download

Build the server

go build -o bin/server cmd/server/main.go

Run the server

./bin/server ```

The server will start on:

Using the Editor

  1. Open your browser to `http://localhost:8080\`
  2. Create a document - Click the document list to create new docs
  3. Open in multiple tabs - Each tab gets a unique session name
  4. Start typing - Watch real-time synchronization in action!
  5. Share the URL - Collaborate with others on the same document

πŸ“– Understanding QUIC Protocol

Why QUIC?

QUIC (Quick UDP Internet Connections) is a modern transport protocol developed by Google, now standardized as the foundation of HTTP/3.

See ARCHITECTURE.md for detailed technical documentation.

πŸ”§ Project Structure

``` collaborative-doc-quic/ β”œβ”€β”€ cmd/ β”‚ └── server/ # Main server application (HTTP + QUIC + WebSocket) β”œβ”€β”€ internal/ β”‚ β”œβ”€β”€ collaboration/ # Real-time collaboration logic β”‚ β”œβ”€β”€ handlers/ # HTTP request handlers β”‚ β”œβ”€β”€ models/ # Data models (Document, Operation) β”‚ β”œβ”€β”€ names/ # Random name generator for sessions β”‚ └── storage/ # Persistence layer (metadata, objects, events) β”œβ”€β”€ templates/ # HTML templates for the web UI β”œβ”€β”€ data/ # Persistent storage (created at runtime) └── README.md ```

πŸ“š API Reference

REST API

Create Document

```http POST /api/documents Content-Type: application/json

{ "title": "My Document", "content": "Initial content" } ```

Get Document

```http GET /api/documents/{id} ```

List Documents

```http GET /api/documents ```

WebSocket Protocol

Connect to `ws://localhost:8080/ws/{documentId}` and send/receive JSON messages for real-time collaboration.

πŸ§ͺ Testing

Manual Testing

```bash

Terminal 1: Start the server

./bin/server

Terminal 2: Create a document

curl -X POST http://localhost:8080/api/documents \ -H "Content-Type: application/json" \ -d '{"title":"Test Doc","content":"Hello World"}'

Open in browser

open http://localhost:8080/editor/{document-id} ```

Multi-User Testing

  1. Open the same document URL in multiple browser tabs
  2. Each tab will show a different session name (e.g., "Brave Tiger", "Swift Dolphin")
  3. Type in one tab and watch it appear in others instantly

🎨 Features Showcase

Session Names

Each connection gets a fun, randomly generated name:

  • "Happy Eagle" πŸ¦…
  • "Clever Penguin" 🐧
  • "Brave Tiger" 🐯
  • "Swift Dolphin" 🐬

Real-Time Metrics

  • Latency: Round-trip time for operations
  • Operations: Total operations processed
  • Version: Document version number
  • Active Users: Live count with names

🀝 Contributing

This is a demonstration project for educational purposes. Feel free to:

  • Fork and experiment
  • Use as a learning resource
  • Adapt for your own projects

πŸ“ License

MIT License - See LICENSE file for details

πŸ™ Acknowledgments

  • QUIC Protocol: Google's quic-go library
  • Operational Transformation: Inspired by Google Docs
  • WebSocket: Gorilla WebSocket library

Built with ❀️ for the developer community

This project demonstrates modern networking protocols and distributed systems concepts. Perfect for learning about QUIC, real-time collaboration, and Go backend development.

About

Real-time collaborative document editor demonstrating QUIC protocol for ultra-low latency synchronization. Built with Go, featuring Operational Transformation, event sourcing, and WebSocket fallback.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors