tinykv
A minimal file-backed key-value store for Rust with no_std support.
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
- no_std support for embedded systems
- Works in WASM environments
Feature Flags
- default: Uses
serdefor maximum compatibility - std: Enables standard library features (file I/O, TTL)
- nanoserde: Uses
nanoserdefor smaller binaries and faster compilation
Usage
# Default (std + serde)
= "0.3"
# Embedded systems (no_std + nanoserde)
= { = "0.3", = false, = ["nanoserde"] }
# Ultra-minimal (pure no_std)
= { = "0.3", = false }
Standard usage (with file I/O)
use TinyKV;
The file looks like this:
Embedded/WASM usage (no_std)
extern crate alloc;
use TinyKV;
When to use tinykv
Good for:
- CLI tool configuration
- Game save files
- Application settings
- Test data that needs persistence
- Prototyping without database setup
- Embedded systems and IoT devices
- WASM applications
Not for:
- High-performance applications
- Complex queries or relationships
- Multi-user concurrent access
- Large datasets
Platform Support
tinykv works across different environments:
- Desktop applications: Full features with file I/O, TTL, backups
- Embedded systems: Memory-efficient with nanoserde serialization
- WASM projects: Browser-compatible with minimal footprint
- IoT devices: Ultra-minimal string-based storage
API Documentation
License
MIT License - see the full text in the repository.