DEV.co
Open-Source Databases · dgraph-io

badger

Badger is a fast, embeddable key-value database written in pure Go. It is designed for SSD-optimized workloads and serves as the underlying storage for Dgraph and other production systems handling terabytes of data.

Source: GitHub — github.com/dgraph-io/badger
15.7k
GitHub stars
1.3k
Forks
Go
Primary language
Apache-2.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorydgraph-io/badger
Ownerdgraph-io
Primary languageGo
LicenseApache-2.0 — OSI-approved
Stars15.7k
Forks1.3k
Open issues68
Latest releasev4.9.3 (2026-07-06)
Last updated2026-07-07
Sourcehttps://github.com/dgraph-io/badger

What badger is

Badger implements an LSM tree with a separate value log architecture (based on WiscKey), supporting concurrent ACID transactions with serializable snapshot isolation (SSI). It is written in pure Go with no Cgo dependencies, offers sorted KV access, TTL support, and multi-version capabilities.

Quickstart

Get the badger source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/dgraph-io/badger.gitcd badger# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

SSD-optimized embedded storage for Go applications

Badger is purpose-built for SSDs and achieves high throughput in both read and write scenarios. Ideal for Go microservices, CLI tools, and services that need to embed persistent storage without external dependencies.

High-throughput transactional workloads with ACID guarantees

The nightly Jepsen-style bank tests validate concurrent ACID transactions with SSI guarantees. Use where strong consistency and multiple concurrent transactions matter more than eventual consistency.

Time-series and versioned data storage

Built-in TTL support, multi-version key access, and documented use in TalariaDB (time-series) and similar projects show fitness for append-heavy and versioned data patterns.

Implementation considerations

  • Requires Go 1.23 or above; refrain from aggressive Go version bumps to minimize downstream breakage in consuming applications.
  • ACID transactions with SSI provide strong consistency but may require application-level deadlock handling and retry logic for concurrent workloads.
  • Value separation architecture trades write amplification for compaction pressure; monitor log file growth and enable periodic garbage collection.
  • TTL and multi-version support must be explicitly configured; default behavior keeps all versions indefinitely until explicit cleanup.
  • CLI tool (badger command) provides offline backup/restore but no live replication; backup strategy must be application-managed.

When to avoid it — and what to weigh

  • Need distributed replication out-of-the-box — Badger is a single-node embedded database. Replication and clustering must be implemented in application logic; consider Dgraph if you need a distributed layer.
  • Require non-Go language bindings or cross-platform SDKs — Badger is Go-native only. Projects needing Node.js, Python, Java, or other language APIs should explore RocksDB or other polyglot KV stores.
  • Must minimize memory footprint in memory-constrained environments — LSM trees with value logs trade memory and disk I/O for write throughput. Highly memory-constrained devices may find B-tree databases more suitable.
  • Need rotating disk (HDD) optimization — Badger is explicitly SSD-optimized. Performance on HDDs is not a design goal and will likely be poor due to the LSM architecture.

License & commercial use

Badger is licensed under Apache License 2.0 (Apache-2.0), a permissive OSI-approved open-source license.

Apache-2.0 is a permissive license that permits commercial use, modification, and distribution. Consult legal counsel to confirm compliance with attribution and liability disclaimers, especially for mission-critical deployments. No proprietary or restricted-use clauses apply.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitStrong
Assessment confidenceHigh
Security considerations

Badger is used in production systems handling terabytes of data; nightly Jepsen-style testing with race flags validates transaction correctness and consistency under anomalies. No publicly disclosed CVEs reviewed here. No security audit details provided in data; evaluate encryption-at-rest and authentication requirements separately—Badger itself does not provide built-in encryption or user access controls. Data persistence and crash resilience are validated; treat as part of threat model for sensitive data.

Alternatives to consider

RocksDB

Battle-tested LSM tree with wider language bindings and ecosystem tools. Choose if non-Go integration or broader deployment flexibility is required, accepting higher complexity and C++ footprint.

BoltDB

Pure Go B-tree database with simpler transaction model (non-concurrent ACID). Lower write throughput but smaller footprint; suitable for modest-scale, read-heavy workloads.

Dgraph (for distributed graph queries)

If full-featured distributed graph queries and replication are needed, Dgraph (which uses Badger internally) eliminates the application-level orchestration burden.

Software development agency

Build on badger with DEV.co software developers

Assess your SSD infrastructure, Go stack, and single-node requirements. Review the official documentation and benchmarks at badger.dgraph.io, then prototype with v4 to validate write/read throughput.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

badger FAQ

Can I use Badger in a distributed system?
Badger is single-node only. For distributed scenarios, implement replication at the application layer or use Dgraph (which wraps Badger with distributed logic). Badger is embedded, not a networked service.
Does Badger provide encryption?
Not mentioned in provided documentation. Evaluate encryption requirements separately; encryption-at-rest or in-transit would need custom implementation or OS-level disk encryption.
What is the minimum Go version?
Go 1.23 or above. Badger intentionally avoids aggressive version bumps to reduce downstream breakage.
Is Badger suitable for my HDD-based server?
No. Badger is explicitly optimized for SSDs; LSM tree behavior on spinning disks will suffer from poor I/O patterns. Consider RocksDB or other HDD-friendly options.

Custom software development services

Need help beyond evaluating badger? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and open-source databases integrations — and maintain them long-term.

Ready to evaluate Badger for your project?

Assess your SSD infrastructure, Go stack, and single-node requirements. Review the official documentation and benchmarks at badger.dgraph.io, then prototype with v4 to validate write/read throughput.