I had a similar problem when I needed a lightweight, file-based database in Node.js. I tried lowdb (works, but very limited) and nedb (no longer maintained).
What worked well for me was DarkDB
. It stores data in plain files (JSON, YAML, TOML, or binary) and still provides things like:
simple set/get/delete/has operations
TTL support (keys expire automatically)
transactions for multi-step updates
basic query engine with filters
Example:
const DarkDB = require("darkdb");
const db = new DarkDB({ name: "mydb", format: "json" });
await db.set("user.name", "Alice");
console.log(await db.get("user.name")); // Alice
await db.set("session.token", "abc123", { ttlMs: 5000 });
It’s not a replacement for MongoDB or SQLite, but if you just need something embedded, file-based and fast, this library is a good option.