What is Tauri?

Tauri logo

Tauri is a cross-platform programming framework based on Rust. In this article, you’ll learn why Tauri might take over from Electron as the cross-platform framework of choice and how the framework is used.

What is the Tauri framework?

Tauri is a relatively new cross-platform application framework. Many apps we use day-to-day, like Slack, Microsoft Teams, and Discord run on a framework called Electron. But you might have noticed that those apps, Teams I’m looking at you, are slow and clunky. Electron-based apps can be a real resource hog, partly because they require Chromium, the rendering engine used by the Google Chrome and Microsoft Edge browsers.

It’s easy for programmers to create cross-platform applications with Electron. You code once and your app can run on Windows, Mac, and Linux. Electron works with simple coding languages like HTML, CSS, and JavaScript.

But the disadvantage of Electron is that because each app needs to carry a complete version of the Chromium source code with it, it’s intensive in terms of disk space. And Chromium is not very efficient when it comes to processor and memory usage.

Tauri aims to bring solve these issues with the simplicity of Electron but closer performance to a native app.

What language does Tauri use?

Tauri is based on Rust and it comprises of two components:

Tau handles creating windows and managing icons. For example, icons on the taskbar and system tray, tasks like that.

Wry is an engine that’s similar to WebView. It gives programmers the ability to create cross-platform apps easily using HTML and JavaScript.

If you put Tau and Wry together, you get Tauri. And if you have the skills and the knowledge, you can use it to create applications in Rust. Although the learning curve for Rust is steeper than for HTML and JavaScript. Nevertheless, there are a lot of similarities between programming applications in Tauri and Electron.

Is Tauri better than Electron?

There’s been a lot of chat about Rust in the past year because it’s a memory safe language. Programmers don’t have to think about memory protections and build them into their code manually; it’s all handled by Rust.

Unlike some memory-safe languages, C# for instance, Rust has comparable performance to C++. Google announced recently that it would be introducing Rust to some APIs and elements in the Chromium project to improve performance and security. That’s exactly what Rust was designed for.

Tauri performance and disk footprint

The biggest advantage of Tauri is applications can be up to 44 times smaller in disk footprint. And Tauri apps use about half the memory of their Electron counterparts. So, if you’re working on a notebook, your battery is going to last longer. Tauri also claims to be more secure.

Apps will be more responsive and start faster. And in general Tauri makes better use of system resources.

Tauri vs Electron in the enterprise

All this sounds great and you might be thinking why aren’t companies like Slack and Microsoft ditching Electron and moving to Tauri? There are several reasons:

  1. Tauri is relatively new on the scene, so it’s not as mature as Electron yet.
  2. There are certain things that Tauri can’t do but as time goes by it should reach feature parity with Electron.
  3. Electron is well established in the enterprise. IT teams know how to roll out and manage Electron apps.

The future of Tauri

According to the people behind Tauri, while app backends today need to be programmed in Rust, the future will bring other options for the backend, like Go, Nim, Python, and C#. Microsoft is already moving away from Electron. The new Outlook and Teams clients are based on Microsoft’s WebView2 technology.

And for companies that don’t want to rely on tech provided by companies like Microsoft and Google, or want to be completely open source, Tauri looks like it might be a great alternative to Electron.