rust-rocksdb

Idiomatic Rust bindings and wrapper for Facebook's RocksDB embedded key-value store.

Library
Cargo
v0.25.0
2,173stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
79/100Good
Development Activity80
Maintenance56
Community80
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
72/100Good
Architecture80
Code Quality82
Innovation62
Learning Curve65

rust-rocksdb (published to crates.io as rocksdb) is a Rust wrapper around Facebook’s RocksDB, a high-performance embedded key-value store built on an LSM-tree. It statically links and builds the C++ RocksDB library via the companion librocksdb-sys FFI crate and exposes a safe, idiomatic Rust API on top: opening databases with configurable Options, column families, transactions (both pessimistic TransactionDB and OptimisticTransactionDB), snapshots, checkpoints, backups, merge operators, and compaction filters.

With over 50 million cumulative downloads, it is the de facto standard way to embed RocksDB in a Rust application, and is used as the storage engine underneath several production databases and blockchain/state-storage systems written in Rust. The crate tracks upstream RocksDB releases closely and exposes most of RocksDB’s advanced tuning knobs (compression, write buffers, bloom filters, io_uring, jemalloc) as opt-in Cargo features rather than hard dependencies, keeping default builds lean.

What You Get

  • A DB type with open, open_cf_descriptors, put, get, delete, and iterator APIs for basic key-value operations
  • Column family support for partitioning data within a single database instance
  • Pessimistic (TransactionDB) and optimistic (OptimisticTransactionDB) transaction support
  • Snapshots, checkpoints, and backup/restore APIs for point-in-time consistency and disaster recovery
  • Merge operators and compaction filters for custom read-time and compaction-time data transformations
  • Cargo feature flags for optional compression codecs (snappy, lz4, zstd, zlib, bzip2), jemalloc, and io_uring

Common Use Cases

  • Embedding a fast, persistent local key-value store in a Rust service without running a separate database process
  • Building a custom storage engine for a database, blockchain, or state-machine-replication system on top of RocksDB’s LSM-tree
  • Using column families to logically partition different data types (e.g. indexes vs. raw records) within one RocksDB instance
  • Taking consistent backups or snapshots of an embedded store for replication or point-in-time recovery

Under The Hood

Architecture — The crate is split into a safe wrapper (this rocksdb crate, under src/) and a separate librocksdb-sys FFI crate (declared as a workspace member) that vendors and statically builds the upstream C++ RocksDB source via build.rs; the wrapper’s src/db.rs, src/db_options.rs, src/column_family.rs, and src/transactions/ modules layer safe, ownership-checked Rust types (DB, Options, ColumnFamilyDescriptor) over raw FFI calls, with src/raw_ptr.rs and src/ffi_util.rs centralizing unsafe pointer handling so the rest of the crate can stay safe Rust. Tech Stack — Rust 2021 edition (rust-version 1.85+), depending on libc and the sibling librocksdb-sys crate for the vendored C++ RocksDB build, with optional serde support behind a feature flag and dev-dependencies on tempfile, trybuild, and pretty_assertions for testing. Code Quality — The tests/ directory contains 20+ integration test files covering column families, transactions, backups, checkpoints, iterators, compaction filters, comparators, and multithreaded access, reflecting the correctness bar expected of a storage-engine binding; CI builds against the vendored RocksDB source to catch upstream breakage early. API Design — The API mirrors RocksDB’s own C++ surface closely (Options, ColumnFamilyDescriptor, WriteBatch) rather than inventing a novel Rust-idiomatic key-value trait, which keeps it familiar to anyone who has used RocksDB in another language but means newcomers benefit from reading upstream RocksDB docs alongside the crate’s own rustdoc.

Used by 5 apps in this directory

TypeScript
45%
Other

Convex Backend

Developer Tools · Databases

12,394

Open-source reactive database that lets developers build live-updating apps with pure TypeScript, strong consistency, and real-time subscriptions—no separate API layer required.

View details
88
Repo Health
82
Technical
70
Dependency
Built with
TypeScript45%
Rust43%
Updated today
Rust
91%
Apache 2.0

Murr

Databases

107

A RocksDB-based NVMe/S3 cache purpose-built for AI inference workloads — a faster Redis replacement optimized for batch, low-latency, zero-copy reads and writes between data pipelines and inference apps.

View details
63
Repo Health
72
Technical
75
Dependency
Built with
Rust91%
Updated 1 months ago
Python
55%
Other

PostHog

Analytics · Monitoring · Developer Tools

37,777

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
67
Dependency
Built with
Python55%
TypeScript36%
Updated today
Rust
97%
MPL 2.0

Sonic

Databases · Search

21,315

Fast, lightweight, schema-less search backend in Rust — microsecond queries, 30MB RAM, no document storage required.

View details
88
Repo Health
88
Technical
73
Dependency
Built with
Rust97%
Updated 3 days ago
Rust
98%

Stalwart

Collaboration

14,255

All-in-one secure mail and collaboration server covering IMAP, JMAP, SMTP, CalDAV, CardDAV, and WebDAV in a single memory-safe Rust binary.

View details
89
Repo Health
81
Technical
68
Dependency
Built with
Rust98%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search