Skip to main content
RocksDB has an extensive ecosystem of language bindings maintained by the community. This page provides an overview of available bindings for various programming languages.

Available Bindings

Java

Official binding with full feature support

Python

Multiple Python bindings available

Go

High-performance Go bindings

Rust

Safe Rust wrappers for RocksDB

Node.js

JavaScript/TypeScript bindings

Ruby

Ruby gem for RocksDB

C#

.NET bindings for RocksDB

More Languages

Perl, PHP, Haskell, and others

Go

Recommended: Actively maintained, production-ready Go binding.
go get github.com/linxGnu/grocksdb
package main

import (
    "fmt"
    "github.com/linxGnu/grocksdb"
)

func main() {
    // Open database
    opts := grocksdb.NewDefaultOptions()
    opts.SetCreateIfMissing(true)
    db, err := grocksdb.OpenDb(opts, "/path/to/db")
    if err != nil {
        panic(err)
    }
    defer db.Close()
    
    // Write
    wo := grocksdb.NewDefaultWriteOptions()
    err = db.Put(wo, []byte("key"), []byte("value"))
    if err != nil {
        panic(err)
    }
    
    // Read
    ro := grocksdb.NewDefaultReadOptions()
    value, err := db.Get(ro, []byte("key"))
    if err != nil {
        panic(err)
    }
    defer value.Free()
    
    fmt.Println("Value:", string(value.Data()))
}

GitHub Repository

View grocksdb on GitHub

Rust

Multiple Rust bindings are available, with different levels of maturity and feature support:
Production-ready: Used by TiKV and other production systems.
[dependencies]
rocksdb = "0.21"
use rocksdb::{DB, Options};

fn main() {
    // Open database
    let path = "/path/to/db";
    let mut opts = Options::default();
    opts.create_if_missing(true);
    let db = DB::open(&opts, path).unwrap();
    
    // Write
    db.put(b"key", b"value").unwrap();
    
    // Read
    match db.get(b"key") {
        Ok(Some(value)) => println!("Value: {:?}", String::from_utf8(value)),
        Ok(None) => println!("Key not found"),
        Err(e) => println!("Error: {}", e),
    }
    
    // Delete
    db.delete(b"key").unwrap();
}
This is a fork of spacejam/rust-rocksdb, actively maintained and used in production by PingCAP (TiKV).

GitHub Repository

View rust-rocksdb (PingCAP) on GitHub

Node.js

RocksDB binding for JavaScript and TypeScript applications:
npm install rocksdb
const rocksdb = require('rocksdb');

// Open database
const db = rocksdb('/path/to/db');

db.open((err) => {
  if (err) throw err;
  
  // Write
  db.put('key', 'value', (err) => {
    if (err) throw err;
    
    // Read
    db.get('key', (err, value) => {
      if (err) throw err;
      console.log('Value:', value.toString());
      
      // Close
      db.close((err) => {
        if (err) throw err;
      });
    });
  });
});

NPM Package

View rocksdb on NPM

Ruby

Ruby gem providing RocksDB bindings:
gem install rocksdb-ruby
require 'rocksdb'

# Open database
db = RocksDB::DB.new('/path/to/db')

# Write
db.put('key', 'value')

# Read
value = db.get('key')
puts "Value: #{value}"

# Delete
db.delete('key')

# Iterate
db.each do |key, value|
  puts "#{key}: #{value}"
end

# Close
db.close

RubyGems Package

View rocksdb-ruby on RubyGems

C#

Multiple .NET bindings are available:
dotnet add package RocksDbSharp
using RocksDbSharp;

class Program
{
    static void Main()
    {
        // Open database
        var options = new DbOptions().SetCreateIfMissing(true);
        using (var db = RocksDb.Open(options, "/path/to/db"))
        {
            // Write
            db.Put("key", "value");
            
            // Read
            string value = db.Get("key");
            Console.WriteLine($"Value: {value}");
            
            // Delete
            db.Remove("key");
        }
    }
}

GitHub Repository

View rocksdb-sharp on GitHub

Other Languages

Perl

cpanm RocksDB
use RocksDB;

my $db = RocksDB->new('/path/to/db');

# Write
$db->put('key', 'value');

# Read
my $value = $db->get('key');
print "Value: $value\n";

# Delete
$db->delete('key');

CPAN Package

View RocksDB on CPAN

PHP

composer require photonios/rocksdb
<?php
require 'vendor/autoload.php';

use Photonios\RocksDB\RocksDB;

// Open database
$db = new RocksDB('/path/to/db');

// Write
$db->put('key', 'value');

// Read
$value = $db->get('key');
echo "Value: $value\n";

// Delete
$db->delete('key');

GitHub Repository

View rocksdb-php on GitHub

Haskell

cabal install rocksdb-haskell
import Database.RocksDB

main :: IO ()
main = do
  db <- open "/path/to/db" defaultOptions { createIfMissing = True }
  
  -- Write
  put db defaultWriteOptions "key" "value"
  
  -- Read
  value <- get db defaultReadOptions "key"
  putStrLn $ "Value: " ++ show value
  
  -- Delete
  delete db defaultWriteOptions "key"
  
  close db

Hackage Package

View rocksdb-haskell on Hackage

D Programming Language

GitHub Repository

View RocksDB binding for D on GitHub

Erlang

GitLab Repository

View erlang-rocksdb on GitLab

Elixir

# mix.exs
defp deps do
  [
    {:rox, "~> 2.0"}
  ]
end
{:ok, db} = Rox.open("/path/to/db", create_if_missing: true)

# Write
Rox.put(db, "key", "value")

# Read
{:ok, value} = Rox.get(db, "key")
IO.puts("Value: #{value}")

# Delete
Rox.delete(db, "key")

GitHub Repository

View rox on GitHub

Nim

GitHub Repository

View nim-rocksdb on GitHub

Swift / Objective-C

iOS and macOS binding for Swift and Objective-C:
import ObjectiveRocks

let db = RocksDB(path: "/path/to/db")

// Write
db.setData("value".data(using: .utf8), forKey: "key".data(using: .utf8)!)

// Read
if let value = db.data(forKey: "key".data(using: .utf8)!) {
    print("Value: \(String(data: value, encoding: .utf8)!)")
}

// Delete
db.deleteData(forKey: "key".data(using: .utf8)!)

db.close()

GitHub Repository

View ObjectiveRocks on GitHub

Choosing a Binding

When selecting a language binding for your project, consider:

Maintenance Status

Check recent commits and issue activity. Prefer actively maintained bindings over abandoned projects.

Feature Completeness

Ensure the binding supports the RocksDB features you need (transactions, column families, etc.).

Production Usage

Look for bindings used in production environments, which tend to be more stable and well-tested.

Performance

Some bindings have better performance characteristics than others. Check benchmarks if performance is critical.

Documentation

Good documentation and examples make it easier to get started and troubleshoot issues.

Community Support

Active communities provide help, fixes, and improvements. Check GitHub stars, issues, and discussions.

Contributing a Binding

If you’ve created a RocksDB binding for a language not listed here, or want to improve an existing binding:
1

Create or Improve

Develop a high-quality binding with comprehensive test coverage
2

Document

Provide clear documentation, examples, and installation instructions
3

Submit PR

Open a pull request to add your binding to the official LANGUAGE-BINDINGS.md file
The bindings listed here are maintained by the community, not the RocksDB core team. Maintenance status and quality may vary.

Resources

Language Bindings List

Official list of all known RocksDB language bindings

RocksDB Wiki

Comprehensive documentation for RocksDB features

Java Binding

Official Java binding documentation

Python Binding

Python binding documentation and guides

Next Steps

Getting Started

Learn RocksDB fundamentals

Basic Operations

Master core database operations

Configuration

Configure RocksDB for your use case

Performance

Optimize RocksDB performance

Build docs developers (and LLMs) love