Skip to content
/ minikv Public

A production-ready distributed key-value store with Raft consensus.

License

Notifications You must be signed in to change notification settings

whispem/minikv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

271 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

๐Ÿฆ€ minikv

A distributed, multi-tenant key-value & object store written in Rust

minikv provides strong consistency (Raft + 2PC), durability (WAL), and production-grade observability, security, and multi-tenancy โ€” all in a modern Rust codebase.

Built in public as a learning-by-doing project โ€” now evolved into a complete, reference implementation of distributed systems in Rust.

Repo Rust License: MIT Production Grade Build Status


๐Ÿšฆ What's New in v0.8.0

minikv v0.8.0 brings enterprise-grade features for distributed deployments:

  • Cross-datacenter replication: Async replication with multiple conflict resolution strategies (LWW, Vector Clocks)
  • Change Data Capture (CDC): Real-time event streaming to Webhook, Kafka, or file sinks
  • Admin Web UI: Embedded dashboard for cluster monitoring and management
  • Backup & Restore: Full and incremental backups with encryption support
  • Plugin system: Extensible architecture for custom storage, auth, and hooks

Previous highlights (v0.7.0): secondary indexes, multi-key transactions, batch import/export, durable S3 backend.


๐Ÿ“š Table of Contents


๐Ÿค” What is minikv?

minikv is a distributed key-value store written in Rust, designed for simplicity, speed, and reliability.

Who is this forย ?
minikv is for engineers learning distributed systems, teams experimenting with Rust-based infrastructure, and anyone curious about consensus, durability, and system trade-offs.

  • Clusteredย : Raft consensus and 2PC for transactional writes
  • Virtual Shardingย : 256 vshards for elastic scaling & balancing
  • WALย : Write-ahead log for durability
  • gRPC for node communication, HTTP REST & S3 API for clients
  • Bloom filters, snapshots, watch/subscribe for performance & reactivity

๐Ÿ›  Tech Stack

  • Rust โ€“ core logic
  • Shell โ€“ orchestration/automation
  • JavaScript โ€“ benchmarks, tools
  • Makefile โ€“ build flows

โšก Quick Start

git clone https://github.com/whispem/minikv.git
cd minikv
cargo build --release

# Start a node
cargo run -- --config config.example.toml

# API examples
curl localhost:8080/health/ready   # readiness
curl localhost:8080/metrics        # Prometheus metrics
curl localhost:8080/admin/status   # admin dashboard

# Create API key (admin)
curl -X POST http://localhost:8080/admin/keys -d '{"role":"ReadWrite","tenant_id":"acme"}'

# S3 (demo)
curl -X PUT localhost:8080/s3/mybucket/mykey -d 'hello minikv!'
curl localhost:8080/s3/mybucket/mykey

For cluster setup and advanced options, see the documentation.


๐Ÿ“ Architecture

  • Raft: consensus and leader election
  • 2PC: atomic distributed/batch writes
  • Virtual Shards: scale and rebalance across 256 partitions
  • Pluggable Storage: in-memory, RocksDB, Sled
  • Admin API: HTTP endpoints for status, metrics and config
  • Config: via environment, file or CLI flags

๐Ÿš€ Performance

  • Write throughputย : over 50,000 operations/sec (single node, in-memory)
  • Sub-millisecond read latency
  • Cluster tested (3โ€“5 nodes, commodity VMs)
  • Built-in Prometheus metrics

๐ŸŒŸ Features

Distributed Core

  • Raft consensus (multi-node, strong consistency)
  • Two-phase commit (2PC) for atomic multi-key transactions
  • 256 virtual shards for cluster scaling and rebalancing
  • Write-ahead log (WAL) for durability
  • Auto-rebalancing, graceful leader failover, hot-join and node removal

Data Management

  • Time-To-Live keys (TTL)
  • LZ4 compression (configurable)
  • Bloom filters and index snapshots
  • Pluggable and persistent storage: in-memory, RocksDB, Sled
  • Batch & range operations, prefix queries

API

  • HTTP REST (CRUD, batch, range, admin)
  • S3-compatible API (with TTL extensions)
  • gRPC (internal)
  • WebSocket and SSE endpoints for real-time watch/subscribe events

Security & Multi-tenancy

  • API keys (Argon2) and JWT authentication
  • Role-based access control (RBAC) and audit logging
  • Multi-tenant isolation
  • AES-256-GCM encryption at rest
  • Per-tenant quotas (storage, requests, rate limits)
  • TLS (HTTP & gRPC)

Observability

  • Admin dashboard
  • Prometheus metrics (counters, histograms)
  • Request and endpoint statistics
  • Structured logging and tracing spans
  • Kubernetes health probes

Production-grade Design

  • Memory-safe Rust
  • Test suite, automated CI
  • Documentation and sample config
  • Single static binary

๐Ÿ—บ๏ธ Roadmap

v0.8.0 (latest)

  • Cross-datacenter replication
  • Change Data Capture (CDC)
  • Admin Web UI
  • Backup & Restore
  • Plugin system

v0.7.0

  • Secondary indexes
  • Multi-key transactions
  • Durable S3-backed object store
  • Batch import/export

Next (v0.9.0+)

  • Kubernetes Operator
  • GraphQL API
  • Time-series optimizations
  • Geo-partitioning

๐Ÿ“– Story

minikv started as a 24-hour challenge by a Rust learner (82 days into the language!). It now serves as both a playground and a reference for distributed systems, demonstrating curiosity, learning-by-doing, and robust engineering.


๐Ÿ“š Documentation


๐Ÿ› ๏ธ Development

cargo test           # Run all tests
cargo clippy --fix   # Lint and fix
cargo fmt            # Format code

Continuous Integration runs on push & PR via .github/workflows/ci.yml.


๐Ÿค Contributing

Issues and PRs welcome! See CONTRIBUTING.md.


๐Ÿ“ฌ Contact


About

A production-ready distributed key-value store with Raft consensus.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages