Skip to main content
Setting up the plugin has two halves: the Rust crate on the Tauri (backend) side, and the @better-duck/tauri npm package on the frontend. They are versioned together.

Rust crate

Add better-duck-tauri to your app’s src-tauri/Cargo.toml and pick exactly one backend feature.
Pin the exact pre-release version. Cargo’s default version requirement excludes -beta.N pre-releases, so "0.1" will not resolve to 0.1.0-beta.8. Write the full version string.

Feature flags

A backend feature is mandatory. Building with neither backend-core nor backend-diesel triggers a compile_error!:
Because backend-core is a default feature, selecting backend-diesel on its own means also setting default-features = false as shown above (otherwise both backends compile in; the diesel entry points simply shadow the choice — keep the dependency tree lean by disabling the default).
When should you choose each backend? See Backends for the full comparison, and Feature flags for how these line up with the rest of the workspace.

JS/TS package

The frontend package is published as @better-duck/tauri. It peer-depends on @tauri-apps/api ^2.
The default export is the Database class:
The package is a thin wrapper over invoke('plugin:better-duck-tauri|<command>', …) and ships its own TypeScript types (ExecuteResult, DataFormat), so no @types package is needed.

Build-time wiring

Two things must be in place for the plugin’s permissions to work; both are standard Tauri plugin mechanics covered in Registration:
1

A build script that runs tauri-build

Your app’s src-tauri/build.rs must call tauri_build::build(); so the capability and permission files resolve at compile time.
2

A capability file granting commands

Add a src-tauri/capabilities/*.json capability that lists the better-duck-tauri:* permissions the webview may use — see Capabilities & permissions.

See also