About this project

lowdb is a small, minimalist local JSON database for JavaScript and TypeScript. Its core idea is that if you know JavaScript, you already know how to use it: data lives in a plain object at db.data, and you query or modify it with native Array and object operations rather than a custom query language. Typical usage reads or creates a JSON file and then updates it either in two steps (mutate db.data, then await db.write()) or in one call via db.update(fn). The resulting db.json is ordinary JSON. TypeScript users can declare a Data type so that db.data is type-checked, catching mistakes such as pushing a number into a string array. The package is pure ESM and installed with npm install lowdb. It provides four presets for common cases: JSONFilePreset, JSONFileSyncPreset, LocalStoragePreset, and SessionStoragePreset. For more control, it exposes Low and LowSync classes plus adapters. Built-in adapters include JSONFile and JSONFileSync for JSON files, Memory and MemorySync for fast in-memory use during tests, and LocalStorage and SessionStorage for browsers. Utility adapters TextFile, TextFileSync, DataFile, and DataFileSync help build custom adapters, for example to support YAML or to add encryption or compression by supplying parse and stringify functions. Adapters are simple classes exposing read and write methods, so users can target remote storage or other formats. The README also shows extending Low with Lodash for chained queries. Documented limits: lowdb does not support Node's cluster module, and writing large objects (roughly 10-100MB) can be slow because each db.write serializes the entire db.data with JSON.stringify. Batch operations and writing only when needed can mitigate this, and for larger scale the README recommends PostgreSQL or MongoDB.