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.
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.
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.
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.
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.
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.
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:
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.