explaingit

boltdb/bolt

Analysis updated 2026-06-24 · repo last pushed 2018-03-02

14,635GoAudience · developerComplexity · 3/5DormantSetup · easy

TLDR

Pure-Go embedded key-value database that stores everything in a single file, with ACID transactions and a tiny API. Project is archived in favour of CoreOS bbolt fork.

Mindmap

mindmap
  root((bolt))
    Inputs
      Database file
      Bucket name
      Key bytes
      Value bytes
    Outputs
      Stored values
      Iterators
      Transaction snapshots
      Backups
    Use Cases
      Embed local storage
      Build a small queue
      Cache structured data
      Ship a single-file app
    Tech Stack
      Go
      mmap
      B+tree
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add a persistent key-value store to a Go CLI without running a separate database server

USE CASE 2

Use buckets and nested buckets to organise structured records inside one file

USE CASE 3

Wrap db.Update and db.View transactions around your code for safe concurrent access

USE CASE 4

Migrate later to the maintained bbolt fork while keeping the same API and file format

What is it built with?

Gommap

How does it compare?

boltdb/boltbillionmail/billionmailsqshq/sampler
Stars14,63514,69914,563
LanguageGoGoGo
Last pushed2018-03-02
MaintenanceDormant
Setup difficultyeasymoderateeasy
Complexity3/53/52/5
Audiencedeveloperops devopsops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Project is no longer maintained, new code should use the bbolt fork instead, which has the same API.

In plain English

Bolt is an embedded key value database written in pure Go. Rather than running as a separate server like Postgres or MySQL, it lives as a library inside a Go program and stores data in a single file on disk. The README says it was inspired by an existing C database called LMDB and is meant for projects that need a simple, fast, and reliable place to keep data but do not need a full database server. The API is intentionally tiny: get a value, set a value, and not much more. The project status section is important context. Bolt is stable, the API is fixed, and the file format is fixed. It has full unit test coverage and randomised black box testing, and the README mentions companies like Shopify and Heroku running Bolt backed services with databases up to one terabyte in size. However, the original author Ben Johnson posted a message that he no longer has the time and energy to keep maintaining it. He considers the project complete and recommends people who want a more actively developed version look at the CoreOS fork called bbolt. The usage walkthrough starts with installation via go get, which also installs a bolt command line tool. To open a database you call bolt.Open with a filename, file permissions, and options. Bolt takes a file lock so two processes cannot open the same database file at once, you can pass a timeout option so it does not wait forever. All work happens inside transactions. Only one read write transaction can run at a time, but many read only transactions can run in parallel, and each transaction sees a consistent snapshot of the data as of when it started. The README shows how to start a read write transaction with db.Update, a read only transaction with db.View, and a batched form db.Batch that groups concurrent writes from multiple goroutines into fewer disk syncs at the cost of possibly retrying your function. There is also a lower level db.Begin for manual control. The rest of the README, indicated by its table of contents, goes deeper into buckets (named groups of keys), key and value pairs, iteration including prefix and range scans, nested buckets, backups, statistics, a read only mode, mobile use on iOS and Android, comparisons with relational databases and with LevelDB, RocksDB, and LMDB, plus caveats, limitations, and a list of other projects using Bolt. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
Write a Go program that uses bolt to store and retrieve user sessions in a single file
Prompt 2
Show me how to do a range scan over keys with a given prefix using bolt's cursor API
Prompt 3
Migrate a small bolt-based app to bbolt and explain which import paths and behaviours change
Prompt 4
Build a backup endpoint that streams a bolt database snapshot over HTTP using db.View
Prompt 5
Compare bolt to BadgerDB for a write-heavy embedded workload and tell me which fits

Frequently asked questions

What is bolt?

Pure-Go embedded key-value database that stores everything in a single file, with ACID transactions and a tiny API. Project is archived in favour of CoreOS bbolt fork.

What language is bolt written in?

Mainly Go. The stack also includes Go, mmap.

Is bolt actively maintained?

Dormant — no commits in 2+ years (last push 2018-03-02).

How hard is bolt to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is bolt for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.