Skip to main content
better-duck is a safe, embedded-first Rust client for DuckDB, built directly on DuckDB’s C API via FFI. It favors a lean dependency tree and row-oriented access, with opt-in features for Arrow, Polars, columnar chunks, async, pooling, user-defined functions, data derives, a Diesel 2.3 ORM backend, and a Tauri v2 plugin. DuckDB itself is compiled and embedded by default — there is no system package to install and no runtime library to ship. The current release is 0.1.0-beta.8.
Beta — the API is still settling. Breaking changes before 1.0 are possible; check the changelog before upgrading.

Highlights

  • Bundled DuckDB — the DuckDB C library compiles straight in; no system package, no runtime dependency to install.
  • Row-oriented, Arrow-optional — direct access to rows and values with a lean dependency tree, ideal for application-level OLAP. An opt-in arrow feature exports results via the Arrow C Data Interface with no added dependencies.
  • Safe by construction — every FFI call is wrapped; nothing unsafe leaks into your code, across the full DuckDB type system.
  • Comprehensive type coverage — integers of every width, DECIMAL, UUID, BIT, BIGNUM, temporals, and the composite LIST / ARRAY / STRUCT / MAP / UNION / ENUM types.
  • Diesel 2.3 ORM backend — a full custom backend: query DSL, migrations, an r2d2 pool, and a large library of DuckDB-specific SQL functions, aggregates, and operators.
  • User-defined functions & derives — register plain Rust functions as scalar / table / aggregate / cast functions, and map Rust structs and enums to DuckDB rows and types with #[derive(…)] — no unsafe, no manual vector handling.
  • Embedded-first — designed to run inside Tauri desktop apps, iOS cross-builds, and other environments where a system library isn’t an option.

The crates

better-duck is a small family of crates. Most users depend on better-duck-core (and, for the ORM, better-duck-diesel); the rest are pulled in automatically or used only in specific contexts.
The crate published as better-duck on crates.io is better-duck-core. Throughout these docs, “the core crate” means better-duck-core.
For the full crate map, the FFI safety model, and how DuckDB is compiled and bundled, see Architecture.

Supported platforms

The minimum supported Rust version (MSRV) is 1.96. better-duck is licensed under either MIT or Apache-2.0, at your option. See Versioning & compatibility for the beta policy and upgrade guidance.

Where to next

Installation

Add the crates to your Cargo.toml and pin the exact beta version.

Quickstart

Open a connection, create a table, insert data, and read rows end-to-end.

Architecture

The crate family, the FFI safety model, and bundled DuckDB.

Feature flags

Every Cargo feature of better-duck-core and when to enable it.

Choosing an API

Core vs the Diesel backend vs the Tauri plugin, with a feature-flag decision tree.

Core crate

The driver API: connections, queries, values, appender, pooling, async.

Diesel backend

The Diesel 2.3 ORM backend for DuckDB.

DuckDB essentials

The dialect, type system, extensions, and engine behavior through the driver.