tauri-apps/tauri
tauri-plugin
Active contributors: Lucas Fernandes Nogueira, Amr Bashir
Purpose
crates/tauri-plugin provides the build-time and runtime helpers that Tauri plugin authors [build-dependencies]-on. Plugins are reusable libraries (e.g. tauri-plugin-fs, tauri-plugin-store) that expose Rust commands, JS bindings, and ACL files. This crate gives them a build() helper to scaffold permissions and a Builder to produce a tauri::plugin::Plugin.
The crate intentionally has two non-overlapping feature surfaces, so the same crate can be pulled into a plugin's [build-dependencies] (build-time helpers) and [dependencies] (runtime helpers) without dragging unwanted deps into either.
Directory layout
crates/tauri-plugin/
├── Cargo.toml
├── src/
│ ├── lib.rs # feature-gated re-exports
│ ├── build.rs # build-time helpers (feature = "build")
│ └── runtime.rs # runtime helpers (feature = "runtime")Key items
| Symbol | Feature | What it does |
|---|---|---|
Builder (build-time) |
build |
Walks permissions/ of the plugin crate, validates each TOML, generates JSON Schemas, writes manifest. |
mobile::* helpers |
build |
Mobile-friendly globs for the plugin's Android/iOS native sources. |
| Re-exports of common types | runtime |
Shorter import paths (tauri::plugin::Builder, etc.) for plugin authors. |
How it works
A plugin crate's build.rs typically calls:
fn main() {
tauri_plugin::Builder::new(&["all"])
.build();
}This:
- Parses every TOML under
permissions/. - Validates identifiers (via
tauri_utils::acl::Identifier). - Writes a generated JSON Schema for the plugin's permissions to
OUT_DIRsotauri-buildand tooling can validate apps that use the plugin. - Emits a Cargo manifest entry that
tauri-buildreads when it resolves the downstream app's ACL.
At runtime the plugin crate uses tauri::plugin::Builder<R> (re-exported from here) to declare commands, lifecycle hooks, init JS, and config schema.
graph TD
PluginBuild["plugin/build.rs<br/>(downstream plugin)"] -->|"tauri_plugin::Builder"| GenSchemas["JSON schemas + manifest"]
GenSchemas --> AppBuild["tauri-build (in user app)"]
PluginRuntime["plugin/src/lib.rs"] -->|"tauri::plugin::Builder"| Plugin["tauri::plugin::Plugin"]
Plugin --> App["tauri::Builder::plugin(...)"]Integration points
- Up: Tauri plugin crates (in this repo's siblings, e.g.
tauri-apps/plugins-workspace). - Down:
tauri-utils(build-time validation),tauri(runtime types).
Entry points for modification
| Goal | Start here |
|---|---|
| Validate a new permission attribute | crates/tauri-plugin/src/build.rs plus tauri-utils/src/acl/ |
| Add a build-time helper for plugin authors | crates/tauri-plugin/src/build.rs |
| Add a runtime helper | crates/tauri-plugin/src/runtime.rs |
See systems/plugin-system for the runtime model and systems/acl-and-capabilities for the permission lifecycle.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.