lowdb is a free, open source databases project written in JavaScript and released under MIT. It has 22,582 GitHub stars, 962 forks and 16 open issues, and was last pushed 6 months ago. On this registry it ranks #29 of 143 tracked projects in Databases, with 5 head-to-head comparisons available.

What is lowdb?

lowdb is a small, MIT-licensed embedded JSON database for JavaScript and TypeScript that persists data to a plain db.json file, aimed at Node.js, Electron, and browser projects that need local storage without running a database server.

What it is

lowdb sits in the JavaScript and TypeScript ecosystem, catalogued under Infrastructure and Operations / Databases. It is written in JavaScript, licensed under MIT, and carries 22,582 stars, 962 forks, and 16 open issues, with the most recent push dated 27 March 2026. Data lives in a single db.json file that the library reads or creates, and db.data is exposed as an ordinary JavaScript object, with no magic layer in between. The package is published as pure ESM and is typed for TypeScript.

The concrete problem it solves is local persistence in projects too small to justify a database server. Instead of hand-rolling file reading and writing, a caller uses JSONFilePreset('db.json', { posts: [] }), mutates db.data, and calls db.write() or db.update(...), with safe atomic writes handled by the library. Behaviour is changeable rather than fixed: adapters allow a different storage backend, a different file format such as JSON or YAML, or added encryption, and lower-level classes such as new Low(adapter, defaultData) and new LowSync(adapter, defaultData) are available when the presets are too coarse.

Key capabilities

  • Four presets cover common cases: JSONFilePreset(filename, defaultData), JSONFileSyncPreset(filename, defaultData), LocalStoragePreset(name, defaultData), and SessionStoragePreset(name, defaultData).
  • Writes happen through db.write() or the single-call form db.update(({ posts }) => posts.push(post)); both rely on safe atomic writes.
  • Queries use native Array methods on db.data, including posts.at(0), posts.filter(...), posts.find(...), and posts.toSorted(...), because the data is a plain JavaScript object.
  • TypeScript checks the declared shape: with type Data = { messages: string[] }, the call db.data.messages.push(1) is a compile error.
  • Adapters and classes are exposed separately from the presets, namely the JSONFile adapter alongside new Low(adapter, defaultData) and new LowSync(adapter, defaultData).
  • The library is hackable: storage, file format (JSON, YAML, and others), and encryption can be swapped through adapters, and lodash or ramda can be layered on, as in a LowWithLodash subclass reading db.chain.get('posts').find({ id: 1 }).value().
  • It automatically switches to fast in-memory mode during tests, and the repository ships CLI, server, browser, and test examples under src/examples/.

Who uses it and how

  • Node.js applications and scripts that need a local JSON store without provisioning a database server.
  • Electron desktop applications, matching the electron, embeddable, and embedded-database topics.
  • Browser-side code that keeps data through LocalStoragePreset or SessionStoragePreset.
  • Test suites, which get in-memory mode automatically instead of filesystem writes.
  • Projects that want lodash or ramda querying over the same data, using a LowWithLodash subclass in place of a preset.

Getting started

Installation is npm install lowdb, and the package is pure ESM, so CommonJS projects must follow the ESM guidance linked from the README before importing it. The typical entry point is import { JSONFilePreset } from 'lowdb/node', followed by a preset call that reads or creates db.json.

How it compares

No similar tools and no list of paid products appear in the supplied facts, so lowdb stands alone in this registry on that basis. Its position rests on what it offers on its own terms: an MIT licence, no hosted service, and data held in a file the project itself owns.

When to use it — and when not to

A self-hoster operates nothing beyond the db.json file itself, since there is no server or database daemon in the picture, though the file, its location, and its backups remain the operator's responsibility. Projects that are not on ESM should look elsewhere or budget time for the migration trouble the README warns about, and anyone needing data reachable over a network, across processes, or by several services should not pick this. The documentation is terse at the edges: the TypeScript example in the README calls JSONPreset while the preset list documents JSONFilePreset, and much of the remaining usage guidance is deferred to the src/examples/ directory.

project readme (upstream, from github) — read inline

lowdb Node.js CI

Simple to use type-safe local JSON database 🦉

If you know JavaScript, you know how to use lowdb.

Read or create db.json

const db = await JSONFilePreset('db.json', { posts: [] })

Use plain JavaScript to change data

const post = { id: 1, title: 'lowdb is awesome', views: 100 }

// In two steps
db.data.posts.push(post)
await db.write()

// Or in one
await db.update(({ posts }) => posts.push(post))
// db.json
{
  "posts": [
    { "id": 1, "title": "lowdb is awesome", "views": 100 }
  ]
}

In the same spirit, query using native Array functions:

const { posts } = db.data

posts.at(0) // First post
posts.filter((post) => post.title.includes('lowdb')) // Filter by title
posts.find((post) => post.id === 1) // Find by id
posts.toSorted((a, b) => a.views - b.views) // Sort by views

It's that simple. db.data is just a JavaScript object, no magic.

Sponsors





Become a sponsor and have your company logo here 👉 GitHub Sponsors

Features

  • Lightweight
  • Minimalist
  • TypeScript
  • Plain JavaScript
  • Safe atomic writes
  • Hackable:
    • Change storage, file format (JSON, YAML, ...) or add encryption via adapters
    • Extend it with lodash, ramda, ... for super powers!
  • Automatically switches to fast in-memory mode during tests

Install

npm install lowdb

Usage

Lowdb is a pure ESM package. If you're having trouble using it in your project, please read this.

import { JSONFilePreset } from 'lowdb/node'

// Read or create db.json
const defaultData = { posts: [] }
const db = await JSONFilePreset('db.json', defaultData)

// Update db.json
await db.update(({ posts }) => posts.push('hello world'))

// Alternatively you can call db.write() explicitely later
// to write to db.json
db.data.posts.push('hello world')
await db.write()
// db.json
{
  "posts": [ "hello world" ]
}

TypeScript

You can use TypeScript to check your data types.

type Data = {
  messages: string[]
}

const defaultData: Data = { messages: [] }
const db = await JSONPreset<Data>('db.json', defaultData)

db.data.messages.push('foo') // ✅ Success
db.data.messages.push(1) // ❌ TypeScript error

Lodash

You can extend lowdb with Lodash (or other libraries). To be able to extend it, we're not using JSONPreset here. Instead, we're using lower components.

import { Low } from 'lowdb'
import { JSONFile } from 'lowdb/node'
import lodash from 'lodash'

type Post = {
  id: number
  title: string
}

type Data = {
  posts: Post[]
}

// Extend Low class with a new `chain` field
class LowWithLodash<T> extends Low<T> {
  chain: lodash.ExpChain<this['data']> = lodash.chain(this).get('data')
}

const defaultData: Data = {
  posts: [],
}
const adapter = new JSONFile<Data>('db.json')

const db = new LowWithLodash(adapter, defaultData)
await db.read()

// Instead of db.data use db.chain to access lodash API
const post = db.chain.get('posts').find({ id: 1 }).value() // Important: value() must be called to execute chain

CLI, Server, Browser and in tests usage

See src/examples/ directory.

API

Presets

Lowdb provides four presets for common cases.

  • JSONFilePreset(filename, defaultData)
  • JSONFileSyncPreset(filename, defaultData)
  • LocalStoragePreset(name, defaultData)
  • SessionStoragePreset(name, defaultData)

See src/examples/ directory for usage.

Lowdb is extremely flexible, if you need to extend it or modify its behavior, use the classes and adapters below instead of the presets.

Classes

Lowdb has two classes (for asynchronous and synchronous adapters).

new Low(adapter, defaultData)
import { Low } from 'lowdb'
import { JSONFile } from 'lowdb/node'

const db = new Low(new JSONFile('file.json'), {})
await db.read()
await db.write()
new LowSync(adapterSync, defaultData)
import { LowSync } from 'lowdb'
import { JSONFileSync } from 'lowdb/node'

const db = new LowSync(new JSONFileSync('file.json'), {})
db.read()
db.write()

Methods

db.read()

Calls adapter.read() and sets db.data.

Note: JSONFile and JSONFileSync adapters will set db.data to null if file doesn't exist.

db.data // === null
db.read()
db.data // !== null
db.write()

Calls adapter.write(db.data).

db.data = { posts: [] }
db.write() // file.json will be { posts: [] }
db.data = {}
db.write() // file.json will be {}
db.update(fn)

Calls fn() then db.write().

db.update((data) => {
  // make changes to data
  // ...
})
// files.json will be updated

Properties

db.data

Holds your db content. If you're using the adapters coming with lowdb, it can be any type supported by JSON.stringify.

For example:

db.data = 'string'
db.data = [1, 2, 3]
db.data = { key: 'value' }

Adapters

Lowdb adapters

JSONFile JSONFileSync

Adapters for reading and writing JSON files.

import { JSONFile, JSONFileSync } from 'lowdb/node'

new Low(new JSONFile(filename), {})
new LowSync(new JSONFileSync(filename), {})
Memory MemorySync

In-memory adapters. Useful for speeding up unit tests. See src/examples/ directory.

import { Memory, MemorySync } from 'lowdb'

new Low(new Memory(), {})
new LowSync(new MemorySync(), {})
LocalStorage SessionStorage

Synchronous adapter for window.localStorage and window.sessionStorage.

import { LocalStorage, SessionStorage } from 'lowdb/browser'
new LowSync(new LocalStorage(name), {})
new LowSync(new SessionStorage(name), {})

Utility adapters

TextFile TextFileSync

Adapters for reading and writing text. Useful for creating custom adapters.

DataFile DataFileSync

Adapters for easily supporting other data formats or adding behaviors (encrypt, compress...).

import { DataFile } from 'lowdb/node'
new DataFile(filename, {
  parse: YAML.parse,
  stringify: YAML.stringify
})
new DataFile(filename, {
  parse: (data) => { decypt(JSON.parse(data)) },
  stringify: (str) => { encrypt(JSON.stringify(str)) }
})

Third-party adapters

If you've published an adapter for lowdb, feel free to create a PR to add it here.

Writing your own adapter

You may want to create an adapter to write db.data to YAML, XML, encrypt data, a remote storage, ...

An adapter is a simple class that just needs to expose two methods:

class AsyncAdapter {
  read() {
    /* ... */
  } // should return Promise<data>
  write(data) {
    /* ... */
  } // should return Promise<void>
}

class SyncAdapter {
  read() {
    /* ... */
  } // should return data
  write(data) {
    /* ... */
  } // should return nothing
}

For example, let's say you have some async storage and want to create an adapter for it:

import { Low } from 'lowdb'
import { api } from './AsyncStorage'

class CustomAsyncAdapter {
  // Optional: your adapter can take arguments
  constructor(args) {
    // ...
  }

  async read() {
    const data = await api.read()
    return data
  }

  async write(data) {
    await api.write(data)
  }
}

const adapter = new CustomAsyncAdapter()
const db = new Low(adapter, {})

See src/adapters/ for more examples.

Custom serialization

To create an adapter for another format than JSON, you can use TextFile or TextFileSync.

For example:

import { Adapter, Low } from 'lowdb'
import { TextFile } from 'lowdb/node'
import YAML from 'yaml'

class YAMLFile {
  constructor(filename) {
    this.adapter = new TextFile(filename)
  }

  async read() {
    const data = await this.adapter.read()
    if (data === null) {
      return null
    } else {
      return YAML.parse(data)
    }
  }

  write(obj) {
    return this.adapter.write(YAML.stringify(obj))
  }
}

const adapter = new YAMLFile('file.yaml')
const db = new Low(adapter, {})

Limits

Lowdb doesn't support Node's cluster module.

If you have large JavaScript objects (~10-100MB) you may hit some pe

readme truncated — read the full docs on github

Frequently asked questions

Is lowdb free to use?

lowdb is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does lowdb do?

Simple and fast JSON database

What is lowdb written in?

lowdb is primarily written in JavaScript. Its source is publicly available at https://github.com/typicode/lowdb, and it has 22,582 GitHub stars.