{"library":"share","title":"ShareJS - Concurrent Document Editing","description":"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.","language":"javascript","status":"abandoned","last_verified":"Wed Apr 22","install":{"commands":["npm install share"],"cli":null},"imports":["var livedb = require('livedb');","var share = require('share');","var shareServer = require('share').server.createClient({backend: backend});"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const livedb = require('livedb');\nconst share = require('share');\nconst http = require('http');\nconst express = require('express');\nconst WebSocket = require('ws');\n\n// 1. Initialize LiveDB backend (in-memory for simple example)\nconst backend = livedb.client(livedb.memory());\n\n// 2. Create ShareJS server instance\nconst shareServer = share.server.createClient({backend: backend});\n\n// 3. Set up HTTP server for serving client-side code (optional, but common)\nconst app = express();\napp.use(express.static(__dirname + '/public')); // Serve static files\n\nconst httpServer = http.createServer(app);\nconst wss = new WebSocket.Server({ server: httpServer });\n\n// 4. Handle WebSocket connections for ShareJS clients\nwss.on('connection', (ws) => {\n  const stream = WebSocket.createWebSocketStream(ws);\n  shareServer.listen(stream);\n  console.log('New ShareJS client connected via WebSocket.');\n});\n\nconst PORT = process.env.PORT || 8000;\nhttpServer.listen(PORT, () => {\n  console.log(`ShareJS server listening on http://localhost:${PORT}`);\n  console.log('You will need a client-side implementation to connect.');\n});","lang":"javascript","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}