Skip to content

Installation

Add Rhei to your project in minutes — as a Rust library, a CLI tool, or a Python package.

System Requirements

  • Rust: stable toolchain. CI tests on the latest stable (currently 1.95). The workspace uses edition 2021 and depends on async fn in traits (stable since 1.75).
  • C++ toolchain (for duckdb-backend only): a working cc/c++ is needed because DuckDB bundles its C++ sources. No extra system library is required — duckdb-sys compiles everything.
  • Docker (optional): only needed for the Postgres end-to-end tests (docker compose up).

Rust — Library

Add the crate to your Cargo.toml:

toml
[dependencies]
# DataFusion backend (default — pure Rust, natively async)
rhei = "1"

# DuckDB backend instead of, or in addition to, DataFusion
# rhei = { version = "1", features = ["duckdb-backend"] }

# Both backends
# rhei = { version = "1", features = ["full"] }

Feature Flags

FeatureDefaultDescription
datafusion-backendyesApache DataFusion OLAP engine (pure Rust, no C deps)
duckdb-backendnoDuckDB OLAP engine — bundles the C++ library via duckdb-sys
fullnoBoth OLAP backends simultaneously
sidecarnoTimestamp-based CDC from external SQLite or PostgreSQL sources
rocksdb-cdcnoRocksDB-backed durable CDC event buffer (5–7× faster write path than SQLite triggers)
flight-sqlnoArrow Flight SQL gRPC server for OLAP queries (rhei-flight crate)
metricsnoEmit counters/gauges via the metrics crate facade
metrics-exporternoPrometheus HTTP endpoint on rhei-tui (requires metrics_port in TOML config)
cloud-storagenoS3 and GCS object-store backends for DataFusion Parquet storage

Picking a backend

Use datafusion-backend (the default) for most projects — it has zero C dependencies and compiles fast. Switch to duckdb-backend when you need ACID transactions on your OLAP mirror or want DuckDB's SQL dialect.

CLI — rh

Build and install the rh command from source:

sh
# Install from the workspace (recommended during development)
cargo install --path crates/rhei-tui

# Or build a release binary without installing
cargo build -p rhei-tui --release
# Binary is at ./target/release/rh

The CLI supports all major operations:

sh
rh exec  --db myapp.db "INSERT INTO events VALUES (1, 'hello')"
rh query --db myapp.db "SELECT COUNT(*) FROM events"
rh repl  --db myapp.db          # interactive REPL with persistent engine
rh serve --config config/htap.toml  # long-running service with TUI dashboard

See CLI Reference for the full command list.

Python

Install the published package:

sh
pip install rhei
# or, with uv:
uv pip install rhei

Build from source (editable install):

sh
# Requires maturin and a Rust toolchain
uv run maturin develop           # debug build
uv run maturin develop --release # optimised build

The Rhei Python package exposes HtapEngine, HtapConfig, TableSchema, and TimestampTableConfig. See Python Quickstart for a working example and Python API Reference for the full surface.

anyio / asyncio compatibility

The Python bindings bridge Rust's Tokio runtime into Python's async event loop via pyo3-async-runtimes. Every I/O method returns a native Python awaitable and works with both asyncio and anyio.

Released under the Apache-2.0 License.