Skip to main content

Filesystem Node RxStorage

The Filesystem Node RxStorage for RxDB is built on top of the Node.js Filesystem API. It stores data in plain JSON/txt files like any "normal" database does. It is a bit faster compared to the SQLite storage and its setup is less complex. Using the same database folder in parallel with multiple Node.js processes is supported when you set multiInstance: true while creating the RxDatabase.

Pros

This plugin is part of RxDB Premium. It is not part of the default RxDB module.
Node/Native Storages (values in milliseconds, lower is better)
StorageTime to first insertInsert 500 docs (bulk)Find 3000 docs by ID (bulk)Insert 50 docs (serial)Find 50 docs by ID (serial)Find 3000 docs by queryFind 3000 docs by query (parallel)Count 3000 docs (4x)
Filesystem Node.js3.335.7822.042.42519.3721.081.83
SQLite (node:sqlite)5.28.6226.4110.842.6719.6820.382.01
Memory1.250.315.371.560.552.824.020.28

Usage

import {
    createRxDatabase
} from 'rxdb';
import {
    getRxStorageFilesystemNode
} from 'rxdb-premium/plugins/storage-filesystem-node';
import path from 'path';
 
const myRxDatabase = await createRxDatabase({
    name: 'exampledb',
    storage: getRxStorageFilesystemNode({
        basePath: path.join(__dirname, 'my-database-folder'),
        /**
         * Set inWorker=true if you use this RxStorage
         * together with the WebWorker plugin.
         */
        inWorker: false
    })
});
/* ... */

FAQ

Does RxDB support single-file storage architectures in Node environments?

The native getRxStorageFilesystemNode adapter does not compile documents into a single monolithic file (like SQLite), but instead serializes and persists document data as distinct JSON/text files directly representing the database tree on the disk. For strict single-file architectures in Node.js, you must mount the specialized SQLite RxStorage plugin, which wraps the entire database state into a single portable .sqlite file efficiently using Node's native sqlite bindings.