crdts icon indicating copy to clipboard operation
crdts copied to clipboard

A library of Conflict-Free Replicated Data Types for JavaScript

CRDTs

npm version CircleCI Gitter Matrix Discord

A library of Conflict-Free Replicated Data Types for JavaScript.

Work In Progress

This module provides a set of Conflict-Free Replicated Data Types for your JavaScript programs. All CRDTs in this library, except G-Counter, are currently operation-based.

CRDTs implemented in this module:

Install

This module uses npm and node.

To install, run:

$ npm install crdts

Usage

const GCounter = require('crdts').GCounter
const PNCounter = require('crdts').PNCounter
const GSet = require('crdts').GSet
const TwoPSet = require('crdts').TwoPSet
const ORSet = require('crdts').ORSet
const LWWSet = require('crdts').LWWSet

// Or:
const { GSet, ORSet, LWWSet } = require('crdts')

See the source code for each CRDT for the APIs and tests for usage examples.

Inheritance

           +-----------++-----------++----------++---------++------------++------------+
Data Type  |  OR-Set   ||  LWW-Set  ||  2P-Set  ||  G-Set  || G-Counter  || PN-Counter |
           +-----------++-----------++----------++---------++------------++------------+
Base Class |                    CmRDT-Set                  |             --            |
           |-----------------------------------------------+---------------------------+
CRDT Type  |                 Operation-Based               |        State-based        |
           +-----------------------------------------------+---------------------------+

CRDTs Research

To learn more about CRDTs, check out this research:

Contribute

If you think this could be better, please open an issue!

Please note that all interactions in @OrbitDB fall under our Code of Conduct.

License

MIT © 2017-2019 Haja Networks Oy