Repolode
dgraph-io

dgraph-io/badger

An embeddable, persistent key-value database written in pure Go, with ACID transactions and SSD-oriented design.

Stars
15,786
Forks
1,334
Open issues
76
Last commit
yesterday

What is it?

BadgerDB is an embeddable, persistent key-value store written entirely in Go. It runs inside your application process rather than as a separate server, and it is the storage engine underneath the Dgraph graph database.

Badger is built on an LSM tree with a separate value log, based on the WiscKey design, which keeps values out of the key index to reduce write amplification on SSDs. It supports concurrent ACID transactions with serializable snapshot isolation, iterators with prefix and key-range scans, per-key versions, and TTL. Because it avoids Cgo, it builds with the standard Go toolchain.

The project also ships a CLI for operations such as offline backup and restore, and it is available as a Go module at github.com/dgraph-io/badger/v4.

Key features

  • 01Embeddable key-value store written in pure Go with no Cgo dependency.
  • 02Concurrent ACID transactions with serializable snapshot isolation.
  • 03Key-value separation with a value log to reduce write amplification on SSDs.
  • 04Iterators with prefix and key-range scans, plus access to multiple versions per key.
  • 05TTL support for automatic key expiration.
  • 06Command-line tool for offline backup and restore.

Use cases

  • Embedding a fast local persistent store in a Go service or CLI tool.
  • Serving as the storage layer for a distributed system or graph database.
  • Building a Raft log or metadata store in Go applications.
  • Storing large datasets on SSDs where read and write throughput matter.

Quick start

  1. 1

    Install the library into your Go project

    go get github.com/dgraph-io/badger/v4
  2. 2

    Install the Badger command line tool from a checked-out repository

    cd badger go install .

Things to know

  • Requires Go 1.23 or above.

Topics

FAQ

What is badger?
An embeddable, persistent key-value database written in pure Go, with ACID transactions and SSD-oriented design. BadgerDB is an embeddable, persistent key-value store written entirely in Go. It runs inside your application process rather than as a separate server, and it is the storage engine underneath the Dgraph graph database.
Is badger free to use? What license does it have?
badger is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is badger still maintained?
Actively maintained. The last commit to badger was on Oct 20, 2026.
What can I use badger for?
Embedding a fast local persistent store in a Go service or CLI tool. Serving as the storage layer for a distributed system or graph database. Building a Raft log or metadata store in Go applications. Storing large datasets on SSDs where read and write throughput matter.
How do I install badger?
Install the library into your Go project: go get github.com/dgraph-io/badger/v4 Install the Badger command line tool from a checked-out repository: cd badger go install .
Where can I get badger?
The source code and installation instructions are on GitHub: https://github.com/dgraph-io/badger

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects