Logo

dev-resources.site

for different kinds of informations.

My opinion on the Tauri framework

Published at
5/16/2024
Categories
rust
tauri
gui
desktop
Author
nfrankel
Categories
4 categories in total
rust
open
tauri
open
gui
open
desktop
open
Author
8 person written this
nfrankel
open
My opinion on the Tauri framework

I've always liked GUI, both desktop-based and browser-based before you needed five years of training on the latter. That's the reason I loved, and still love Vaadin: you can develop web UIs without writing a single line of HTML, JavaScript, and CSS. I'm still interested in the subject; a couple of years ago, I analyzed the state of JVM desktop frameworks.

I also like the Rust programming language a lot.

Tauri is a Rust-based framework for building desktop applications. Here's my view.

Overview

Build an optimized, secure, and frontend-independent application for multi-platform deployment.

-- Tauri website

A Tauri app is composed of two modules: the client-side module in standard Web technologies (HTML, Javascript, and CSS) and the backend module in Rust. Tauri runs the UI in a dedicated Chrome browser instance.

Users interact with the UI as usual. Tauri offers a binding between the client-side JavaScript and the backend Rust via a specific JS module, i.e, window.__TAURI__.tauri. It also offers other modules for interacting with the local system, such as the filesystem, OS, clipboard, window management, etc.

Binding is based on strings. Here's the client-side code:

const { invoke } = window.__TAURI__.tauri;

let greetInputEl;
let greetMsgEl;

greetMsgEl.textContent = await invoke("greet", { name: greetInputEl.value });  //1
Enter fullscreen mode Exit fullscreen mode
  1. Invoke the Tauri command named greet

Here's the corresponding Rust code:

#[tauri::command]                                                              //1
fn greet(name: &str) -> String {                                               //1
    format!("Hello, {}! You've been greeted from Rust!", name)
}
Enter fullscreen mode Exit fullscreen mode
  1. Define a Tauri command named greet

In the following sections, I'll list Tauri's good, meh, and bad points. Remember that it's my subjective opinion based on my previous experiences.

The good

  • Getting started:

    Fortunately, it is becoming increasingly rare, but some technologies need to remember that before you're an expert, you're a newbie. The first section of any site should be a quick explanation of the technology, and the second a getting started. Tauri succeeds in this; I got my first Tauri app in a matter of minutes by following the Quick start guide.

  • Documentation:

    Tauri's documentation is comprehensive, extensive (as far as my musings browsed them), and well-structured.

  • Great feedback loop:

    I've experienced exciting technologies where the feedback loop, the time it takes to see the results of a change, makes the technology unusable. GWT, I'm looking at you. Short feedback loops contribute to a great developer experience.

    In this regard, Tauri scores points. One can launch the app with a simple cargo tauri dev command. If the front end changes, Tauri reloads it. If any metadata changes, e.g., anything stored in tauri.conf.json, Tauri restarts the app. The only downside is that both behaviors lose the UI state.

  • Complete lifecycle management:

    Tauri doesn't only help you develop your app, it also provides the tools to debug, test, build, and distribute it.

The meh

At first, I wanted to create my usual showcase for desktop applications, a file renamer app. However, I soon hit an issue when I wanted to select a directory using the file browser button. First, Tauri doesn't allow to use the regular JavaScript file-related API; Instead, it provides a more limited API. Worse, you need to explicitly configure which file system paths are available at build time, and they are part of an enumeration.

I understand that security is a growing concern in modern software. Yet, I fail to understand this limitation on a desktop app, where every other app can access any directory.

The bad

However, Tauri's biggest problem is its design, more precisely, its separation between the front and the back end. What I love in Vaadin is its management of all things frontend, leaving you to learn the framework only. It allows your backend developers to build web apps without dealing with HTML, CSS, and JavaScript.

Tauri, though a desktop framework, made precisely the opposite choice. Your developers will need to know frontend technologies.

Worse, the separation reproduces the request-response model created using browser technologies to create UIs. Reminder: early desktop apps use the Observer model, which better fits user interactions. We designed apps around the request-response model only after we ported them on the web. Using this model in a desktop app is a regression, in my opinion.

Conclusion

Tauri has many things to like, mainly everything that revolves around the developer experience. If you or your organization uses and likes web technologies, try Tauri.

However, it's a no-go for me: to create a simple desktop app, I don't want to learn how to center a div or about the flexbox layout, etc.

To go further:


Originally published at A Java Geek on May 12th, 2024

gui Article's
30 articles in total
Favicon
Criando interface grΓ‘fica Desktop nativa utilizando C++ com GTK3
Favicon
Interview with Eson (Seven), Creator of DocKit!
Favicon
Tkinter: Python's Secret Weapon for Stunning GUIs
Favicon
Creating a Native Desktop GUI Using C++ with GTK
Favicon
FEATool Multiphysics 1.17 - Multi-CFD solver and OpenFOAM Simulation Toolbox
Favicon
Introduction to Linux GUIs: Unpacking the Basics of Desktop Environments, Window Managers, and More
Favicon
Gui version for my docker-like solution native to macOS
Favicon
How to Build an SQLite GUI (Fast & Easy Tutorial)
Favicon
Go and WebUI
Favicon
AI Image and AI Chat pocket tool | Python GUI for windows.
Favicon
From Blue To Cool: We’ve given the MIDAS UI a makeover
Favicon
My opinion on the Tauri framework
Favicon
How One Experienced Software Engineer Learns a New Programming Language
Favicon
A detailed comparison of Toad for Oracle and dbForge Studio for Oracle
Favicon
Best alternative to SQLyog
Favicon
Docker - a terminal GUI
Favicon
RSGL | Modular header-only cross-platform GUI Library for easily creating GUI software your way!
Favicon
Rust has Reignited My Love for Programming
Favicon
Code-Along: How to Develop a REST API Dashboard
Favicon
How to Create a SQL Server GUI in 4 Steps
Favicon
Experimenting with GUIs on the Pi Zero
Favicon
Mastering Qt: Complete C++ GUI Course
Favicon
Mastering Qt: Complete C++ GUI Course
Favicon
How to Create a SQL GUI in 4 Steps
Favicon
Creating a GUI in Python With TtkBootstrap
Favicon
Trying egui: building a Cistercian Clock with Rust GUI
Favicon
Building a Custom Alarm Clock with Python and Tkinter
Favicon
How To Create GUI Window Using Python's Tkinter
Favicon
Select the best GUI toolkit – part 7: pyQt
Favicon
Why won't my code open the Tkinter window?

Featured ones: