
lowdb
A small JSON-file database you use with plain JavaScript arrays and objects.
- Stars
- 22.6k
- Forks
- 962
- Licence
- MIT
- Language
- JavaScript
- Last update
- 7 months ago
- Type
- Library
What it is
lowdb stores your data in a plain JSON file and lets you read and change it with ordinary JavaScript objects and array methods. You write changes with a single call, and the library saves them to disk. It is an npm package, so it runs inside a Node.js project, and the README also mentions browser storage adapters.
- Store a small list of posts or tasks in db.json and update it with db.update()
- Keep app settings or a small cache in a JSON file that survives restarts
- Use LocalStoragePreset to persist small browser-side data
- Swap in a YAML or encrypted adapter by wrapping TextFile or DataFile
Great for
- Node.js developers building small tools or prototypes that need simple persistent storage
- Projects where a full database server would be more setup than the job needs
- Developers who want to query data with native Array functions instead of a query language
- Test suites that need a fast in-memory store, using the Memory adapters
Not ideal for
- Apps with large datasets or heavy concurrent writes, since the data lives in a single JSON file and the README lists limits around large objects and Node's cluster module
- Projects that need a real database server with multiple clients, indexes or transactions; the README does not describe these features
How to get it
- 1
Install with a package manager
You'll need: Node.js
Install lowdb from npm
npm install lowdb - 2
Run it
- Install the package with npm install lowdb.
- Import JSONFilePreset from 'lowdb/node' and call it with a filename and default data.
- Change db.data directly, then call await db.write(), or use await db.update(...).
- Open db.json to see the saved result.
- 3
Get the most out of it
- Add TypeScript types to your data shape so the compiler catches wrong types, as shown in the README's TypeScript section.
- Use the in-memory adapters (Memory, MemorySync) in unit tests to keep them fast.
- Extend the Low class with lodash for chained queries, as shown in the README's Lodash section.
- Write a custom adapter with the read and write methods to store data somewhere other than a local file.
Downloads
Strengths
- Simple API: db.data is a plain JavaScript object, and writes are a single call
- Supports TypeScript so data shapes can be checked at compile time
- Adapters let you change the storage backend or file format
Trade-offs
- Built on a single JSON file, so it is not designed for large or highly concurrent workloads
- The package is pure ESM, which the README notes can cause trouble in some projects
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| lowdb (this) | 22.6k | Library | beginner | 7 months ago | Node.js developers building small tools or prototypes that need simple persistent storage |
| nedb | 13.5k | Library | beginner | 1.5 years ago | Small Node.js or Electron apps that need simple local storage without installing a separate database server |
| duckdb | 42.7k | Library | beginner | 4 days ago | Analysts who want to run SQL directly on CSV, Parquet, or JSON files |
| turso | 25.1k | Library | intermediate | 4 days ago | Developers who want an embedded SQLite-compatible database in a Rust, JavaScript, Python, Java, Go, or .NET project |
| libsql | 17.3k | Library | intermediate | 20 days ago | Developers who already use SQLite and want extra features like embedded replicas |
| store.js | 14k | Library | beginner | 2.8 years ago | Front-end developers who need to keep small pieces of data in the browser across page loads |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.