Skip to main content
All projects

NubDB

An in-memory key-value store written in Zig with append-only persistence and background compaction, plus client libraries across seven languages and a web console.

Open source
Project
In-memory database
Language
Zig
Started
2026-01

The story

NubDB is a socket-addressable in-memory key-value engine in Zig 0.13 — SET, GET, DEL, EXISTS, INCR, DECR, SIZE, CLEAR, with optional TTLs. It is not trying to replace Redis. It is the project where I stopped treating a data store as a black box.

Writing the hash table, the lock discipline and the append-only log by hand made the tradeoffs concrete in a way that reading about them did not. Compaction runs in the background because an append-only log that only grows is a restart-time problem waiting to happen.

Six client libraries exist mostly as a forcing function: a wire protocol that is genuinely simple is one you can reimplement in an afternoon in a language you do not use much.

Under the hood

The decisions that make it work.

Engine
A hand-written hash table behind an RwLock, with atomic operation counters and per-key TTL expiry.
Persistence
Append-only log writer with asynchronous compaction, so restart replays a bounded file.
Clients
Published SDKs for Python, Rust, Go, Java, Ruby and Node against one wire protocol — the useful test of whether that protocol is actually simple.
Operations
Next.js and Prisma console for provisioning and monitoring, with Kubernetes manifests for deployment.

Built with

  • Zig
  • TypeScript
  • Go
  • Rust
  • Python
  • Kubernetes