badger is a free, open source databases project written in Go and released under Apache-2.0. It has 15,761 GitHub stars, 1,318 forks and 69 open issues, and was last pushed 10 days ago. On this registry it ranks #47 of 143 tracked projects in Databases, with 5 head-to-head comparisons available.

What is badger?

BadgerDB is an embeddable, persistent, fast key-value database written in pure Go, aimed at Go developers who need local high-performance storage inside their own applications rather than a separate database server.

What it is

BadgerDB is a key-value store written entirely in Go and intended to be embedded directly in an application as a library. It is the underlying database for Dgraph, a fast distributed graph database, and the README describes it as a performant alternative to non-Go-based key-value stores such as RocksDB. The project is stable and, according to the README, is used to serve data sets worth hundreds of terabytes. It carries the Apache-2.0 licence, and its topic list places it among databases, document databases, key-value stores, Go libraries, and SSD-oriented storage.

The concrete problem it solves is the one a Go service hits when it needs durable local storage and the available engines sit outside its toolchain. RocksDB is not written in Go, and comparable embedded stores such as LMDB and BoltDB are also foreign to it. Badger keeps that layer inside Go, so it installs through Go modules and links into the same binary as the application. It handles the consistency work that would otherwise fall to the caller: concurrent ACID transactions with serializable snapshot isolation (SSI) guarantees, and persistence behaviour that has been checked against filesystem-level anomalies. Crash resilience is treated as a first-class concern, with the project publishing an ALICE write-up on that theme.

Key capabilities

  • Embeddable pure-Go key-value library, consumed through go get github.com/dgraph-io/badger/v4.
  • Concurrent ACID transactions with serializable snapshot isolation (SSI) guarantees.
  • A Jepsen-style bank test that runs nightly for 8 hours with the --race flag to confirm transactional guarantees hold.
  • Testing against filesystem-level anomalies to verify persistence and consistency.
  • A badger command line tool, installed with go install . from the repository, which performs operations such as offline backup and restore.
  • Built with Go 1.23, with v3 and above requiring Go modules; the version is deliberately held back to limit downstream effects on applications built with older Go releases.
  • Suitability for SSD-backed storage, reflected in the project topics and in the SSD-oriented design of the engine.

Who uses it and how

  • Dgraph uses Badger as its underlying database, which is the largest single proof of the engine running in a distributed graph product.
  • Jaeger Tracing embeds Badger as its storage layer, a case where a Go service needs durable local state without deploying a separate database.
  • UsenetExpress is listed among projects running Badger in production.
  • Workloads reach hundreds of terabytes, so the engine is not confined to small local caches.
  • Teams shipping Go programs can keep a single binary deployment shape, because Badger links into the application instead of running as a separate process.

Getting started

Install Go 1.23 or above, then run go get github.com/dgraph-io/badger/v4 from the project to retrieve the library. For the command line tool, check out the repository, run go install . inside the badger directory, and the utility lands in $GOBIN; documentation lives at badger.dgraph.io.

How it compares

The facts do not name any paid products that Badger replaces, so the comparison rests on the similar tools the README and blog posts do name. Badger positions itself specifically as the pure-Go alternative to RocksDB, and the project's own benchmarking material contrasts it with LMDB and BoltDB, both embedded key-value engines available to Go programs. All of these run locally and are licensed independently of Badger, which is Apache-2.0.

When to use it — and when not to

Choose Badger when a Go application needs an embedded, transactionally consistent key-value store with SSD storage and the team is willing to treat persistence as part of the application rather than as a separate service. Do not choose it if the requirement is a standalone server with a network protocol, multi-language clients, or operators who expect to manage a database independently of the code, since nothing in the README describes those capabilities. One honest gap in the supplied material: the Design section is truncated mid-sentence, so the engine's internal design goals and tuning guidance have to be read from the external documentation rather than from the README alone.

project readme (upstream, from github) — read inline

BadgerDB

Go Reference Go Report Card Sourcegraph ci-badger-tests ci-badger-bank-tests ci-badger-bank-tests-nightly

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.

Table of Contents

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

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

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.

Comparisons

Feature Badger RocksDB BoltDB
Design LSM tree with value log LSM tree only B+ tree
High Read throughput Yes No Yes
High Write throughput Yes Yes No
Designed for SSDs Yes (with latest research 1) Not specifically 2 No
Embeddable Yes Yes Yes
Sorted KV access Yes Yes Yes
Pure Go (no Cgo) Yes No Yes
Transactions Yes, ACID, concurrent with SSI3 Yes (but non-ACID) Yes, ACID
Snapshots Yes Yes Yes
TTL support Yes Yes No
3D access (key-value-version) Yes4 No No

1 The WISCKEY paper (on which Badger is based) saw big wins with separating values from keys, significantly reducing the write amplification compared to a typical LSM tree.

2 RocksDB is an SSD optimized version of LevelDB, which was designed specifically for rotating disks. As such RocksDB's design isn't aimed at SSDs.

3 SSI: Serializable Snapshot Isolation. For more details, see the blog post Concurrent ACID Transactions in Badger

4 Badger provides direct access to value versions via its Iterator API. Users can also specify how many versions to keep per key via Options.

Benchmarks

We have run comprehensive benchmarks against RocksDB, Bolt and LMDB. The benchmarking code, and the detailed logs for the benchmarks can be found in the badger-bench repo. More explanation, including graphs can be found the blog posts (linked above).

Projects Using Badger

Below is a list of known projects that use Badger:

  • Dgraph - Distributed graph database.
  • Jaeger - Distributed tracing platform.
  • go-ipfs - Go client for the InterPlanetary File System (IPFS), a new hypermedia distribution protocol.
  • Riot - An open-source, distributed search engine.
  • emitter - Scalable, low latency, distributed pub/sub broker with message storage, uses MQTT, gossip and badger.
  • OctoSQL - Query tool that allows you to join, analyse and transform data from multiple databases using SQL.
  • Dkron - Distributed, fault tolerant job scheduling system.
  • smallstep/certificates - Step-ca is an online certificate authority for secure, automated certificate management.
  • Sandglass - distributed, horizontally scalable, persistent, time sorted message queue.
  • TalariaDB - Grab's Distributed, low latency time-series database.
  • Sloop - Salesforce's Kubernetes History Visualization Project.
  • Usenet Express - Serving over 300TB of data with Badger.
  • gorush - A push notification server written in Go.
  • 0-stor - Single device object store.
  • Dispatch Protocol - Blockchain protocol for distributed application data analytics.
  • GarageMQ - AMQP server written in Go.
  • [RedixDB](https://alash3al

readme truncated — read the full docs on github

Frequently asked questions

Is badger free to use?

badger is open source under the Apache-2.0 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 badger do?

Fast key-value DB in Go.

What is badger written in?

badger is primarily written in Go. Its source is publicly available at https://github.com/dgraph-io/badger, and it has 15,761 GitHub stars.