Open source · MIT · pure JavaScript

JexiDB

A pure-JS embedded database that keeps your data on disk.

No native modules to compile. No dataset loaded into RAM. Just a JSONL file, its indexes, and plain JavaScript.

npm install jexidb
View on GitHub Read the docs
  • v2.2.8 on npm
  • MIT license
  • 710 downloads / month
  • Node >= 16
JexiDB mascot: a koala in a purple hoodie and headphones leaning on a stack of servers.

Why this library exists

JexiDB was written for Megacubo's channel lists, after both usual options ran out: the native ones and the in-memory ones.

The JexiDB koala with a question mark above its head.
  • 01

    Native modules break on desktop

    SQLite and friends ship a prebuilt binary per OS and per architecture, or expect a compiler on the machine that builds the app. On Electron and NW.js that turns every release and every ARM build into a support ticket.

  • 02

    Pure-JS databases load everything into RAM

    Lowdb, LokiJS and NeDB keep the whole dataset in memory. Comfortable at 10k records, a ceiling at 10M — and the ceiling arrives in production, not in development.

  • 03

    You usually need both properties at once

    No build step and no RAM ceiling is the intersection, not two separate features. That intersection is the gap JexiDB fills.

When JexiDB fits, and when it does not

Read the right-hand column first. It is the shortest way to know whether this library is wrong for your project.

Fits

  • Electron, NW.js and Tauri desktop apps that must ship without native binaries or a compiler toolchain.
  • Offline-first tools where the dataset lives on the user's disk and there is no server to call.
  • Local caches and catalogs — channel lists, product catalogs, media metadata — that grow over time.
  • CLI and data-processing scripts that read and write records with streaming and point reads.
  • Records with repetitive string fields, where term mapping compresses well (categories, tags, roles).

Does not fit

  • You need SQL, joins or a query planner → use SQLite.
  • You need multi-writer concurrency or replication → this is not a client/server database.
  • You need very high random-write throughput → an append-only engine wins.
  • You are on Node 22+ and node:sqlite covers your case → that is simpler for server-side work.

How it compares

The same table published in the repository README, kept current there.

This is a qualitative comparison, not a ranking. Pick by the constraint you actually have — no build step, dataset size, data shape — not by which row looks best.

Scroll the table sideways to see every column.

Database Pure JS Disk persistence Memory behavior Data structure Fit
JexiDB Yes, 100% JSONL + compressed indexes Point reading — dataset can exceed RAM Schema required Desktop apps, local Node tools with structured data
NeDB Yes, 100% JSON files High — loads all Document-free Legacy projects (unmaintained)
Lowdb Yes, 100% JSON files High — loads all Document-free Small configs, simple apps
LokiJS Yes, 100% Adapters only High — in-memory primary Document-free In-memory applications
PouchDB Yes, 100% IndexedDB / WebSQL Moderate Document-free Offline-first web apps
SQLite (WASM) No — WASM required SQLite files Moderate SQL tables Complex relational data

Quick start

Install it, declare the fields you want enforced and the indexes you query on, then work with plain objects. The file on disk is a .jdb JSONL file that you can read with any text tool.

terminal
# install the package
$ npm install jexidb
users.js
import { Database } from 'jexidb';

const db = new Database('users.jdb', {
  fields: {
    id: 'number',
    name: 'string',
    email: 'string',
    role: 'string',
    tags: 'array:string'
  },
  indexes: {
    email: 'string',
    role: 'string'
  }
});

await db.init();

await db.insert({
  id: 1,
  name: 'John Doe',
  email: '[email protected]',
  role: 'admin',
  tags: ['developer', 'team-lead']
});

// indexed lookup: reads only the matches
const admins = await db.find({ role: 'admin' });

// flushes records, indexes and term map
await db.save();
// => ./users.jdb (JSONL, on disk)

Fields are required and enforced; indexes are optional and only worth creating for fields you filter on often. The full API, the query operators and the migration notes live in the documentation on GitHub.

The JexiDB koala mascot typing on a laptop.

Used in production

Megacubo — a desktop IPTV player for Windows, macOS and Linux — keeps large, growing channel lists on disk with JexiDB, and has for its last releases.

megacubo.tv

Benchmarks

100,000 records, from the repository's own benchmark suite.

Read this before the numbers. These figures come from the benchmark suite in the JexiDB repository, run on the author's machine with a synthetic dataset. They are hardware-dependent and will differ on yours. You can reproduce them by cloning the repo and running node benchmark.js.

Typical e-commerce product catalog with repetitive category and tag data, as described in the README.
Database Memory usage Query speed File size
JexiDB ~25 MB ~5 ms (indexed) ~15 MB (compressed)
NeDB ~80 MB ~20 ms ~45 MB
Lowdb ~120 MB ~50 ms ~60 MB
LokiJS ~90 MB ~8 ms ~35 MB (adapters)

The file-size gap comes from term mapping: the same dataset stores at 45 MB without it and 15 MB with it, for repetitive strings.