v1.1.0 · Open Source · MIT License

STARKDB

A key-value based, B-tree implemented local database
designed for games, mobile apps & desktop applications.
Fast. Light. Simple.

B-Tree Engine ACID Compliant 0.5 µs Reads < 1 MB File Size 2–5 MB RAM CLI + C++ API
Get Started Try the Lab Read the Docs

What is STARKDB?

STARKDB is a lightweight embedded key-value database written in C. It stores data using a B-tree index across two files (.idx and .dat), delivering sub-microsecond reads with a footprint of only 2–5 MB of RAM. Built for offline games, mobile and desktop apps — where speed and simplicity matter most.


Why STARKDB?

0.5 µs
Read Speed

B-tree indexed lookups are effectively instant. Faster than SQLite, Redis, and MongoDB for single-record operations in local environments.

🪶
< 1 MB
File Size

Ultra-compact storage. A database with 1,000 records takes only ~100 KB. Perfect for resource-constrained environments.

🌳
B-Tree
Index Engine

O(log n) lookups, inserts, and deletes. Keys stay sorted. Range queries are efficient. No hash collisions on numeric keys.

🔒
ACID
Compliant

Atomic, Consistent, Isolated, Durable. Transactions with begin, commit, and rollback. Crash-safe append-only writes.

📐
Types
User-Defined Schemas

Define typed records with int and string(N) fields. Store game entities, configs, and inventory — all in one database.

🔑
3 Key Modes
Numeric · String · Typed

Use uint32 numeric keys for IDs, string keys for settings (djb2 hashed), or typed records for structured game data.


One Line. All It Takes.

CLI
# Open a database
stark_cli mygame

# Save data
stark> addn 1 "Hero"
stark> addn 2 "100 HP"

# Read it back
stark> getn 1
# Output: Hero

# Type system
stark> define player { name string(32) hp int level int }
stark> add player 1 name="Aldric" hp=120 level=8
stark> get player 1
C++
// Include and open
#include <stark.hpp>
stark::Database db("save");

// Save player data
db.add(1, "Hero");
db.add(2, "100 HP");

// Load it instantly
std::cout << db.get(1);

// Typed data
db.define_type("player", {
  Field("name", TYPE_STRING, 32),
  Field("hp",   TYPE_INT)
});
db.add_typed("player", 1,
  "name=Hero hp=100");

By The Numbers

0.5 µs
Read latency
0.8 µs
Write latency
2–5 MB
Memory usage
<1 MB
Disk footprint
5 min
Setup time
20 min
Learning curve

Should You Use STARKDB?

Choose STARKDB when...
🎮
You're making a game Built specifically for game developers
📱
You're offline-first No network. No server. Just files.
🚀
You need raw speed 0.5 µs reads — effectively instant
🪶
You need tiny footprint 2 MB memory, < 1 MB file size
🆓
You want it free Open source, MIT license
Skip STARKDB when...
🗃️
You need SQL queries Use SQLite instead
🌐
You need network access Use Redis or MongoDB instead
👥
You have multiple users Use PostgreSQL instead
📊
You're doing big data analytics Use MongoDB instead
🔍
You need complex queries Use SQLite instead

STARKDB excels at what it's designed for: simple, fast, local key-value storage. See the full documentation to explore all commands and APIs, or try the Lab to experiment interactively.


Try STARKDB in Your Browser

The interactive lab lets you run STARKDB commands, visualize B-tree operations, explore djb2 hashing, and solve practice challenges — all without installing anything.

Open the Lab Install Locally

Questions or Feedback?

For questions, advice, or to report an issue, feel completely free to reach out.

[email protected]