@better-duck/tauri npm package on the frontend. They are versioned together.
Rust crate
Addbetter-duck-tauri to your app’s src-tauri/Cargo.toml and pick exactly one backend
feature.
Feature flags
A backend feature is mandatory. Building with neither Because
backend-core nor backend-diesel
triggers a compile_error!: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).JS/TS package
The frontend package is published as@better-duck/tauri. It peer-depends on @tauri-apps/api ^2.
Database class:
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
- Registration — register the plugin and configure the builder.
- Capabilities & permissions — grant command access.
- Backends —
backend-corevsbackend-diesel.