Badger

active

by Dgraph (Istari Digital) · since 2017 · also known as BadgerDB

Pure-Go LSM key-value store that separates keys from values to cut write amplification.

key-valueembedded libraryopen source (permissive)mature

Overview

Badger is an embeddable, persistent key-value store written in pure Go, created by Dgraph Labs as the storage engine for the Dgraph graph database. It follows the WiscKey design: keys live in the LSM tree while larger values go to a value log, which keeps the tree small and reduces write amplification on SSDs. It offers serializable snapshot-isolation transactions, TTLs, encryption at rest and a change subscription API, without cgo. Ownership passed from Dgraph Labs to Hypermode and, in October 2025, to Istari Digital with the rest of Dgraph; releases have continued in the v4 line. Value-log garbage collection needs attention in write-heavy deployments.

Strengths & trade-offs

Strengths

  • +Pure Go with no cgo, so builds and cross-compiles cleanly
  • +Key-value separation reduces write amplification for larger values
  • +Serializable snapshot-isolation transactions with MVCC
  • +Built-in TTL, encryption at rest and an in-memory mode
  • +Subscribe API streams key changes to the application

Trade-offs

  • −Value-log garbage collection must be scheduled and tuned
  • −Go-only API
  • −Ownership changed twice since 2023 (Hypermode, then Istari Digital)
  • −Higher memory use than B-tree stores like bbolt

Great for

  • +Storage layer for Go databases and services
  • +Embedded state for Go daemons and CLIs
  • +Write-heavy local key-value workloads with medium-to-large values

Think twice for

  • −Non-Go applications
  • −Tiny memory-constrained devices
  • −Distributed storage without an extra layer

Capabilities

Native or official first-party support · 8 of 25 tracked

✓Transactions
✓TTL / expiry
✓Pub/Sub
✓In-memory
✓Durable persistence
✓Compression
✓Encryption at rest
✓Time travel
–Joins
–Secondary indexes
–Full-text search
–Vector search
–Geospatial
–JSON
–Change data capture
–Triggers
–Stored procedures
–Materialized views
–Columnar storage
–Role-based access
–Branching
–Online schema changes
–Streaming ingest
–Offline sync
–Runs in WebAssembly

Scale & consistency

Comfortable data size
Medium · ≤ 10 TB
Horizontal scaling
None
Multi-region
No
Transactions
Full ACID
Consistency
Strong
Schema
Schemaless
Architecture
Embedded
Query languages
Go API

Single-process library; terabyte-scale stores are used under Dgraph.

Deployment

Self-hosted Vendor-managed cloud Serverless Embedded Edge Kubernetes operator

Ecosystem

apis & protocolsGo API
client languagesGo

Alternatives to Badger

Compare all→
bboltKey-Value11.5

etcd's maintained fork of BoltDB: a simple, pure-Go B+tree store in a single file.

badger vs bbolt →
PebbleKey-Value5.6

Cockroach Labs' Go LSM engine, inspired by RocksDB and tuned for CockroachDB.

badger vs pebble →
RocksDBKey-Value48.2

Meta's embeddable LSM-tree key-value engine, the storage layer under dozens of databases.

badger vs rocksdb →
NutsDBKey-Value3.6

Pure-Go embedded key-value store with Bitcask storage and Redis-like lists, sets and sorted sets.

badger vs nutsdb →
LMDBKey-Value39.7

Tiny memory-mapped B+tree with ACID transactions and lock-free readers; reached 1.0 in 2026.

badger vs lmdb →
libmdbxKey-Value4.9

Heavily reworked LMDB descendant: memory-mapped ACID B+tree with auto-growing files.

badger vs libmdbx →

Badger FAQ

What is Badger?

Badger is a key-value database by Dgraph (Istari Digital), first released in 2017. Badger is an embeddable, persistent key-value store written in pure Go, created by Dgraph Labs as the storage engine for the Dgraph graph database. It follows the WiscKey design: keys live in the LSM tree while larger values go to a value log, which keeps the tree small and reduces write amplification on SSDs. It offers serializable snapshot-isolation transactions, TTLs, encryption at rest and a change subscription API, without cgo. Ownership passed from Dgraph Labs to Hypermode and, in October 2025, to Istari Digital with the rest of Dgraph; releases have continued in the v4 line. Value-log garbage collection needs attention in write-heavy deployments.

Is Badger open source?

Yes. Badger is open source. License: Apache License 2.0.

Does Badger support ACID transactions?

Yes. Badger supports full ACID transactions, with strong consistency.

Does Badger scale horizontally?

Badger does not scale horizontally; it runs on a single node, so you scale it up rather than out. It is comfortable at medium scale (≤ 10 TB).

How can I run Badger?

You can self-host it and embed it in your application.

What is Badger best for?

Badger is a strong fit for storage layer for Go databases and services; embedded state for Go daemons and CLIs; and write-heavy local key-value workloads with medium-to-large values. Think twice for non-Go applications.

What are the best alternatives to Badger?

Common alternatives to Badger include bbolt, Pebble, RocksDB, NutsDB and LMDB. The right choice depends on your workload, scale and hosting; WhichDB's smart match ranks them against your requirements.

How popular is Badger?

Badger ranks #294 of 844 databases on the WhichDB Score (10.7/100), and #39 among key-value databases. The score combines public adoption signals such as package downloads, GitHub activity, job posts and developer discussion.