Sync database

A Sync Database is a type of resource that enables clients to synchronise and collaborate on all kinds of data, from simple text files to complex JSON documents.

It is powered by the Yjs library.

Many documents can be stored in a single Sync Database.

Each document is identified by a unique string.

A synapse is a sync database that also replicates between Volts. Structured and text documents still use Yjs shared types; binary payloads use synapse blob documents, whose bytes live in a content-addressed store rather than in the CRDT.

Authentication and authorisation

Read and/or write permission is required to the resource, and permissions can be applied at the document level, or for the entire database.

Clients wishing to read or write to a Sync Database must authenticate with the Volt4 in the normal way.

In order to read documents in a Sync Database, the authenticated identity will require volt:database-read permission. Similarly, to write documents the vold:database-write permission is required. These permissions can be set from the fusebox ‘share’ panel.

SyncDocument API

The SyncDocument API is the low-level API for synchronising JSON documents, but most of the time you will want to use the SyncProvider class instead, see the SyncProvider documentation for more information.

Once you have a SyncProvider instance configured you can then use the yjs API to manipulate the document and it will be synchronised to other clients transparently in real-time.