Atomic by default
Every commit uses a temporary file, disk flush, and atomic rename so interrupted writes never leave half a document behind.
Atomic writes, deterministic concurrency, schema migrations, backups, and crash recovery—wrapped in a tiny, type-safe API with zero runtime dependencies.
npm install @homielab/jsonlet
Keep the simplicity of a file without accepting fragile write behavior.
Every commit uses a temporary file, disk flush, and atomic rename so interrupted writes never leave half a document behind.
Sequential in-process queues and heartbeat-based cross-process locks protect updates from racing each other.
Deep-frozen cached snapshots make accidental mutations obvious and keep every change inside a transaction.
Rotating backups, corrupt-file quarantine, stale-lock detection, and automatic recovery cover the ugly edge cases.
Bring Zod or any parser, then evolve data safely through ordered, versioned migrations.
Jsonlet stays out of the way. Reads are synchronous, writes are queued, and TypeScript knows the exact shape of your state.
Explore the API →import { Jsonlet } from "@homielab/jsonlet";
const db = new Jsonlet("./data/db.json", {
defaults: { counter: 0, users: [] },
});
await db.open();
await db.update((draft) => {
draft.counter += 1;
});
console.log(db.read());
await db.close();
Install Jsonlet and ship local state without the usual file-handling traps.