{"id":44444,"library":"bun-sqlite-for-rxdb","title":"Bun SQLite RxDB Storage Adapter","description":"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.","status":"active","version":"1.8.3-beta","language":"javascript","source_language":"en","source_url":"https://github.com/adam2am/bun-sqlite-for-rxdb","tags":["javascript","rxdb","sqlite","bun","bun:sqlite","storage","adapter","database","reactive","typescript"],"install":[{"cmd":"npm install bun-sqlite-for-rxdb","lang":"bash","label":"npm"},{"cmd":"yarn add bun-sqlite-for-rxdb","lang":"bash","label":"yarn"},{"cmd":"pnpm add bun-sqlite-for-rxdb","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; required at runtime to provide the RxDB database instance.","package":"rxdb","optional":false}],"imports":[{"note":"Default export is the storage creator. Path 'bun-sqlite-for-rxdb/storage' does not exist.","wrong":"import { getRxDatabaseBunSQLite } from 'bun-sqlite-for-rxdb/storage'","symbol":"getRxDatabaseBunSQLite","correct":"import { getRxDatabaseBunSQLite } from 'bun-sqlite-for-rxdb'"},{"note":"Type-only import for TypeScript users. The package ships types.","symbol":"RxDBStorageCreator","correct":"import type { RxDBStorageCreator } from 'bun-sqlite-for-rxdb'"},{"note":"Package is ESM-only (Bun supports ESM). Using require() will fail.","wrong":"const createBunSQLiteStorage = require('bun-sqlite-for-rxdb')","symbol":"default import","correct":"import createBunSQLiteStorage from 'bun-sqlite-for-rxdb'"}],"quickstart":{"code":"import { createRxDatabase } from 'rxdb';\nimport { getRxDatabaseBunSQLite } from 'bun-sqlite-for-rxdb';\n\nconst myDatabase = await createRxDatabase({\n  name: 'mydb',\n  storage: getRxDatabaseBunSQLite({\n    path: './mydb.sqlite',\n  }),\n  password: process.env.KEY ?? 'myPassword123',\n  multiInstance: true,\n  eventReduce: true,\n});\n\nawait myDatabase.addCollections({\n  todos: {\n    schema: {\n      version: 0,\n      primaryKey: 'id',\n      type: 'object',\n      properties: {\n        id: { type: 'string', maxLength: 100 },\n        title: { type: 'string' },\n        done: { type: 'boolean' },\n      },\n      required: ['id', 'title', 'done'],\n    },\n  },\n});\n\nawait myDatabase.todos.insert({ id: '1', title: 'Use Bun SQLite with RxDB', done: false });","lang":"typescript","description":"Creates an RxDB database using Bun's native SQLite storage adapter, adds a collection, and inserts a document."},"warnings":[{"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.","message":"Version 1.8.0 dropped support for RxDB v15 and older. Requires RxDB ^16.0.0 or ^17.0.0-beta.","severity":"breaking","affected_versions":">=1.8.0"},{"fix":"Replace 'createBunSQLiteStorage' with 'getRxDatabaseBunSQLite' in your code.","message":"The function 'getRxDatabaseBunSQLite' is the recommended entry point since v1.6.0; older 'createBunSQLiteStorage' is still exported but may be removed in a future major.","severity":"deprecated","affected_versions":">=1.6.0"},{"fix":"Use absolute paths (e.g., path.join(__dirname, './mydb.sqlite')) or process.cwd() to ensure correct location.","message":"Storage path must be writable by the Bun process. Using relative paths resolves from the current working directory, not the script location.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Provide a valid file path. For testing, use a temporary file (e.g., ':memory:' is not supported).","message":"The adapter does not support in-memory databases. A file path is required.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"For multi-process scenarios, consider using RxDB's replication or a server-side database.","message":"Concurrent write operations from multiple RxDB instances using the same SQLite file may cause SQLITE_BUSY errors. Use multiInstance: true with caution.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.0':77 '1.8.3':29 '16.0.0':46 '17.0.0':48 'adapt':5,8,55,73,90 'base':71 'beta':30,49 'bind':62 'bump':43 'bun':1,13,16,58,63,75,86,87 'current':25 'databas':23,91 'declar':82 'differenti':50 'faster':67 'high':20 'high-perform':19 'javascript':83 'leverag':57 'major':41 'nativ':15,60 'new':36 'node.js':70 'offer':65 'perform':21,68 'reactiv':22,92 'releas':37 'requir':74 'runtim':76 'rxdb':3,10,40,45,53,79,84 'ship':80 'signific':66 'sporad':34 'sqlite':2,17,54,61,64,72,85,88 'stabl':26 'storag':4,7,24,89 'support':44 'tie':38 'typescript':81,93 'updat':33 'use':12 'version':27,42","created_at":"2026-06-07T12:50:10.083483+00:00","updated_at":"2026-06-07T12:50:10.083483+00:00","problems":[{"fix":"Run 'bun install' to ensure all dependencies including 'rxdb' and 'bun-sqlite-for-rxdb' are present.","cause":"Package is not installed or missing in node_modules. Bun's package manager may not have installed peer deps.","error":"Error: Cannot find module 'bun-sqlite-for-rxdb'"},{"fix":"Use named import: import { getRxDatabaseBunSQLite } from 'bun-sqlite-for-rxdb'.","cause":"Importing the wrong export or using CommonJS require() on an ESM-only package.","error":"TypeError: getRxDatabaseBunSQLite is not a function"},{"fix":"Ensure the database file path is empty or delete the file and let RxDB recreate it.","cause":"First time use with an existing SQLite file that was not created by RxDB.","error":"Error: SQLITE_ERROR: no such table: rxdb_metadata"},{"fix":"Set \"type\": \"module\" in your package.json or rename file to .mjs.","cause":"Running script as a CommonJS module, but package is ESM-only.","error":"Error: Cannot use import statement outside a module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/adam2am/bun-sqlite-for-rxdb","github":"https://github.com/adam2am/bun-sqlite-for-rxdb","docs":null,"changelog":null,"pypi":null,"npm":"bun-sqlite-for-rxdb","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}