Tauri

Building Cross-Platform Desktop Applications with Tauri — Part I

Yonatan Dawit
3 min readSep 23, 2022

--

The catchy statement “Write once, run everywhere” rings bells to a software developer’s ears, as they just have to do an excellent job of developing the app once, and it will run on multiple platforms with minor tweaks.

This approach is doing wonders in saving time and resources for developers and companies especially in the mobile app sector as they can use the rapidly growing libraries and frameworks such as “Angular, React & Flutter…” to develop applications that are cross-platform yet still “native”.

Since the web frameworks and libraries offer so many functionalities, developers have been working on bringing that option to be used to develop cross-platform desktop apps and Tauri has just made the list.

As the Tauri team say on their description page,

Tauri is a toolkit that helps developers make applications for the major desktop platforms, using virtually any frontend framework in existence. The core is built with Rust, and the CLI leverages Node.js making Tauri a genuinely polyglot approach to creating and maintaining great apps.

How does it fare against its competitors?

One of the dominant frameworks used both by indie developers and companies to develop cross-platform desktop applications is Electron. Electron uses the Node.js for its backend and Chromium for its front end which in a way fuels its shortcomings.

No doubt you have heard how all Chromium projects result in large bundle size and what they are most notoriously known for as “memory hog”. To combat this, Tauri uses the TAO and WRY libraries to create a lightweight WebView that results in a smaller bundle size and less memory usage.

Security

  • No Server is Required. Tauri doesn’t need to run a server in order to communicate the backend but rather is compiled and exported with the app so no traffic can be sniffed on TCP ports or external processes.
  • Allowing API. Tauri doesn’t ship all the native functionality code with the application i.e. file system access, notifications…etc, but rather the developers choose to opt-in to the feature they want to be shipped. Read more on Allowing API.

Pro of Tauri

  • Ultimate freedom to use whatever frontend framework you want. And this works out of the box and you can also integrate an existing project into a desktop app easily.
  • The distributable file is also much smaller i.e. starting from 3MB compared to Electron starting from 50MB.
  • Ability to use the robustness of Rust i.e. performance and memory management out of the box.
  • Tauri uses Rust for the backend and it does so without the need of starting a server in order to communicate with the frontend, which is memory efficient and secure.

Cons of Tauri

  • Everyone agrees Rust has a steep learning curve, so it might slow down development.
  • As of Tauri v1.0, cross-compilation is buggy and you will probably use a VM, or using a CI/CD service such as GitHub actions as a workaround.
  • Tauri is a new framework so it doesn’t have a wide range of communities which might make it difficult to seek help.

Conclusion

Tauri offers a wide range of advantages over its competitors. With that, given time, it will no doubt be competing neck to neck with the already established frameworks, so it would be wise to give it a try.

Stay tuned for the subsequent parts showing real-world applications implemented in Tauri.

If you found this story helpful, don’t forget to give it a clap, and please do share your thoughts in the comment section. Thanks for taking the time to read my story.

--

--

Yonatan Dawit
Yonatan Dawit

Written by Yonatan Dawit

Fullstack software engineer with keen focus on design and simplicity of products.

Responses (1)