Desktop Apps (Tauri)

Same web code. Now it lives in the taskbar.

▶ the lesson · narrated sketch video · tap for sound

the intro

Tauri builds desktop apps — and since version two, mobile apps too — from web frontend code with a small Rust backend. Compared to Electron, bundles are megabytes instead of hundreds. System trays, native menus, and file access included.

fun fact ✦

Tauri apps use your OS’s own web renderer — that is why bundles are megabytes, not gigabytes.

the docs

the deep dive

the ideas behind the video — concepts, diagrams, a walkthrough and the traps to avoid

Electron ships a whole Chromium with every app; Tauri borrows the webview your OS already maintains and adds a small Rust core for everything web cannot do — files, processes, tray icons. The frontend stays the HTML, CSS, and JavaScript you already write, and the Rust side is optional muscle. The result: installers measured in megabytes and memory bills to match.

borrow the browser, don't bundle it

WindowsmacOSLinuxiOS + Android
one web frontend, four native shells — the Rust core compiles for each

key terms

webview

The OS's own browser engine, minus the browser UI. WKWebView on macOS, WebView2 on Windows, WebKitGTK on Linux.

WKWebView on macOS

command

A Rust function marked and registered so the webview can call it like an RPC.

fn greet(name: String)

invoke()

The JavaScript side of the bridge — pass typed args as JSON, await the result.

await invoke('greet', { name })

capabilities

Tauri 2's permission config: windows get explicit grants for commands and plugins.

grant "fs:allow-read" in config

how it works

  1. 1
    Scaffold it

    create-tauri-app pairs a template frontend with the src-tauri Rust folder in one command.

  2. 2
    Keep your frontend

    Vite, Next, Svelte — whatever you already build stays the UI. Tauri just points at its dev server.

  3. 3
    Write a command

    Mark a Rust function with #[tauri::command] for anything the web cannot reach.

  4. 4
    Register and invoke

    List it in the handler, call invoke() from JavaScript, pass and receive typed JSON.

  5. 5
    Build the installers

    tauri build emits .msi, .dmg, and AppImage files — a few megabytes each.

the code, explained

the whole bridge: a Rust function and one call from JavaScript

1// Rust side: a command
2#[tauri::command]
exposes the function over the IPC bridge
3fn read_note(path: String) -> String {
4 std::fs::read_to_string(path).unwrap()
5}
6
7// JS side: call it like an RPC
8await invoke('read_note', { path: 'a.md' })
args are serialized JSON; the result comes back

side by side

Tauri

  • bundle: roughly 3-10 MB
  • uses the OS webview
  • Rust core, tiny memory use
  • mobile targets included in v2
VS

Electron

  • bundle: 100 MB and up
  • ships its own Chromium
  • Node core, huge ecosystem
  • same rendering on every OS
🪤 gotcha

There is no Chromium in your bundle, so there is no single rendering engine either. Your app runs WebKit on macOS and Linux, which lags Chromium on some newer CSS and JavaScript. Test on all three desktops early, or the Windows demo will sing while the macOS build wheezes.

quick answers

Do I need to know Rust?

For the happy path, barely: copy a command, mark it, call it. Reach for real Rust when you want performance or native libraries.

Why is my invoke denied?

Tauri 2 gates every command through its capability system. Grant the command or plugin to your window in the capabilities config.

Does Tauri do mobile?

Since version two: the same web frontend, with Rust cores compiled for iOS and Android. Desktop-first API surface, with mobile support still maturing.

quick hits about Desktop Apps (Tauri)

short answers · interviews, tips, trivia & hidden gems

🎤 interview

Electron vs Tauri?watch ↗

📚 tutorial

The Tauri developer experiencewatch ↗

💎 deep

Call Rust from JavaScriptwatch ↗

🆕 update

Tauri 2.0 does mobilewatch ↗