Skip to content

Bolt

A small embedded key/value database for Go programs, now archived and no longer maintained.

Stars
14.6k
Forks
1.5k
Licence
MIT
Language
Go
Last update
8.7 years ago
Type
Library

This repository is archived and no longer maintained.

What it is

Bolt is a pure Go key/value store that saves all data in a single file on disk, so a Go program can keep structured data without running a separate database server. It was built for simple, fast, reliable storage in projects that do not need something like Postgres or MySQL. The project is archived, and its author says development has stopped.

  • Store application settings or small records in a single local file inside a Go program
  • Keep a key/value index for a Go service without running Postgres or MySQL
  • Run consistent read-only snapshots of data while writes happen in separate transactions
  • Batch many small writes together using DB.Batch() when several goroutines write at once

Great for

  • Go developers who need a small embedded store inside an application
  • Projects that want data in one file with no separate database server to run
  • People maintaining existing Go services that already depend on Bolt
  • Developers who need simple get and set operations rather than SQL queries

Not ideal for

  • Teams starting a new project, since the author has stopped development and suggests the bbolt fork instead (no further fixes are expected)
  • Non-Go projects, because it is a Go library
  • Apps needing SQL, complex queries, or multiple server processes writing at once, because Bolt allows only one read-write transaction at a time and locks the file to one process

How to get it

  1. 1

    Install with a package manager

    You'll need: Go

    Install the library and bolt command line utility

    go get github.com/boltdb/bolt/...
  2. 2

    Run it

    • Install Go and run the go get command from the README
    • Import github.com/boltdb/bolt in your Go code
    • Call bolt.Open("my.db", 0600, nil) to create or open a database file
    • Use db.Update() to write and db.View() to read inside transactions
  3. 3

    Get the most out of it

    • Pass bolt.Options with a Timeout to bolt.Open() so a locked file does not hang the program forever
    • Use DB.Batch() when many goroutines write at the same time, keeping the function idempotent
    • Use DB.View() and DB.Update() instead of manual transactions unless you need manual control
    • Consider the CoreOS bbolt fork, which the author recommends for a more featureful version

Downloads

Strengths

  • Small, focused API for getting and setting values, as the README describes
  • Stores the whole database in one file, which keeps deployment simple
  • README reports use in production systems and tests for consistency and thread safety

Trade-offs

  • Archived with the last push in March 2018, so there are no further updates or fixes
  • Only one read-write transaction at a time, and the file lock stops other processes from opening the same database

How it compares

ProjectStarsTypeLevelUpdatedBest for
bolt (this)14.6kLibraryintermediate8.7 years agoGo developers who need a small embedded store inside an application
duckdb42.7kLibrarybeginner4 days agoAnalysts who want to run SQL directly on CSV, Parquet, or JSON files
turso25.1kLibraryintermediate4 days agoDevelopers who want an embedded SQLite-compatible database in a Rust, JavaScript, Python, Java, Go, or .NET project
lowdb22.6kLibrarybeginner7 months agoNode.js developers building small tools or prototypes that need simple persistent storage
efcore14.8kLibraryintermediate4 days agoC# developers building .NET applications that use a relational or document database
kysely14.3kLibraryintermediate4 days agoTypeScript developers who want SQL control without losing compile-time type checks

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.