ConfigsJul 16, 2026·3 min read

NutsDB — Fast Embeddable Key-Value Store in Pure Go

A simple, fast, embeddable, and persistent key/value store written in pure Go with support for lists, sets, sorted sets, and fully serializable transactions.

Agent ready

Review-first install path

This asset needs a review step. The copied prompt tells the agent to dry-run, show the writes, then proceed only after confirmation.

Needs Confirmation · 64/100Policy: confirm
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
NutsDB
Review-first command
npx -y tokrepo@latest install 5180acdf-8156-11f1-9bc6-00163e2b0d79 --target codex

Dry-run first, confirm the writes, then run this command.

Introduction

NutsDB is an embeddable, persistent key/value store written in pure Go. It supports multiple data structures including strings, lists, sets, and sorted sets, all within a single-file database with ACID transaction guarantees. It is designed for applications that need a fast embedded database without running a separate server process.

What NutsDB Does

  • Stores key/value pairs with optional TTL expiration
  • Supports list, set, and sorted set data structures within buckets
  • Provides fully serializable ACID transactions
  • Persists data using an append-only log with automatic compaction
  • Offers prefix and range scan operations for ordered iteration

Architecture Overview

NutsDB uses a bitcask-inspired append-only write model combined with an in-memory index (B+ tree or hash map) for fast lookups. All writes go to a write-ahead entry log on disk, while the in-memory index maps keys to their on-disk positions. Background merge processes compact old log segments to reclaim space. Transactions use a copy-on-write approach with commit-time conflict detection.

Self-Hosting & Configuration

  • Import as a Go module: go get github.com/nutsdb/nutsdb
  • Open a database by specifying a data directory path
  • Configure segment size, sync strategy, and index type via options
  • Choose between B+ tree index (range scans) or hash map index (point lookups)
  • Set entry-level TTL for automatic expiration of stale data

Key Features

  • Pure Go implementation with zero CGo dependencies
  • Multiple data structures (KV, list, set, sorted set) in a unified API
  • B+ tree index mode enabling efficient prefix and range scans
  • Configurable TTL per entry for cache-like expiration behavior
  • Automatic log segment merging for space reclamation

Comparison with Similar Tools

  • BoltDB/bbolt — B+ tree with page-level MVCC; NutsDB uses a bitcask log with richer data structures (lists, sets)
  • BadgerDB — LSM-tree optimized for SSDs; NutsDB uses an append-only log with simpler compaction
  • LevelDB/RocksDB — C/C++ engines; NutsDB is pure Go with no CGo overhead
  • Redis — in-memory server with similar data structures; NutsDB is an embedded library with disk persistence

FAQ

Q: Does NutsDB support concurrent access? A: Yes, NutsDB supports concurrent reads and serialized writes within a single process using its transaction system.

Q: How does TTL work? A: Each entry can be stored with a TTL in seconds. Expired entries are cleaned up during reads and background merge operations.

Q: What index modes are available? A: NutsDB offers B+ tree index mode for range scans and prefix queries, and hash map index mode for faster point lookups.

Q: Is NutsDB suitable for production use? A: NutsDB is used in production by several projects. It works well for embedded storage scenarios where a separate database server is not desired.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets