This repository contains the code for a real-time collaborative document editing microservice, leveraging the powerful capabilities of Hocuspocus for the collaborative backend.
This microservice enables and supports real-time co-editing of various types of documents and data. Changes made by one user are instantly synchronized and reflected for all other active users, ensuring a smooth and efficient collaborative workflow across diverse data structures, not limited to just text fields.
- Real-time Collaboration: Instant synchronization of edits across multiple users for various data types.
- Awareness / Presencing: Users can see who else is currently viewing or editing the document, including their cursor positions, selections, and online status, fostering a more interactive and coordinated collaborative environment.
- Robust Backend: Utilizes Hocuspocus for efficient WebSocket-based communication and conflict resolution.
- Scalable Architecture: Designed as a microservice to handle multiple concurrent users and documents efficiently.
- Flexible Data Support: Enables collaboration on a wide range of data structures beyond just rich text.
- Persistence (Optional/Configurable): Easily extendable to save document states to a database for long-term storage.
- Backend (Microservice):
- Hocuspocus Server: A WebSocket-based backend for real-time collaboration.
- Node.js: JavaScript runtime environment.
- NestJS 11: A progressive Node.js framework for building efficient, reliable and scalable server-side applications.
- Fastify (Optional, for API endpoints or serving static files): A fast and low overhead web framework for Node.js.
- WebSockets: For real-time communication.
- Frontend (Client-side integration):
- Hocuspocus Client: The client-side library for connecting to the Hocuspocus server.
- (Assumed: A modern JavaScript framework like React, Vue, or plain JavaScript for the UI, integrating with the Hocuspocus client for collaboration)
For more detailed view over the architecture, features, and usage, please refer to the docs.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Make sure you have Node.js and npm (or yarn) installed:
-
Clone the repository:
git clone https://github.com/your-username/collaborative-document-service.git cd collaborative-document-service -
Install backend dependencies:
Note: this project uses pnpm, swc etc - so not npm.Navigate to the project and install dependencies:
pnpm install
-
Start the Hocuspocus Server (Microservice):
From this project directory:pnpm run buildpnpm run startThe server will usually run on
ws://localhost:1234by default, but check your server configuration.
You might need to configure environment variables for the server (e.g., port, database connection strings) or the client (e.g., Hocuspocus server URL). Refer to the .env.example files (if present) or the specific configuration files in the backend and frontend directories.
Contributions are welcome! If you have suggestions for improvements or new features, please feel free to:
- Fork the repository.
- Create a new branch (git checkout -b feature/AmazingFeature).
- Make your changes.
- Commit your changes (git commit -m 'Add some AmazingFeature').
- Push to the branch (git push origin feature/AmazingFeature).
- Open a Pull Request.
This project is licensed under the EUPL-1.2 License - see the LICENSE file for details.