v2.0.0 Stable

The Local Database
That Scales.

A robust, atomic, and encrypted JSON store for Node.js.
Zero setup. TypeScript ready. O(1) Performance.

Get Started
$ npm install json-database-st
server.js
const JSONDatabase = require('json-database-st');

// Initialize with Schema Validation & Encryption
const db = new JSONDatabase('./data.json', { 
    encryptionKey: process.env.SECRET_KEY,
    indices: [{ name: 'email', path: 'users', field: 'email' }]
});

// Atomic Write (Thread-safe)
await db.set('users.alice', { 
    id: 1, 
    email: 'alice@dev.com', 
    balance: 0 
});

// Mathematical Operation (New in v2.0)
await db.add('users.alice.balance', 100);

// O(1) Instant Lookup via Hash Map
const user = await db.findByIndex('email', 'alice@dev.com');

🔒 Encryption at Rest

Built-in AES-256-GCM encryption. Keep sensitive user data secure on disk without complex external logic.

O(1) Indexing

Define indices on fields like `email` or `id`. Retrieve records instantly without scanning the entire file.

⚛️ Atomic Safety

Uses `proper-lockfile` and atomic renaming strategies to prevent data corruption during crashes or concurrent writes.