Skip to main content


Platform API

import * as Mycelial from '@mycelial/web'; // or '@mycelial/nodejs'

const instance = Mycelial.create(namespace: string): Instance;

Create an instance of our core library. The namespace is used as a topic for pub/sub.

Websocket API

import * as Websocket from '@mycelial/websocket';
const instance = Mycelial.create("contacts");

const disconnect = Websocket.create(instance, {
endpoint: 'wss://'


Websocket.create(instance: Instance, { endpoint: string }): () => void

Creates a WebSocket adapter that synchronizes the replica across two or more nodes. The return value is a function that disconnects the websocket when called.

Store V0 API

import { Entity, Store } from '@mycelial/v0';

const store = new Store(instance: Instance): Store;

Instantiate a new store, passing in the CRDT instance.

Store.prototype.subscribe(callback: (store: Store) => void): () => void

Subscribe to all store changes, both remote and local. The return value is a function that can be called to unsubscribe.

Store.prototype.add(entity: Entity): Entity

Add the provided entity to its index, returns a clean instance back.

Entity.from(id: string | number, object: { [key: string]: string | number }): Entity

Create entity from id and object

  • id - a unique key for the entity
  • object - an object of key/value pairs

Entity.prototype.update(object: { [key: string]: string | number }): Entity

Update the entity, returns a new instance

  • object - the updated data


Apache 2.0