Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

sharedb

share41.7kMIT5.2.1TypeScript support: definitely-typed

JSON OT database backend

readme

ShareDB

NPM Version Test Coverage Status

ShareDB is a realtime database backend based on Operational Transformation (OT) of JSON documents. It is the realtime backend for the DerbyJS web application framework.

For help, questions, discussion and announcements, join the ShareJS mailing list or read the documentation.

Please report any bugs you find to the issue tracker.

Features

  • Realtime synchronization of any JSON document
  • Concurrent multi-user collaboration
  • Synchronous editing API with asynchronous eventual consistency
  • Realtime query subscriptions
  • Simple integration with any database
  • Horizontally scalable with pub/sub integration
  • Projections to select desired fields from documents and operations
  • Middleware for implementing access control and custom extensions
  • Ideal for use in browsers or on the server
  • Offline change syncing upon reconnection
  • In-memory implementations of database and pub/sub for unit testing
  • Access to historic document versions
  • Realtime user presence syncing

Documentation

https://share.github.io/sharedb/

Examples

Counter

Leaderboard

Development

Documentation

The documentation is stored as Markdown files, but sometimes it can be useful to run these locally. The docs are served using Jekyll, and require Ruby >2.4.0 and Bundler:

gem install jekyll bundler

The docs can be built locally and served with live reload:

npm run docs:install
npm run docs:start

changelog

v2.0

Breaking changes

  • Drop Node.js v10 support

v1.0-beta

Breaking changes

  • Add options argument to all public database adapter methods that read or write from snapshots or ops.

  • DB methods that get snapshots or ops no longer return metadata unless {metadata: true} option is passed.

  • Replace source argument with options in doc methods. Use options.source instead.

  • Backend streams now write objects intead of strings.

  • MemoryDB.prototype._querySync now returns {snapshots: ..., extra: ...} instead of just an array of snapshots.

Non-breaking changes

  • Add options argument to backend.submit.

  • Add error codes to all errors.

  • Add 'updated' event on queries which fires on all query result changes.

  • In clients, wrap errors in Error objects to they get passed through event emitters.

  • Sanitize stack traces when sending errors to client, but log them on the server.

v0.11.37

Beginning of changelog.

If you're upgrading from ShareJS 0.7 or earlier, take a look at the ShareJS upgrade guide.