tinykv
A minimal file-backed key-value store for Rust.
Why I built this
I was working on Tazı (named after the Turkish sighthound), a JS/TS test runner and Jest alternative, when I needed simple persistent storage for test configurations and app settings.
I tried existing solutions:
- sled felt like overkill for storing simple config
- pickledb looked good but seemed unmaintained
- Rolling my own JSON persistence was getting repetitive
So I built tinykv - the simple KV store I wish existed. Turns out other Rust developers had the same problem.
Features
- JSON file storage (human-readable, git-friendly)
- Optional TTL (expiration) per key
- Auto-save and backup options
- Atomic writes (no corruption)
- Simple serde integration
Feature Flags
- default: Uses
serdefor maximum compatibility - nanoserde: Uses
nanoserdefor smaller binaries and faster compilation
Usage
# Default (serde)
= "0.2"
# Minimal (nanoserde)
= { = "0.2", = false, = ["nanoserde"] }
use TinyKV;
The file looks like this:
When to use tinykv
Good for:
- CLI tool configuration
- Game save files
- Application settings
- Test data that needs persistence
- Prototyping without database setup
Not for:
- High-performance applications
- Complex queries or relationships
- Multi-user concurrent access
- Large datasets
Comparison
| tinykv | sled | pickledb | |
|---|---|---|---|
| Setup complexity | Zero | Low | Zero |
| File format | Human-readable JSON | Binary | JSON |
| TTL support | Yes | No | No |
| Maintenance | Active | Stalled | Unmaintained |
| Learning curve | Minutes | Hours | Minutes |
API Documentation
License
MIT License - see the full text in the repository.