DEV Community

Cover image for WiseJSON β€” Embedded JSON Database for Node.js with WAL & Checkpoints
Pavel
Pavel

Posted on

WiseJSON β€” Embedded JSON Database for Node.js with WAL & Checkpoints

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
Enter fullscreen mode Exit fullscreen mode

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();
})();
Enter fullscreen mode Exit fullscreen mode

πŸ’¬ 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


πŸ™ I’d love feedback β€” or just a star if you like the idea.

Thanks for reading!

Top comments (1)

Collapse
 
xzdes profile image
Pavel

There is a new super version of WiseJSON, see the post on the channel