Installation
low-json-db is designed to be extremely easy to install. You have two main options.
Option 1 – Install via npm (Recommended)
The easiest way is to install it as a normal dependency in your project:
npm install low-json-db
Or with yarn / pnpm:
yarn add low-json-db
# or
pnpm add low-json-db
Then require it in your code:
const { JSONDB } = require('low-json-db');
// or with ES modules
import { JSONDB } from 'low-json-db';
Option 2 – Copy the file directly
Because low-json-db has zero dependencies, you can simply copy
db.js into your project.
# Example project structure
my-app/
├── db.js ← the library
├── index.js
└── data/ ← will be created automatically
Then require it with a relative path:
const { JSONDB } = require('./db');
Tip: If you also want TypeScript support, copy
db.d.ts
next to db.js.
Requirements
- Node.js 14 or higher (recommended: Node.js 18+)
- No other packages are required
TypeScript Support
The package includes a full type declaration file (db.d.ts).
If you installed via npm, TypeScript should pick it up automatically.
If you copied the files manually, make sure db.d.ts is in the same folder
as db.js.
Verifying the installation
Create a small test file:
const { JSONDB } = require('low-json-db'); // or './db'
const db = new JSONDB('./test-data');
const users = db.collection('users');
console.log('low-json-db is working!');
console.log('Collections:', db.listCollections());
Run it:
node test.js
Next: Continue to the Quick Start guide
to create your first collection and insert documents.