Introduction
Tauri is a framework for building tiny, blazing fast binaries for all major desktop platforms. Developers can integrate any front-end framework that compiles to HTML, JS and CSS for building their user interface.
Why Tauri?
Unlike Electron which bundles Chromium, Tauri uses the underlying OS's webview. This results in:
Tiny Bundles: Apps can be < 3MB.
Low Memory Usage: Significantly less RAM consumption.
Security: Rust ownership model and strictly defined API access.
Architecture
The core of a Tauri app is written in Rust, which handles system interactions. The UI is just a web app.
Core (Rust): Manages windows, system tray, and native APIs.
Frontend (Web): React, Vue, Svelte, etc.
IPC: Communication bridge between Core and Frontend.
Quick Start
Create a new Tauri app with one command:
$npm create tauri-app@latest
Follow the prompts to select your frontend stack (e.g., React/TypeScript).
Calling Rust from React
With Tauri's invoke system, calling native code is simple.
Rust Command (`main.rs`):
#[tauri::command]fn greet(name: &str) -> String {format!("Hello, {}! You've been greeted from Rust!", name)}
React Component:
import { invoke } from "@tauri-apps/api/tauri";function App() {const [greetMsg, setGreetMsg] = useState("");async function greet() {setGreetMsg(await invoke("greet", { name: "World" }));}return <button onClick={greet}>Greet</button>;}
Conclusion
Tauri is changing the desktop app landscape by proving you don't need a heavy runtime to build cross-platform apps with web technologies.
