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)
- 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 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.
-
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
- 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.
- 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.
Ensure you have the following installed:
- Git
- Go (1.22+)
- Node.js (20+)
- NPM (10+)
-
Fork the repository
-
Clone the repository:
git clone https://github.com/your_username/CollabDoc cd CollabDoc
-
Install dependencies:
go mod tidy
- Run the server:
go run cmd/server/main.go
- Navigate to the frontend directory:
cd frontend
- Install dependencies:
npm install
- Start development client:
npm run dev
Start collaborating in real-time!
- 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
.
- Open your browser and navigate to http://localhost:3000.
- Create or join a document by entering a document ID.
- Start collaborating in real-time!
-
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
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please fork the repository and create a pull request with your changes.
Bhanu Gupta |
Pranav Iyer |