DEV Community

Alex Spinov
Alex Spinov

Posted on

Tauri Has a Free API: Build Desktop Apps With Web Tech at 1/10th the Size of Electron

An Electron "Hello World" is 150MB. A Tauri "Hello World" is 3MB. Same web tech frontend. 50x smaller.

What Is Tauri?

Tauri builds desktop applications using any web frontend (React, Vue, Svelte, vanilla) with a Rust backend. Instead of bundling Chromium (Electron), it uses the OS's native webview.

Quick Start

npm create tauri-app@latest
cd my-app
npm install
npm run tauri dev
Enter fullscreen mode Exit fullscreen mode

You get a native desktop window running your web app. On macOS it uses WebKit, on Windows it uses WebView2, on Linux it uses WebKitGTK.

Communicate Between Frontend and Backend

// src-tauri/src/main.rs
#[tauri::command]
fn greet(name: &str) -> String {
    format!("Hello, {}! You've been greeted from Rust!", name)
}

fn main() {
    tauri::Builder::default()
        .invoke_handler(tauri::generate_handler![greet])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}
Enter fullscreen mode Exit fullscreen mode
// Frontend (any framework)
import { invoke } from "@tauri-apps/api/core"

const greeting = await invoke("greet", { name: "World" })
// "Hello, World! You've been greeted from Rust!"
Enter fullscreen mode Exit fullscreen mode

File System, HTTP, Shell — All Built In

import { readTextFile, writeTextFile } from "@tauri-apps/plugin-fs"
import { fetch } from "@tauri-apps/plugin-http"
import { open } from "@tauri-apps/plugin-dialog"

// Read files
const content = await readTextFile("/path/to/file.txt")

// HTTP requests (no CORS!)
const response = await fetch("https://api.example.com/data")

// Native file dialog
const selected = await open({ filters: [{ name: "Images", extensions: ["png", "jpg"] }] })
Enter fullscreen mode Exit fullscreen mode

Electron vs Tauri

Metric Electron Tauri
Hello World size 150MB 3MB
Memory usage 150MB+ 30MB
Startup time 2-5s <1s
Backend language JavaScript Rust
Auto-updater Built-in Built-in
Cross-platform Yes Yes + mobile (v2)

Tauri v2: Mobile Too

Tauri 2.0 supports iOS and Android. Same codebase → desktop + mobile.


Building desktop apps? Check out my developer tools or email spinov001@gmail.com.

Top comments (0)