dgraph-io /badger

Fast key-value DB in Go.

★ 15,803⑂ 1,344👁 220⑃ 1,481● 862▤ 60
GoApache-2.0Created 2017-01-26dgraph-io.github.io/badger/
Download: v4.9.6v4.9.6 ↓4.9.62026-08-05
+2
Daily
15,803
stars
1,344
forks
220
watchers
1,481
prs
862
issues
60
releases

README

BadgerDB








!Badger mascot

BadgerDB is an embeddable, persistent and fast key-value (KV) database written in pure Go. It is the
underlying database for Dgraph, a fast, distributed graph
database. It's meant to be a performant alternative to non-Go-based key-value stores like RocksDB.

 Project Status

Badger is stable and is being used to serve data sets worth hundreds of terabytes. Badger supports
concurrent ACID transactions with serializable snapshot isolation (SSI) guarantees. A Jepsen-style
bank test runs nightly for 8h, with --race flag and ensures the maintenance of transactional
guarantees. Badger has also been tested to work with filesystem level anomalies, to ensure
persistence and consistency. Badger is being used by a number of projects which includes Dgraph,
Jaeger Tracing, UsenetExpress, and many more.

The list of projects using Badger can be found here.

Please consult the [Changelog] for more detailed information on releases.

Note: Badger is built with go 1.23 and we refrain from bumping this version to minimize downstream
effects of those using Badger in applications built with older versions of Go.

[Changelog]: https://github.com/dgraph-io/badger/blob/main/CHANGELOG.md

 Table of Contents

- BadgerDB
  - Project Status
  - Table of Contents
  - Getting Started
    - Installing
      - Installing Badger Command Line Tool
      - Choosing a version
  - Badger Documentation
  - Resources
    - Blog Posts
  - Design
    - Comparisons
    - Benchmarks
  - Projects Using Badger
  - Contributing
  - Contact

 Getting Started

 Installing

To start using Badger, install Go 1.23 or above. Badger v3 and above needs go modules. From your
project, run the following command

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


This will retrieve the library.

 Installing Badger Command Line Tool

Badger provides a CLI tool which can perform certain operations like offline backup/restore. To
install the Badger CLI, retrieve the repository and checkout the desired version. Then run

sh
cd badger
go install .


This will install the badger command line utility into your $GOBIN path.

 Badger Documentation

Badger Documentation is available at https://badger.dgraph.io

 Resources

 Blog Posts

1. Introducing Badger: A fast key-value store written natively in Go
2. Make Badger crash resilient with ALICE
3. Badger vs LMDB vs BoltDB: Benchmarking key-value databases in Go
4. Concurrent ACID Transactions in Badger

 Design

Badger was written with these design goals in mind:

- Write a key-value database in pure Go.
- Use latest research to build the fastest KV database for data sets spanning terabytes.
- Optimize for SSDs.

Badger’s design is based on a paper titled _[WiscKey: Separating Keys from Values in SSD-conscious
Storage][wisckey]_.

[wisckey]: https://www.usenix.org/system/files/conference/fast16/fast16-papers-lu.pdf

 Comparisons

| Feature                       | Badger                                     | RocksDB                       |

Top issues

Latest release

v4.9.6 v4.9.6 2026-08-05
What's Changed
 fix(compaction): restore size-ratio base level selection, clamped to the first non-empty level by @shiva-istari in https://github.com/dgraph-io/badger/pull/2330


Full Changelog: https://github.com/dgraph-io/badger/compare/v4.9.5...v4.9.6

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON