Hey everyone! π
After years of making CLI tools and small Node.js scripts, I kept running into the same problem:
βHow do I reliably store local data without spinning up a full database engine?β
Most of the existing JSON databases for Node.js are either:
- too simple (no crash protection)
- too slow
- or completely skip important features like WAL or fsync
π§ So I built WiseJSON
A reliable, segment-based embedded JSON database for Node.js.
With full support for:
β
WAL (Write-Ahead Logging)
β
Checkpoints (segment-based, fast recovery)
β
fsync for safety
β
In-memory indexes (including unique ones)
β
CLI support
β
Zero dependencies except uuid
β
pkg-friendly (can be bundled into binaries)
π§ What makes WiseJSON different?
- Everything is stored in the filesystem β no daemon, no server
- You can use it in CLI apps, scripts, microservices
- Recovery is safe even after crashes or power loss
- Checkpoints are written in segments to keep things scalable
π Install & Use
npm install wise-json-db
npx wise-json insert users name=Alice email=[email protected]
npx wise-json list users
Example .js
usage:
const WiseJSON = require('wise-json-db');
const db = new WiseJSON('./my-db');
(async () => {
const users = await db.collection('users');
await users.createIndex('email', { unique: true });
const user = await users.insert({ name: 'Alice', email: '[email protected]' });
console.log(user._id);
await db.close();
})();
π¬ Why Iβm proud of this project
This is honestly the first open source project Iβve built where I took the time to get everything right:
- Proper fsync safety
- WAL + segmented checkpoint logic
- Clean CLI
- Real-world tests (including crash tests and stress tests)
- Full documentation and even a logo
Itβs not the fastest database β and itβs not meant to be.
Itβs built to be safe, predictable, and easy to reason about.
π§ͺ Whatβs tested
- Thousands of WAL writes under fsync
- Segment splitting with small limits
- Recovery after crash or deletion
- Manual flush and checkpointing
- Segment-level file validation
You can find all test scripts under
/test
in the GitHub repo.
π Links
- GitHub: github.com/Xzdes/WiseJSON
- npm: wise-json-db
π Iβd love feedback β or just a star if you like the idea.
Thanks for reading!
Top comments (1)
There is a new super version of WiseJSON, see the post on the channel