Registry / database / bun-sqlite-for-rxdb

bun-sqlite-for-rxdb

JSON →
library1.8.3-betajsnpmunverified

A storage adapter for RxDB that uses Bun's native bun:sqlite for high-performance reactive database storage. Current stable version is 1.8.3-beta. It is updated sporadically, with new releases tied to RxDB major version bumps (supports RxDB ^16.0.0 and ^17.0.0-beta). Differentiates from other RxDB SQLite adapters by leveraging Bun's native SQLite bindings (bun:sqlite), offering significantly faster performance than Node.js-based SQLite adapters. Requires Bun runtime (>=1.0.0) and RxDB. Ships TypeScript declarations.

npm install bun-sqlite-for-rxdb
INSTALL
IMPORT
SIG · BUN-SQLITE-FOR-RXD
B
bun-sqlite-for-rxdb
databasejavascriptv1.8.3-beta
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

getRxDatabaseBunSQLite
✓ import { getRxDatabaseBunSQLite } from 'bun-sqlite-for-rxdb'
✗ import { getRxDatabaseBunSQLite } from 'bun-sqlite-for-rxdb/storage'
Default export is the storage creator. Path 'bun-sqlite-for-rxdb/storage' does not exist.
RxDBStorageCreator
✓ import type { RxDBStorageCreator } from 'bun-sqlite-for-rxdb'
Type-only import for TypeScript users. The package ships types.
default import
✓ import createBunSQLiteStorage from 'bun-sqlite-for-rxdb'
✗ const createBunSQLiteStorage = require('bun-sqlite-for-rxdb')
Package is ESM-only (Bun supports ESM). Using require() will fail.

Creates an RxDB database using Bun's native SQLite storage adapter, adds a collection, and inserts a document.

import { createRxDatabase } from 'rxdb'; import { getRxDatabaseBunSQLite } from 'bun-sqlite-for-rxdb'; const myDatabase = await createRxDatabase({ name: 'mydb', storage: getRxDatabaseBunSQLite({ path: './mydb.sqlite', }), password: process.env.KEY ?? 'myPassword123', multiInstance: true, eventReduce: true, }); await myDatabase.addCollections({ todos: { schema: { version: 0, primaryKey: 'id', type: 'object', properties: { id: { type: 'string', maxLength: 100 }, title: { type: 'string' }, done: { type: 'boolean' }, }, required: ['id', 'title', 'done'], }, }, }); await myDatabase.todos.insert({ id: '1', title: 'Use Bun SQLite with RxDB', done: false });
Debug
Known issues
breakingVersion 1.8.0 dropped support for RxDB v15 and older. Requires RxDB ^16.0.0 or ^17.0.0-beta.
fix
Upgrade RxDB to ^16.0.0 or ^17.0.0-beta. If stuck on RxDB v15, use bun-sqlite-for-rxdb@1.7.x.
affects: >=1.8.0
deprecatedThe function 'getRxDatabaseBunSQLite' is the recommended entry point since v1.6.0; older 'createBunSQLiteStorage' is still exported but may be removed in a future major.
fix
Replace 'createBunSQLiteStorage' with 'getRxDatabaseBunSQLite' in your code.
affects: >=1.6.0
gotchaStorage path must be writable by the Bun process. Using relative paths resolves from the current working directory, not the script location.
fix
Use absolute paths (e.g., path.join(__dirname, './mydb.sqlite')) or process.cwd() to ensure correct location.
affects: >=1.0.0
gotchaThe adapter does not support in-memory databases. A file path is required.
fix
Provide a valid file path. For testing, use a temporary file (e.g., ':memory:' is not supported).
affects: >=1.0.0
gotchaConcurrent write operations from multiple RxDB instances using the same SQLite file may cause SQLITE_BUSY errors. Use multiInstance: true with caution.
fix
For multi-process scenarios, consider using RxDB's replication or a server-side database.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'bun-sqlite-for-rxdb'
Package is not installed or missing in node_modules. Bun's package manager may not have installed peer deps.
fix
Run 'bun install' to ensure all dependencies including 'rxdb' and 'bun-sqlite-for-rxdb' are present.
TypeError: getRxDatabaseBunSQLite is not a function
Importing the wrong export or using CommonJS require() on an ESM-only package.
fix
Use named import: import { getRxDatabaseBunSQLite } from 'bun-sqlite-for-rxdb'.
Error: SQLITE_ERROR: no such table: rxdb_metadata
First time use with an existing SQLite file that was not created by RxDB.
fix
Ensure the database file path is empty or delete the file and let RxDB recreate it.
Error: Cannot use import statement outside a module
Running script as a CommonJS module, but package is ESM-only.
fix
Set "type": "module" in your package.json or rename file to .mjs.
Upgrade
Version history
1.8.3-betalatest on npm
Audit
Dependencies
rxdbrequiredPeer dependency; required at runtime to provide the RxDB database instance.
Agent activity
13 hits · last 30 days
node
10
OpenAI (training)
1
Resources
bun-sqlite-for-rxdb — npm install bun-sqlite-for-rxdb · libregistry