- Home
- Skills
- Dchuk
- Claude Code Tauri Skills
- Tauri Frontend Rust
tauri-frontend-rust_skill
12
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill dchuk/claude-code-tauri-skills --skill tauri-frontend-rust- SKILL.md10.4 KB
Overview
This skill guides integrating Rust-based WASM frontends (Leptos, Yew, Dioxus, Sycamore) with Tauri v2 using Trunk as the bundler. It explains required project layout, Cargo and Trunk configuration, enabling withGlobalTauri, and accessing Tauri APIs from WASM. The goal is a reproducible SSG/SPAs workflow for desktop and mobile development with hot-reload and optimized WASM builds.
How this skill works
It inspects and prescribes configuration for tauri.conf.json, Trunk.toml, and frontend Cargo.toml to ensure the frontend compiles to WASM and is served to Tauri. It enforces static-site or CSR-only builds, enables window.__TAURI__ via withGlobalTauri, configures Trunk dev server and ws_protocol for hot-reload, and shows patterns to call backend commands using wasm-bindgen or tauri-wasm. It also outlines build and release steps and size optimizations.
When to use it
- Building a desktop app with a Rust WASM frontend and Tauri v2
- Developing with Leptos, Yew, Dioxus, or Sycamore using Trunk
- Needing Tauri API access from WASM (invoke, events, dialogs, fs)
- Implementing hot-reload for local or mobile dev environments
- Packaging a small optimized WASM binary for production
Best practices
- Use SSG/CSR only; avoid SSR or server-side features in frontend frameworks
- Set withGlobalTauri = true in tauri.conf.json to expose window.__TAURI__
- Match Trunk serve port to devUrl and set ws_protocol = "ws" for mobile hot-reload
- Add crate-type = ["cdylib","rlib"] and wasm32-unknown-unknown target for WASM builds
- Optimize release profile (opt-level = "z", lto = true, codegen-units = 1) and consider wasm-opt post-processing
Example use cases
- Leptos SPA calling a Tauri command via wasm-bindgen invoke to fetch native data
- Using tauri-wasm crate in a Yew app to emit/listen to Tauri events
- Mobile testing: trunk serve with address = "0.0.0.0" and devUrl pointing at your machine IP
- CI build: trunk build --release then cargo tauri build to package the native app
- Debugging: trunk serve for frontend-only iteration before running cargo tauri dev
FAQ
withGlobalTauri exposes window.__TAURI__ so wasm-bindgen or tauri-wasm can access invoke, events, and other APIs from WASM. Without it Tauri APIs are undefined.
How do I get hot-reload on mobile devices?
Use Trunk.toml serve.address = "0.0.0.0" and serve.ws.ws_protocol = "ws", set tauri.conf.json devUrl to your machine IP, and ensure firewall/port access.
Which method to call Tauri APIs from WASM is recommended?
Direct wasm-bindgen gives fine-grained control; tauri-wasm offers convenience wrappers. Both work; choose based on preference for control vs ergonomics.