Dubnium

raw JSON →
4.2.0 verified Sat Apr 25 auth: no javascript

Dubnium is a powerful local database for Node.js (v4.2.0, latest stable). It provides a simple API to create, read, update, and delete records stored as files on disk. Designed for small to medium projects where a full database server is unnecessary. Supports both CommonJS and ECMAScript modules. Active development on GitHub with regular releases. Key differentiator: lightweight zero-dependency solution with synchronous and async operations.

error TypeError: Dubnium is not a constructor
cause ESM import using named import instead of default import.
fix
Use import Dubnium from 'dubnium' (no curly braces).
error Error: ENOENT: no such file or directory, open './data/...'
cause Database directory does not exist or is not writable.
fix
Create directory manually or ensure write permissions.
error TypeError: Cannot read properties of undefined (reading 'delete')
cause Calling `.delete()` on a record that does not exist (read returned undefined).
fix
Check if record exists before calling delete, or use db.delete('tag') directly.
gotcha File extension must include dot (e.g., '.json') — omitting dot may cause files without extension.
fix Always start with '.': new Dubnium('dir', '.json')
deprecated The `delete` method on a record instance is deprecated in v4; use `await db.delete('tag')` instead.
fix Use db.delete('tag') directly.
gotcha Reading a non-existent tag throws an error — no null/undefined return.
fix Wrap in try/catch or check existence first with db.has('tag') if available.
gotcha Directory is created automatically but may fail if parent directory doesn't exist or permissions are wrong.
fix Ensure parent directory exists and is writable.
npm install dubnium
yarn add dubnium
pnpm add dubnium

Initialize a local database, create a record, read it, modify, and delete.

import Dubnium from 'dubnium';

const db = new Dubnium('./data', '.json');

async function main() {
  // Create a record
  await db.create('user', { name: 'Alice', age: 30 });

  // Read the same record
  const record = await db.read('user');
  console.log('Record:', record);

  // Modify data
  await db.get('user').write({ name: 'Alice', age: 31 });

  // Delete the record
  await db.get('user').delete();
}

main().catch(console.error);