DEV.co
Open-Source Databases · tidwall

buntdb

BuntDB is a lightweight, in-memory key-value database written in Go that persists to disk and supports custom indexing and geospatial queries. It's designed for applications that prioritize speed and simplicity over handling massive datasets, with ACID-compliant transactions and flexible search capabilities.

Source: GitHub — github.com/tidwall/buntdb
4.9k
GitHub stars
304
Forks
Go
Primary language
MIT
License (OSI-approved)

Key facts

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

FieldValue
Repositorytidwall/buntdb
Ownertidwall
Primary languageGo
LicenseMIT — OSI-approved
Stars4.9k
Forks304
Open issues32
Latest releaseUnknown
Last updated2026-05-19
Sourcehttps://github.com/tidwall/buntdb

What buntdb is

BuntDB provides an embeddable Go library using B-tree and R-tree data structures for ordered key-value storage, custom indexes, and spatial queries up to 20 dimensions. It enforces single-writer/multiple-reader locking, append-only persistence, and transaction-based operations with rollback support.

Quickstart

Get the buntdb source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/tidwall/buntdb.gitcd buntdb# follow the project's README for install & configuration

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

Best use cases

Geospatial/Location-Based Services

Native R-tree spatial indexing with support up to 20 dimensions makes this ideal for location tracking, fleet management, or geographic query applications where data fits in memory.

Embedded Application State & Caching

As an embeddable library with simple API and no external processes, BuntDB suits Go applications needing fast, persistent local state storage—config systems, session caches, or embedded analytics.

Custom Index Requirements with Moderate Scale

The ability to define custom indexes on JSON fields or application types, combined with range and equality queries, works well for moderate-scale business logic without SQL complexity.

Implementation considerations

  • Memory footprint: entire dataset must fit in RAM; monitor heap usage and set TTL/eviction policies if dataset grows unbounded.
  • Transaction API: all reads/writes must occur within explicit db.View() or db.Update() closures; refactor existing code patterns accordingly.
  • Index schema: custom indexes must be created before data insertion; plan index strategy during schema design, not ad-hoc.
  • Persistence tuning: append-only log can grow large; understand rewrite/compaction behavior and schedule maintenance windows.
  • Go-only library: requires Go runtime; no bindings for other languages without custom RPC wrapper.

When to avoid it — and what to weigh

  • Large-scale or High-volume Data — In-memory design means dataset must fit in RAM. Not suitable for multi-gigabyte datasets or high-throughput write scenarios requiring distributed replication.
  • Multi-writer/Concurrent Write Workloads — Single-writer locking architecture serializes write transactions, creating bottlenecks in applications with heavy concurrent updates from multiple sources.
  • Complex Query/Aggregation Logic — Lacks SQL, aggregation functions, or group-by operations. Applications requiring complex joins, subqueries, or reporting need a full RDBMS.
  • Network/Remote Access Requirements — Embeddable-only design; no built-in server protocol (HTTP, gRPC). Multi-process or multi-machine access requires wrapping in custom middleware.

License & commercial use

Licensed under MIT License, a permissive OSI-approved license allowing unrestricted use, modification, and distribution.

MIT License permits commercial use without restriction. No copyleft obligations. Ensure compliance with dependency licenses if bundled; review any upstream Go module licenses (data not provided).

DEV.co evaluation signals

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

SignalAssessment
MaintenanceModerate
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

No encryption at rest or in transit mentioned; in-process only, so network sniffing not applicable. File-based persistence readable by any process with filesystem access. No access control or authentication layer. Consider encrypting the append-only file if sensitive data stored. Append-only design mitigates some corruption scenarios but not tampering.

Alternatives to consider

SQLite

File-based embedded SQL database with stronger query language and lower memory overhead. Better for complex queries; similar in-process deployment model.

Badger/LevelDB (Go)

Log-structured merge-tree key-value stores; better suited for write-heavy workloads and larger datasets. No spatial indexing but more mature distributed ecosystem.

PostgreSQL with JSON + PostGIS

Full RDBMS with native JSON and geospatial support, client-server architecture, and enterprise hardening. Overkill for embedded use cases but necessary for multi-process/remote access and complex analytics.

Software development agency

Build on buntdb with DEV.co software developers

Our team can assess BuntDB fit for your architecture, design index and transaction patterns, and integrate it into your application. Let's discuss your specific scale and query requirements.

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.

buntdb FAQ

Can BuntDB handle datasets larger than available RAM?
No. BuntDB is fundamentally in-memory; the entire dataset must fit in RAM. Use TTL/eviction for unbounded streams, or migrate to a disk-based system (LevelDB, RocksDB) for larger scales.
Is BuntDB suitable for multi-service architecture?
Not natively. BuntDB is embedded in a single Go process. Multi-service access requires wrapping it in a network server (custom HTTP/gRPC). Consider PostgreSQL or a dedicated key-value service if true distributed access needed.
Does BuntDB support SQL queries?
No. BuntDB is a key-value store with custom indexes and range queries. Complex filtering, aggregation, and joins must be implemented in application code.
What happens if the process crashes?
Append-only file persists committed transactions. On restart, the database replays the log and recovers to the last committed state. No committed writes are lost, but unflushed in-flight transactions may be rolled back.

Custom software development services

From first prototype to production, DEV.co delivers software development services around tools like buntdb. Our software development agency staffs experienced software developers and web developers for custom software development, web development, integrations, and ongoing support across open-source databases and beyond.

Need Help Evaluating BuntDB for Your Go Project?

Our team can assess BuntDB fit for your architecture, design index and transaction patterns, and integrate it into your application. Let's discuss your specific scale and query requirements.