tauri
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTauri lets you build desktop (and mobile) apps with a Rust Core process and a frontend running in the OS WebView. Use these skills when scaffolding projects, wiring commands and events, configuring capabilities and permissions, or authoring plugins.
The skill is based on Tauri v2, generated at 2026-01-30.
Tauri 允许你借助Rust Core进程和运行在系统WebView中的前端来构建桌面(及移动端)应用。这些技能适用于项目搭建、命令与事件配置、capabilities与权限设置,以及插件开发等场景。
本技能基于Tauri v2版本生成,生成时间为2026-01-30。
Core References
核心参考
| Topic | Description | Reference |
|---|---|---|
| Architecture | Core crates, WRY/TAO, tooling, plugins | core-architecture |
| IPC | Events (fire-and-forget) vs Commands (invoke/response), when to use each | core-ipc |
| Process Model | Core process vs WebView processes, security implications | core-process-model |
| Project Structure | src-tauri layout, tauri.conf.json, capabilities, build flow | core-project-structure |
| App Size | Why small, Cargo release profile (LTO, strip, opt-level) | concept-size |
| IPC Patterns | Brownfield (default) vs Isolation (sandbox, encrypt) | concept-ipc-patterns |
| 主题 | 描述 | 参考链接 |
|---|---|---|
| 架构 | 核心crates、WRY/TAO、工具链、插件 | core-architecture |
| IPC | 事件(即发即弃)与命令(调用/响应)的区别及适用场景 | core-ipc |
| 进程模型 | Core进程与WebView进程的区别及安全影响 | core-process-model |
| 项目结构 | src-tauri目录布局、tauri.conf.json、capabilities、构建流程 | core-project-structure |
| 应用体积 | 体积小巧的原因、Cargo发布配置(LTO、strip、opt-level) | concept-size |
| IPC模式 | 遗留模式(默认)与隔离模式(沙箱、加密) | concept-ipc-patterns |
Start
入门指南
| Topic | Description | Reference |
|---|---|---|
| Create Project | create-tauri-app vs tauri init, dev server URL | start-create-project |
| Prerequisites | System deps, Rust, Node, WebView2, mobile (Android/iOS) | start-prerequisites |
| Frontend | Static host model, Vite/Next/Nuxt/SvelteKit/Leptos/Trunk | start-frontend |
| Migrate | Upgrading from Tauri 1.x or 2 beta, migrate command | start-migrate |
| 主题 | 描述 | 参考链接 |
|---|---|---|
| 创建项目 | create-tauri-app与tauri init的区别、开发服务器URL | start-create-project |
| 前置要求 | 系统依赖、Rust、Node、WebView2、移动端(Android/iOS)环境 | start-prerequisites |
| 前端集成 | 静态宿主模型、Vite/Next/Nuxt/SvelteKit/Leptos/Trunk适配 | start-frontend |
| 版本迁移 | 从Tauri 1.x或2 beta版本升级、migrate命令使用 | start-migrate |
Develop
开发实战
| Topic | Description | Reference |
|---|---|---|
| Configuration Files | tauri.conf.json, platform overrides, Cargo.toml, package.json | develop-configuration-files |
| Commands | #[tauri::command], invoke, args, errors, async, State, channels | develop-commands |
| Events and Channels | Emit/listen, global vs webview-specific, streaming with Channel | develop-events-and-channels |
| State Management | app.manage(), State<T> in commands, Mutex | develop-state-management |
| Windows | Creating windows (config vs WebviewWindowBuilder), label, url, visible | develop-windows |
| Icons | tauri icon command, bundle.icon, platform formats | develop-icons |
| Resources | Bundled resources, resolve path, $RESOURCE, fs permissions | develop-resources |
| Sidecar | externalBin, shell plugin, spawn from Rust/JS, permissions | develop-sidecar |
| Debug | dev vs build, Rust console, WebView devtools, RUST_BACKTRACE | develop-debug |
| Tests | Mock runtime, WebDriver E2E, CI | develop-tests |
| Tests Mocking | mockIPC, mockWindows, clearMocks (frontend tests) | develop-tests-mocking |
| Tests WebDriver | tauri-driver, platform drivers, Selenium/WebdriverIO, CI | develop-tests-webdriver |
| Updating Dependencies | npm/Cargo version sync, tauri and plugins | develop-updating-dependencies |
| Plugins Mobile | Android (Kotlin), iOS (Swift), desktop vs mobile impl | develop-plugins-mobile |
| 主题 | 描述 | 参考链接 |
|---|---|---|
| 配置文件 | tauri.conf.json、平台覆盖配置、Cargo.toml、package.json | develop-configuration-files |
| 命令开发 | #[tauri::command]、invoke调用、参数、错误处理、异步、State、通道 | develop-commands |
| 事件与通道 | Emit/监听、全局与WebView专属事件、Channel流处理 | develop-events-and-channels |
| 状态管理 | app.manage()、命令中的State<T>、Mutex | develop-state-management |
| 窗口管理 | 创建窗口(配置文件方式vs WebviewWindowBuilder)、标签、URL、可见性设置 | develop-windows |
| 图标设置 | tauri icon命令、bundle.icon配置、平台适配格式 | develop-icons |
| 资源管理 | 打包资源、路径解析、$RESOURCE、文件系统权限 | develop-resources |
| Sidecar工具 | externalBin配置、shell插件、从Rust/JS启动、权限设置 | develop-sidecar |
| 调试技巧 | dev与build模式区别、Rust控制台、WebView开发者工具、RUST_BACKTRACE | develop-debug |
| 测试方法 | 模拟运行时、WebDriver端到端测试、CI集成 | develop-tests |
| 测试模拟 | mockIPC、mockWindows、clearMocks(前端测试) | develop-tests-mocking |
| WebDriver测试 | tauri-driver、平台驱动、Selenium/WebdriverIO、CI集成 | develop-tests-webdriver |
| 依赖更新 | npm/Cargo版本同步、Tauri及插件更新 | develop-updating-dependencies |
| 移动端插件 | Android(Kotlin)、iOS(Swift)、桌面与移动端实现差异 | develop-plugins-mobile |
Security
安全配置
| Topic | Description | Reference |
|---|---|---|
| Capabilities | Which permissions apply to which windows; capability files, remote, platforms | security-capabilities |
| Permissions | Allow/deny commands, scopes, permission sets; plugin vs app permissions | security-permissions |
| Scopes | allow/deny per command or global, path/URL patterns | security-scope |
| CSP | Content Security Policy config, script-src, style-src | security-csp |
| HTTP Headers | CORS, COOP, Permissions-Policy for webview responses | security-http-headers |
| Runtime Authority | Core enforces permissions on every invoke; denied = never run | security-runtime-authority |
| 主题 | 描述 | 参考链接 |
|---|---|---|
| Capabilities | 不同窗口的权限分配、capabilities文件、远程访问、平台适配 | security-capabilities |
| 权限管理 | 命令的允许/拒绝、作用域、权限集合;插件与应用权限的区别 | security-permissions |
| 作用域设置 | 按命令或全局设置允许/拒绝、路径/URL模式 | security-scope |
| CSP配置 | 内容安全策略配置、script-src、style-src | security-csp |
| HTTP头设置 | CORS、COOP、WebView响应的Permissions-Policy | security-http-headers |
| 运行时权限校验 | Core进程对每次invoke调用执行权限校验;拒绝则不会执行命令 | security-runtime-authority |
Best Practices
最佳实践
| Topic | Description | Reference |
|---|---|---|
| Security Lifecycle | Upstream, development, build, runtime; deps, audit, dev server | best-practices-security-lifecycle |
| Writing Plugin Permissions | Autogenerated allow/deny, permission files, default set, scope schema | best-practices-writing-plugin-permissions |
| 主题 | 描述 | 参考链接 |
|---|---|---|
| 安全生命周期 | 上游依赖、开发、构建、运行时;依赖审计、开发服务器安全 | best-practices-security-lifecycle |
| 插件权限编写 | 自动生成允许/拒绝规则、权限文件、默认权限集合、作用域Schema | best-practices-writing-plugin-permissions |
Features
功能特性
| Topic | Description | Reference |
|---|---|---|
| Plugins | Plugin development, lifecycle hooks, commands, permissions, state | features-plugins |
| Official Plugins Overview | dialog, fs, shell, store, updater, and others; when to use which | features-official-plugins-overview |
| Deep Linking | Custom URL scheme, App/Universal Links, single-instance + argv | features-deep-linking |
| Updater | In-app updates — check, download, install, signing, static/dynamic endpoints | features-updater |
| 主题 | 描述 | 参考链接 |
|---|---|---|
| 插件开发 | 插件开发流程、生命周期钩子、命令、权限、状态管理 | features-plugins |
| 官方插件概览 | dialog、fs、shell、store、updater等插件;适用场景说明 | features-official-plugins-overview |
| 深度链接 | 自定义URL协议、App/Universal Links、单实例+argv参数 | features-deep-linking |
| 应用更新 | 应用内更新——检查、下载、安装、签名、静态/动态端点 | features-updater |
Distribute
分发部署
| Topic | Description | Reference |
|---|---|---|
| Packaging | build, bundle, installers (DMG, MSI, AppImage, etc.), signing overview | distribute-packaging |
| Signing | Code signing per platform (macOS, Windows, Linux, Android, iOS) | distribute-signing |
| Pipelines | GitHub Actions (tauri-action), CI signing, CrabNebula Cloud | distribute-pipelines |
| 主题 | 描述 | 参考链接 |
|---|---|---|
| 打包配置 | build、bundle、安装包(DMG、MSI、AppImage等)、签名概述 | distribute-packaging |
| 代码签名 | 各平台代码签名(macOS、Windows、Linux、Android、iOS) | distribute-signing |
| 流水线集成 | GitHub Actions(tauri-action)、CI签名、CrabNebula Cloud | distribute-pipelines |
Learn
进阶学习
| Topic | Description | Reference |
|---|---|---|
| Menus and Tray | Window menu, system tray, Menu/TrayIcon, predefined items | learn-windows-menus-tray |
| Window Customization | Custom titlebar, decorations, data-tauri-drag-region, transparent (macOS) | learn-window-customization |
| Splashscreen | Extra window, visible/hidden main, setup tasks, close when ready | learn-splashscreen |
| Sidecar Node.js | Node app as binary (pkg), externalBin, shell plugin | learn-sidecar-nodejs |
| Using Plugin Permissions | Add plugin, capability, allow commands, default permissions | learn-using-plugin-permissions |
| Capabilities per Window/Platform | Different capabilities per window; platforms array | learn-capabilities-windows-platforms |
| 主题 | 描述 | 参考链接 |
|---|---|---|
| 菜单与托盘 | 窗口菜单、系统托盘、Menu/TrayIcon、预定义菜单项 | learn-windows-menus-tray |
| 窗口自定义 | 自定义标题栏、装饰、data-tauri-drag-region、透明窗口(macOS) | learn-window-customization |
| 启动屏设置 | 额外窗口、主窗口显隐、初始化任务、就绪后关闭 | learn-splashscreen |
| Sidecar Node.js | Node应用打包为二进制(pkg)、externalBin配置、shell插件 | learn-sidecar-nodejs |
| 插件权限使用 | 添加插件、配置capabilities、允许命令、默认权限设置 | learn-using-plugin-permissions |
| 按窗口/平台分配Capabilities | 不同窗口使用不同capabilities;平台数组配置 | learn-capabilities-windows-platforms |
Reference
参考手册
| Topic | Description | Reference |
|---|---|---|
| CLI | dev, build, icon, init, migrate, bundle | reference-cli |
| Environment Variables | CI, config depth, signing, Apple/Windows/Linux, hook env | reference-environment-variables |
| WebView Versions | WebView2 (Windows), WKWebView (macOS/iOS), WebKitGTK (Linux) | reference-webview-versions |
| Core Permissions (ACL) | core:default, app, event, window, path, menu, tray, resources | reference-acl-core-permissions |
| 主题 | 描述 | 参考链接 |
|---|---|---|
| CLI命令 | dev、build、icon、init、migrate、bundle | reference-cli |
| 环境变量 | CI、配置深度、签名、Apple/Windows/Linux、钩子环境变量 | reference-environment-variables |
| WebView版本 | WebView2(Windows)、WKWebView(macOS/iOS)、WebKitGTK(Linux) | reference-webview-versions |
| 核心权限(ACL) | core:default、app、event、window、path、menu、tray、resources | reference-acl-core-permissions |