JembaDb
raw JSON → 5.1.7 verified Sat Apr 25 auth: no javascript
JembaDb is a tiny, embeddable, append-only JSON database for Node.js v16.16.0+. Current version 5.1.7, actively maintained. Unlike full-featured databases, it focuses on simplicity: append-only logging and in-memory queries. Ideal for small projects, configuration, or logging scenarios where a full database is overkill.
Common errors
error TypeError: JembaDb is not a constructor ↓
cause Using CommonJS require with an ESM-only package.
fix
Use
import JembaDb from 'jembadb' or set "type": "module" in package.json. error ERR_REQUIRE_ESM ↓
cause Attempting to require the package in a CommonJS file.
fix
Switch to ESM: rename file to .mjs or add
"type": "module". error Cannot find module 'jembadb' ↓
cause Package not installed or wrong import path.
fix
Run
npm install jembadb and verify import path. Warnings
breaking CJS require() is not supported; use ESM import. ↓
fix Switch to ESM with `import JembaDb from 'jembadb'`.
gotcha Database is append-only; updates mean appending new entries, not in-place modification. ↓
fix Use `query()` to find latest entry or implement versioning.
deprecated Old `find()` method replaced by `query()`. ↓
fix Replace `db.find(...)` with `db.query(...)`.
breaking Node.js >=16.16.0 required. ↓
fix Upgrade Node.js to 16.16.0+.
Install
npm install jembadb yarn add jembadb pnpm add jembadb Imports
- default wrong
const JembaDb = require('jembadb')correctimport JembaDb from 'jembadb' - JembaDb wrong
import { JembaDb } from 'jembadb'correctimport JembaDb from 'jembadb' - type wrong
import JembaDb from 'jembadb'correctimport type JembaDb from 'jembadb'
Quickstart
import JembaDb from 'jembadb';
const db = new JembaDb();
await db.insert({ id: 1, name: 'test' });
const results = await db.query({ id: 1 });
console.log(results);
await db.close();