Skip to content

In Progress : CollabDoc is a distributed shared document editing, platform

License

Notifications You must be signed in to change notification settings

bhngupta/CollabDoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CollabDoc

CollabDoc is a real-time collaborative document editor built with Go. It allows multiple users to edit a document simultaneously while maintaining consistency and handling conflicts seamlesly.

Every wanted a paper napkin on the internet to quickly jot down suff? Look no further, Collab Doc is a just the right tool. It can be shared to multiple people to collaborate and also be saved for later use! (upto 90 days)

Features

  • Real-time Collaboration: Multiple users can edit the document simultaneously, with changes reflected in real-time.
  • Simple Persistence: Document state is saved to a JSON file, allowing for easy state recovery.
  • WebSocket Communication: Utilizes WebSockets for low-latency, bi-directional communication between.
  • Open Source.

The WHY?

The project was sparked by the idea of having a paper napkin on internet for jotting down ideas and sharing them effortlessly. Drawing inspiration from Google Docs, our goal was to create a seamless experience without the necessity of a login layer, while preserving essential features such as real-time collaboration and updates.

Technology Stack

  • Backend (Go)

    • Concurrency: Goroutines and channels make it easy to handle multiple connections and concurrent operations efficiently
    • Performance: Compiled nature and efficient memory management ensure low-latency and high-throughput
    • Standard Library: Ideal for scalable WebSocket server development.
  • Frontend (React Typescript)

    • Leveraged declarative component-based architecture, facilitating UI updates in real-time with WebSocket API
  • Persistence (JSON file):

    • Simple data storage due to its lightweight nature and ease of integration for file operations

Architecture

CollabDoc Architecture Diagram

Core Concepts

  1. Collaborative Editing
  • Concurrency Management: Go's concurrency model with goroutines and channels is leveraged to manage simultaneous editing sessions efficiently. Each user's edits are processed concurrently, allowing for smooth collaboration without blocking operations.

  • Operational Transformation (OT): CollabDoc utilizes Operational Transformation (OT) to enable real-time collaboration among multiple users. OT ensures that concurrent edits to a document are handled seamlessly, maintaining consistency and resolving conflicts. This transformation ensures that all users see a consistent view of the document, even when edits overlap in time.

  1. Broadcasting Changes
  • WebSocket Communication: CollabDoc uses WebSocket technology to facilitate low-latency, bi-directional communication between the server and clients. When a user makes changes to a document, the server broadcasts these changes to all connected clients in real-time. This broadcasting mechanism ensures that updates are immediately visible to all collaborators, enhancing the collaborative editing experience.

By leveraging Go's concurrency features and OT for conflict resolution, coupled with WebSocket broadcasting for real-time updates, CollabDoc provides a robust platform for collaborative document editing without relying on vector clocks.

Getting Started

Prerequisites

Ensure you have the following installed:

  1. Git
  2. Go (1.22+)
  3. Node.js (20+)
  4. NPM (10+)

Install from source

Backend Setup

  1. Fork the repository

  2. Clone the repository:

    git clone https://github.com/your_username/CollabDoc
    cd CollabDoc
  3. Install dependencies:

go mod tidy
  1. Run the server:
go run cmd/server/main.go

Frontend Setup

  1. Navigate to the frontend directory:
cd frontend
  1. Install dependencies:
npm install
  1. Start development client:
npm run dev

Start collaborating in real-time!

Configurations

  • Client Port: By default, client runs on port 3000.
  • Server Port: By default, backend runs on port 8080.
  • WebSocket Endpoint: WebSocket server listens on /ws.

Usage

  1. Open your browser and navigate to http://localhost:3000.
  2. Create or join a document by entering a document ID.
  3. Start collaborating in real-time!

Future Plans

  • Implement broadcasting to clinets on same document ID
  • Handle multiple clients concurrently using multi-threading or an event loop
  • create new arch diagram
  • Write integration tests
  • Implement a more robust persistence layer - MongoDB
  • Extend the editor to support rich text and code formatting
  • Delete data after set time

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please fork the repository and create a pull request with your changes.

Contributors

Bhanu
Bhanu Gupta
Pranav
Pranav Iyer

About

In Progress : CollabDoc is a distributed shared document editing, platform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published