Tauri - Build Desktop Apps with Rust & Web Technologies

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. The backend of the application is a rust-sourced binary with an API that the front-end can interact with.

Tauri uses a combination of Rust tools and HTML rendered in a Webview, which can control the system via message passing.

Tauri apps are very small, because they use the OS’s webview, and do not ship a runtime, since the final binary is compiled from Rust.

End users will be provided with binaries in ways that are appropriate for their systems. Whether macOS, Linux, or Windows, direct download or store installations - they will be able to follow procedures for installing and removing that they are used to.

Tauri vs Electron

Electron uses Chromium under the hood so your user sees the same on Windows, Linux and macOS. Tauri on the other hand uses the system webview: Edge Webview2 (Chromium) on Windows, WebKitGTK on Linux and WebKit on macOS.

Tauri apps are much lighter than Electron apps due to their webview approach. In fact, a sample application built with Electron that weighs more than 52MB would weigh much less, around 3MB, when built with Tauri.

Tauri apps also outperform Electron apps in terms of performance, launch time, and memory consumption.

Tauri includes a self-updater feature that you could quickly integrate into your application without relying on any third-party libraries.

Electron has some more advantages such as a rich ecosystem and documentation, as well as lot of tutorials and resources available online.

Getting Started

You must first install the prerequisite toolchains for creating a Tauri app. At the very least this will entail installing rust & cargo, and most likely also a modern version of node.js and potentially another package manager. Some platforms may also require other tooling and libraries, but this has been documented carefully in the respective platform docs.

npx create-tauri-app

Which will ask you a bunch of questions about the framework you want to install and then create everything you need in a single folder - some via the placement of template files and some through normal installation procedures of your framework.

Once everything is installed, you can run:

yarn tauri dev

If you change your HTML/CSS/TS/JS, your framework devserver should give you its best shot at instant hot module reloading and you will see the changes instantly. If you modify your rust code or anything in the Cargo.toml, the window will close while rust recompiles. When finished it will reload.

Configuration

By default, the configuration is defined as a JSON file named tauri.conf.json, where you can define your frontend assets, configure the bundler, enable the app updater, define a system tray, enable APIs via the allowlist and more.

{
  "build": {
    "beforeBuildCommand": "",
    "beforeDevCommand": "",
    "devPath": "../dist",
    "distDir": "../dist"
  },
  "package": {
    "productName": "tauri-app",
    "version": "0.1.0"
  },
  "tauri": {
    "allowlist": {
      "all": true
    },
    "bundle": {},
    "security": {
      "csp": null
    },
    "updater": {
      "active": false
    },
    "windows": [
      {
        "fullscreen": false,
        "height": 600,
        "resizable": true,
        "title": "Tauri App",
        "width": 800
      }
    ]
  }
}