Tauri Knowledge Patch
Apply the patch
- Inspect
tauri.conf.json,Cargo.toml, capability files, plugin permissions, and the frontend API imports before changing code. - Identify whether the work concerns migration, configuration, windows/webviews, IPC, security, plugin development, a core plugin, or the experimental runtime.
- Read every matching reference from the index; cross-cutting work commonly needs both the configuration and security references.
- Keep platform branches explicit. Many window, filesystem, installer, and mobile APIs are target-specific.
- Validate capability grants and scope enforcement separately: permission to invoke a command does not make its scoped arguments safe.
Route common tasks
- For an application migration, read the migration, configuration, windows/webviews, and capabilities references together.
- For a new command, read the IPC and capabilities references; add the plugin reference when the command is plugin-owned.
- For mobile-native work, read the plugin reference plus the relevant configuration, filesystem, or window section.
- For release packaging, read configuration/distribution and the updater section of the core-plugin reference.
- For runtime replacement, read the Verso boundary before assuming ordinary Wry behavior is available.
Reference index
| Reference | Topics |
|---|---|
| configuration-security.md | Configuration hierarchy, app manifests, capabilities, permissions, scopes, CSP, asset protocol, remote origins, command pruning |
| core-plugins.md | Dialog, filesystem, HTTP, store, and updater behavior |
| ipc-state-tray.md | Commands, raw requests, serialization, channels, events, managed state, tray icons |
| migration.md | Rust, Cargo, asset-provider, handle, argument, and feature migrations |
| plugin-mobile-development.md | Plugin scaffolding, typed configuration, ACL generation, native mobile bridges, OS permissions, official plugin surfaces |
| project-distribution.md | Project setup, build hooks, frontend assets, bundle resources, installers, signing inputs, build/bundle workflow |
| verso-runtime.md | Experimental Servo-based runtime setup and compatibility boundary |
| windows-webviews-runtime.md | Native windows versus webviews, application lifecycle, paths, protocols, platform behavior, WebView2 and Apple options |
Breaking migration rules
Separate native windows from webviews
- Use Rust
WebviewWindow/WebviewWindowBuilderfor the former window-containing-a-webview behavior. RustWindownow means the native container independently of its webviews. - In JavaScript, normally use
getAllWebviewWindowsandgetCurrentWebviewWindow;getAllWindowsandgetCurrentWindowreturn native-window handles. - Treat multiwebview support as unstable and enable the Cargo
unstablefeature when using it. - Replace
FileDropEventandWindowEvent::FileDropwithDragDropEventandWindowEvent::DragDrop, and use the fourtauri://drag-*frontend events.
Migrate configuration before debugging APIs
- Put
productName,version, andidentifierat the root; renametauritoapp; move bundle settings to rootbundle. - Rename build keys to
frontendDistanddevUrl.devUrlmust be a URL. - Move the security pattern to
app.security.pattern, the global frontend API switch toapp.withGlobalTauri, and updater settings toplugins.updater. - Move platform bundle settings under
bundle.macOS.dmg,bundle.linux.deb, andbundle.linux.appimage; usebundle.licenseandbundle.licenseFilefor shared licensing. - Replace the old file-drop flag with
app.window.dragDropEnabled.
Update renamed Rust APIs and Cargo features
- Get paths through
Manager::path()andtauri::path::PathResolver; usetauri::ipcfor command/IPC types. - Replace
tauri::Iconwithtauri::image::Imageand old path/plugin result aliases withtauri::Resultor an application result type. - Use
tauri::scope::fs::{Scope, Pattern, Event}; filesystem checks resolve symlinks, and the old HTTP, shell, and IPC scope types no longer exist. - Rename features:
default-tlstonative-tls,system-traytotray-icon,window-data-urltowebview-data-url, andicon-ico/icon-pngtoimage-ico/image-png. - Remove
reqwest-*features.linux-protocol-headersis always active;linux-libxdoopts native Linux editing menu items intolibxdo. - Rename the automation variable to
TAURI_WEBVIEW_AUTOMATION.
Choose close, exit, and restart deliberately
WebviewWindow::close()emits a close-requested event; calldestroy()for forced closure.AppHandle::exit()and restart paths emit exit-request events. Aftercleanup_before_exit(), exit immediately and make no further Tauri calls.- Prefer
AppHandle::request_restart()when exit-event delivery matters. Directrestart()waits forRunEvent::Exitbefore relaunching. - Use
App::run_return()when the host process must continue and receive the exit code. Do not build a polling loop around deprecatedrun_iteration().
Security and capability quick reference
Register controllable application commands
Commands present only in invoke_handler are callable by every window and webview. Put application command names in the build-time AppManifest before expecting capabilities to restrict them.
tauri_build::try_build(
tauri_build::Attributes::new()
.app_manifest(tauri_build::AppManifest::new().commands(&["save_file"])),
)
.unwrap();
Enforce scope inside the command
Capabilities decide whether an invocation reaches a command and attach configured scope. The command or plugin must interpret CommandScope/GlobalScope and enforce the allow/deny data; deny entries win. Native application code can use WebviewWindow::resolve_command_scope for runtime checks.
Understand capability selection
- If
app.security.capabilitiesis absent or empty, all files in./capabilities/are included. Once populated, the list becomes an explicit selection of identifiers or inline objects. - Use capability
platformsfor target filters andremote.urlsonly when matching remote origins must invoke commands. Bundled content has access by default; remote content does not. - Enable the
config-json5feature before relying on.json5capability files. - Treat
build.removeUnusedCommandscautiously: runtime-added ACLs are invisible to build-time pruning.
IPC, state, and events quick reference
Register one invoke handler
Each invoke_handler(...) call replaces the previous handler. Put every application command in one generate_handler![...] list.
Select the right transport
- Pass
ArrayBufferorUint8Arraytoinvokefor a rawInvokeBody::Raw; injecttauri::ipc::Requestto read the unprocessed body and headers. - Implement
SERIALIZE_TO_IPC_FNfor custom JavaScript argument serialization. Tauri's DPI classes already use it. - Use events for asynchronous JSON broadcasts without replies or strong typing. Rust payloads must implement
Serialize + Clone. - Use
Channelfor ordered, higher-throughput streams and raw/custom serialization. Capabilities do not finely filter event or channel payload data.
Manage state by exact type
Register Mutex<T>, not Arc<Mutex<T>> merely to add shared ownership; Tauri supplies it. State lookup uses the exact registered type. Clone an AppHandle into a thread, then retrieve state through Manager there. Do not call deprecated Manager::unmanage.
Configuration and distribution quick reference
build.frontendDistaccepts an embedded directory, an array flattened into the asset root, or a custom-protocol/remote URL with no embedded assets. WithoutdevUrl, the CLI can serve it with simple hot reload.- Hook values may be strings or
{ script, cwd };beforeDevCommandalso acceptswait, defaulting tofalse. Use theTAURI_ENV_*variables for target-aware hooks. tauri buildbundles by default. Use--no-bundle, followed bytauri bundle, to separate compilation from packaging.- Resource arrays preserve paths; resource maps control destinations, but glob matches in a map are flattened into the destination.
- Updater verification is mandatory. Preserve the private signing key, provide public-key/signature contents rather than paths, and inject the private key through
TAURI_SIGNING_PRIVATE_KEY. - Keep WiX
upgradeCodestable across product renames, and remember Windows bundles allow downgrades unlessallowDowngradesisfalse.
Window and webview quick reference
- Window creation and
setuprun only after the event loop is ready. The page-load hook receives aWebviewfor both start and finish; inspectPageLoadPayload::event. - Webviews start focused. Configure
devtoolsper webview/window and useWebviewBuilder::focusedwhen initial focus differs. - On Windows and Android, custom protocols default to
http://<scheme>.localhost; opt into HTTPS withuseHttpsSchemeor the builder method. - Webviews sharing a Windows data directory must agree on WebView2 settings. Distinct
additionalBrowserArgs, extension state, or scrollbar styles require distinct directories. - Creation-only constraints such as
preventOverflow, its margin builder variant, initialization scripts for all frames, Apple link previews, and iOS accessory views must be set beforebuild().
Plugin and mobile quick reference
- Official plugin major versions follow Tauri's major, but a plugin may still document breaking minor releases.
- Register plugin commands on the plugin builder and invoke them as
plugin:<name>|<command>; registration does not bypass permissions. - Use the second plugin
Buildergeneric for typedplugins.<name>configuration and read it from thePluginApipassed tosetup. - Generate allow/deny permissions and scope schemas in
build.rs. Commands must inspect injected scope values themselves. - Call Kotlin or Swift commands with
PluginHandle::run_mobile_plugin. There is no native-to-Rust reverse bridge; use JNI on Android or C FFI on iOS when suspended-webview work must enter Rust. - Use NDK 28 or newer for Android 16 KB page alignment, or add the documented linker maximum-page-size flag.
Core-plugin traps
- Filesystem grants need both an operation permission and a matching path scope.
$APPDATA/*covers direct children, not the directory plus its full tree. http:defaultenables the fetch workflow but grants no origins; add URL allow scopes and narrower denies.- Store instances are shared by path across Rust and JavaScript; options from later
load()calls are ignored until Rust closes the resource. - Updater endpoints advance only after non-2xx responses, not malformed successful responses. Static manifests are validated in full before version comparison.
- Windows
quietupdater installation cannot request elevation and therefore needs a per-user install or an already elevated process.
Final checks
- Confirm every frontend invoke has the intended command registration, permission, capability, window/webview binding, and scope enforcement.
- Test configuration on each target represented by platform-specific settings.
- Exercise close, exit, restart, and updater paths using their real event-loop mode.
- Rebuild generated mobile projects when native frameworks or platform metadata require regeneration.
- Treat
tauri-runtime-versoas experimental and verify each required API against its documented compatibility boundary.