ShareJS is a server and client library designed for real-time, concurrent document editing using operational transformation (OT). It supports OT on plain-text and arbitrary JSON data, allowing multiple users to collaborate on content simultaneously. The server component runs on Node.js, while the client library functions in both Node.js and web browsers, aiming for broad browser compatibility. It depends on LiveDB for its database backend and data model, and explicitly requires developers to provide a communication transport layer that guarantees in-order message delivery, warning against common pitfalls like using Socket.IO without careful configuration. The current stable version mentioned is 0.7.40. Key differentiators include its transport-agnostic design and its focus on raw OT primitives, leaving UI implementation to the developer. The project appears to be unmaintained as of early 2026, with no recent activity on its GitHub repository since around 2017.
npm install shareVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes a ShareJS server with an in-memory LiveDB backend and sets up a WebSocket server to handle client connections, demonstrating the basic server-side setup.
Evaluate actively maintained alternatives like Yjs, Automerge, or other collaborative editing frameworks. If continuing with ShareJS, be prepared to fork and maintain the codebase yourself.
Utilize transports known to guarantee message order, such as `node-browserchannel`, or carefully configure your chosen WebSocket library (e.g., `ws`) to ensure strict ordering. Do not rely on `socket.io`'s default behavior for ShareJS communication without thoroughly understanding its ordering guarantees.
Remember that `require('share').server.createClient()` is the correct way to instantiate the ShareJS server component. The 'client' in the name refers to its interaction with the underlying LiveDB database.Refer to the linked repositories on GitHub for the most current (though potentially outdated) documentation for `share.rest()` and `share.use()`. Be prepared to examine the source code for undocumented behaviors.
Run `npm install share` in your project directory to install the package.
Run `npm install livedb` in your project directory. Depending on your chosen storage, you might also need `livedb-mongo` or similar.
Ensure you are using `var share = require('share');` and then `share.server.createClient(...)`. Double-check the exact casing and property access.Migrate to a transport like `node-browserchannel` or ensure your WebSocket implementation explicitly enforces in-order message delivery. Avoid relying on default Socket.IO behavior for ShareJS.