Overview

ChronDB provides native bindings for multiple programming languages, all generated from a single Rust SDK.

Architecture: One Codebase, Many Languages

Instead of maintaining separate implementations for each language, ChronDB uses the Rust SDK as the single source of truth. All complex logic — worker thread management, GraalVM isolate lifecycle, idle timeout, lock cleanup, shared registry — lives exclusively in Rust. Other language bindings are thin, auto-generated wrappers.

libchrondb.so (GraalVM/Clojure — core database engine)
└── Rust SDK (crate chrondb — all logic lives here)

    ├── UniFFI  → Python, Ruby, Kotlin, Swift
    ├── NAPI-RS → Node.js
    └── Native  → Rust (direct crate dependency)

Why this approach?

Every feature or bug fix is implemented once in Rust and automatically available in all languages. No more reimplementing idle timeout logic in Python, Ruby, and Node.js separately.

UniFFI (Mozilla)

UniFFIarrow-up-right is an open-source tool created by Mozilla for generating multi-language bindings from Rust. It powers production components in Firefox — the same tool that generates Kotlin/Swift bindings for Firefox's Rust networking, cryptography, and sync engines is what generates ChronDB's Python and Ruby bindings.

Key references:

NAPI-RS

NAPI-RSarrow-up-right generates native Node.js addons from Rust. Used in production by projects like SWCarrow-up-right (the JavaScript/TypeScript compiler), Rspackarrow-up-right, and Biomearrow-up-right.

Key references:

Available Bindings

Language
Tool
Status
Package

Native crate

Stable

chrondb on crates.io

UniFFI

Stable

chrondb on PyPI

UniFFI

Stable

chrondb gem

NAPI-RS

Stable

chrondb on npm

UniFFI

Stable

Maven artifact

UniFFI

Stable

Swift package

API Consistency

All bindings expose the same core API:

Operation
Description

open_path(db_path)

Open a database connection (preferred)

open(data_path, index_path)

Open with separate paths (deprecated)

open_with_idle_timeout(data_path, index_path, secs)

Open with idle timeout

put(id, doc, branch?)

Save a document

get(id, branch?)

Get a document by ID

delete(id, branch?)

Delete a document

list_by_prefix(prefix, branch?)

List documents by ID prefix

list_by_table(table, branch?)

List documents by table

history(id, branch?)

Get change history

query(query, branch?)

Execute a Lucene query

execute_sql(sql, branch?)

Execute a SQL query directly (no server needed)

Each language wrapper adds idiomatic conveniences (context managers in Python, keyword arguments in Ruby, TypeScript types in Node.js) while the core behavior is identical.

Building Bindings from Source

All bindings require the libchrondb native library (GraalVM native-image) and the Rust toolchain.

Last updated

Was this helpful?