BadgerDB is an embeddable, persistent key-value database written in Go. It supports concurrent ACID transactions with serializable snapshot isolation.
Overview
BadgerDB is a key-value database meant to be linked into Go applications rather than run as a separate server. It persists data on disk and is optimized for SSD-oriented access patterns, following a design that separates keys from values to reduce write amplification compared with typical LSM trees.
The database supports concurrent ACID transactions with serializable snapshot isolation, snapshots, TTL on keys, and versioned access to values through its iterator APIs. It is embeddable, offers sorted key iteration, and is implemented in pure Go without cgo. A command-line utility supports offline backup and restore operations.
Badger serves as the storage layer for projects such as Dgraph and is used in production for large datasets. It gives teams that want a Go-native embeddable store an alternative to key-value engines implemented outside Go. Platform-specific code handles directory locking and fsync on Linux, macOS, BSD, Windows, and several other targets.
Documentation covers installation via Go modules, encryption at rest, troubleshooting, and design comparisons with other embeddable stores. A maintained list of downstream adopters spans tracing, messaging, certificate management, and other domains.
Key features
- Embeddable Go key-value store
- ACID transactions with SSI
- SSD-oriented LSM plus value log
- Pure Go without cgo
- TTL and multi-version keys
- Snapshots and iterators
- CLI backup and restore tool
- Encryption at rest support
Use cases
- Embedded app storage in Go
- High-throughput local KV workloads
- Foundation for graph or trace backends
- Offline backup via Badger CLI
- Replacing non-Go embeddable stores