Remote RxStorage (beta)

The Remote RxStorage is made to use a remote storage and communicate with it over an asynchronous message channel. The remote part could be on another JavaScript process or even on a different host machine. The remote storage plugin is used in many RxDB plugins like the worker or the electron plugin.


The remote storage communicates over a message channel which has to implement the messages$ observable and a send() function on both sides.

// on the client
import { RxStorageDexieStatics } from 'rxdb/plugins/dexie';
import { getRxStorageRemote } from 'rxdb/plugins/remote';
const storage = getRxStorageRemote({
    identifier: 'my-id',
    statics: RxStorageDexieStatics,
    messages$: new Subject(),
    send(msg) {
        // send to remote storage
const myDb = await createRxDatabase({

// on the remote
import { getRxStorageDexie } from 'rxdb/plugins/dexie';
import { exposeRxStorageRemote } from 'rxdb/plugins/remote';
    storage: getRxStorageDexie(),
    messages$: new Subject(),
        // send to other side

Usage with a Websocket server

The remote storage plugin contains helper functions to create a remote storage over a WebSocket server.

// Create a remote storage Websocket server in Node.js
import { getRxStorageMemory } from 'rxdb/plugins/memory';
import { startRxStorageRemoteWebsocketServer } from 'rxdb/plugins/remote';
const server = await startRxStorageRemoteWebsocketServer({
    port: 8080,
    storage: getRxStorageMemory()

// Connect to the remote storage on the client
import { getRxStorageRemoteWebsocket } from 'rxdb/plugins/remote';
const myDb = await createRxDatabase({
    storage: getRxStorageRemoteWebsocket({
        url: 'ws://'

results matching ""

    No results matching ""