A simple, secure, zero-dependency, high-performance file-based database engine for Node.js.
ZeroDB combines the familiarity of SQL-style tables with the simplicity of a file-based system. No separate server, no native dependencies, no setup — just a folder for your data.
Zero DB — Database Editor CLI is a terminal interface for the zero-db engine. It lets you manage a file-based database.
In short, it does four things:
- Databases — create, drop, rename, list, inspect, make public/private, switch (db …, use) Tables & fields — create tables, inspect schemas, add/drop/rename/modify fields (table …, field …)
- Records — find, count, add, update, delete rows with --where, --like, ordering, limits and JSON output (find, add, update, remove)
- Users & permissions — create, update and delete users, assign multi-select permissions, manage owners, plus login/logout (user …)
It runs two ways: an interactive shell with a banner/status prompt (zerodb), or one-shot commands for scripts (zerodb find
--json). It also supports choosing a database root folder, backups/restores, and environment-based sessions.$:> zerodb
├───────────────────────────────────
├─ Zero DB (Database Editor)
├─ Status : @guest ○ Not logged in
├─ Database : —
├───────────────────────────────────
databases my_app
select one with use <database> · sign in with login
↑↓ history tab complete help commands clear screen exit to quit
$ guest@— loginimport { ZeroDB } from 'zero-db-engine';
const db = new ZeroDB('./data');
db.createDatabase('my_store');
db.useDatabase('my_store');- File-based, zero-dependency — Data is stored as files. No server process, no native modules.
- Atomic operations — Writes are atomic, so you don't end up with partially committed data.
- File locking — Advisory locking at OS level for safe concurrent access.
- Tamper-proof integrity — Detects unauthorized modifications to stored data.
- Encryption — Industry-standard encryption for data at rest.
- Auto-scaling — Designed to handle from 10 records to 100M+ records without manual sharding.
- Cluster & distributed operations — Data can work across multiple servers with log-based synchronization.
- Permissions & admin — Built-in user management and an optional system admin.
npm install zero-db-enginePackage name on npm is
zero-db-engine. Import name iszero-db-engine.
Requires Node.js 18+.
ZeroDB has no admin panel or automation dashboard. It is an engine, so setup and usage are two separate processes.
Run setup once, manually. Run your app code every time.
Create the admin, database and table. Do not put this code in your app — run it once and delete it from your main flow.
// setup.js — run once: node setup.js
import { ZeroDB } from 'zero-db-engine';
const db = new ZeroDB('./data');
// System admin — created only once
db.systemadmin.createAdmin('admin', 'pass123');
// Database — created only once
db.createDatabase('my_store');
db.useDatabase('my_store');
// Table — created only once
db.createTable('products', [
{ name: 'id', type: 'number', option: { isAuto: true } },
{ name: 'name', type: 'string' },
{ name: 'price', type: 'number' },
]);
db.clear();
db.exit();
console.log('Setup done.');In your real application you only connect to the existing database and run queries. No createAdmin, no createDatabase, no createTable.
// app.js — run every time: node app.js
import { ZeroDB } from 'zero-db-engine';
const db = new ZeroDB('./data');
db.systemadmin.login('admin', 'pass123');
db.useDatabase('my_store');
const products = db.table('products');
// CRUD
await products.add({ name: 'Laptop', price: 1200 });
const all = await products.select('*').list();
console.log(all);
await products.where({ name: 'Laptop' }).update({ price: 1100 });
await products.where({ name: 'Laptop' }).delete();
db.clear();
db.exit();Why two files? If you run the setup code on every start, you will try to create the same admin / database / table again. Keep setup separate, run it once manually when you first create your data.
Full guides are in the doc/ folder.
Getting Started
- Configuration — All options
Core Features
- Database — Create, drop, rename
- Table & Data — CRUD, queries, joins
- Permissions — User management
Advanced
- SystemAdmin — System-wide admin (optional)
- Public Database — No-auth databases
- Backup — Backup & restore
- Auto-Scaler — Performance tuning
Reference
- Field Types — All data types
- API Reference — Complete method list
Examples are in the examples/ folder.
Benchmarks below are from the local test suite with 10K records. Results vary by hardware, disk and Node.js version — use them as a rough indication, not a guarantee.
| Operation | Ops / sec (10K records) |
|---|---|
| Query | 1,250,000 |
| Insert | 2,839 |
| Update | 45,000 |
| Delete | 61,000 |
| Feature | SQLite | Redis | ZeroDB |
|---|---|---|---|
| Query speed | 10K | 2M | 1.25M |
| Zero dependency | Yes | No | Yes |
| Tamper-proof | No | No | Yes |
| Auto-scaling | No | No | Yes |
ZeroDB is not meant to replace SQLite or Redis in every case. Choose it when you want a zero-setup, file-based database with built-in integrity checks and no external service to manage.
MIT — see LICENSE for details. Commercial support is available on request.
Developed by Levent Inan (@asymmetricstar)