from Hacker News

Tauri 1.0 – Electron Alternative Powered by Rust

by Uninen on 6/16/22, 9:24 AM with 238 comments

  • by dang on 6/16/22, 4:44 PM

    Tauri – Electron alternative written in Rust - https://news.ycombinator.com/item?id=29807022 - Jan 2022 (419 comments)

    (The cutoff for dupes is a year or so: https://news.ycombinator.com/newsfaq.html)

  • by lewisjoe on 6/16/22, 11:47 AM

    In my curious search for lighter Electron alternatives to implement Zoho Writer's (https://writer.zoho.com) desktop app: I found Sciter[1]

    It supports multiplatform app development with HTML/JS/CSS and the entire engine's runtime is just about 5MB which is unbelievably small!

    I further analysed how this was possible, what I found was beyond fascinating.

    1. The author has wrote a compiler that supports JS with useful extensions like classes and fancy stuff, even before ES6 came into existence.

    2. He had built his own layouting engine that understands HTML and CSS 3.0

    Basically he's built a custom browser engine, but custom tailored for writing multi-platform apps. So it's super-fast without as much memory taxes. It's not backed by a BigCo or a huge community (I guess) and I'm not sure whether I'll pick it for a business critical app. But the way it's architected seems far superior than the shortcut approaches that Electron or most other alternatives take.

    The project is not even new. It's more than a decade old which itself is amazing.

    [1] https://sciter.com

  • by flohofwoe on 6/16/22, 11:15 AM

    Not to rain on the parade, but:

    - What's the point of mentioning Rust when the heavylifting is done by the system's webview widget, and applications are written in HTML/CSS/JS, just as in Electron?

    - Isn't the whole point of Electron to have version/feature stability for the browser APIs by bundling a specific Chromium runtime? Without this requirement, it was also trivial before Electron showed up to write a small native wrapper application around the system-provided webview widget.

  • by Uninen on 6/16/22, 12:17 PM

    I find it fresh and positive that Tauri developers take security very seriously. Before this 1.0 release they ordered a full security audit for the codebase and published the report ( https://github.com/tauri-apps/tauri/blob/next/audits/Radical... ).

    The project encouraged me to better my own workflows too, as even the awesome-tauri repo requires signed commits in the PR template :) ( https://github.com/tauri-apps/awesome-tauri/blob/dev/.github... )

  • by capableweb on 6/16/22, 10:26 AM

    Tauri is such a breath of fresh air for a web developer like me! I picked up Rust because of it, and was easier than I thought (I've read lots of "Rust is hard" articles).

    The application I wrote is a Hacker News client with focus on offline reading and listing comments in threads sorted by time and flat, instead of trees sorted by score (which incidentally, also works as a web application which is deployed here: https://ditzes.com/).

    I found it helpful when I'm traveling but still want to read discussions, useful for following along threads that are actively being discussed (this submission can be seen at https://ditzes.com/item/31764015 for example) and also useful when using HN comments as reference to something I'm building. Guess I'm also pretty proud that the client is VERY fast, loading 1000 comments in something like 1s (because of the caching). Like this thread for the Coinbase layoffs: https://ditzes.com/item/31742590 (1001 comments)

    The Tauri application currently works with 99% of the features of Ditzes, but the mouse "back" button doesn't actually navigate the internal browser back in history with Tauri yet, so I haven't done a "Show HN" yet as I consider that a essential feature of Ditzes (for following along threads via the "View" link) before "launching" it.

    The Tauri-part of the source can be found here: https://codeberg.org/ditzes/ditzes/src/branch/master/src-tau...

    Overall, besides the extremely long compile times, Tauri has a been a pleasure to develop with, and I'd definitively use it over Electron in the future. Really looking forward to mobile support as well, as then I'll finally have a comfortable and offline-capable HN client for my cellphone.

  • by rathboma on 6/16/22, 2:14 PM

    This looks fantastic, and Electron needs some competition.

    That said, here's my set of hesitations as an Electron app developer (Beekeeper Studio - beekeeperstudio.io).

    1. With Electron it's nice to be able to lock the browser implementation across OSs. I'd have some pause about having to support arbitrary Webview implementations. It makes testing so much harder.

    2. It's really really nice to be able to code-share between UI code and app backend code. In Electron everything is JS, so you can use the same codebase for both components. With Tauri it requires two languages and two sets of packages.

      - One example of this is an ORM for a SQLite database. I need to load some settings before the UI renders, in Electron this is the same ORM code.
    
    3. The only Linux build is a DEB.

    4. Smaller community - desktop apps are a total PITA to debug, it helps that Electron builds have been tested at length by companies like Microsoft.

  • by j1elo on 6/16/22, 11:18 AM

    This seems a very interesting addition to the Rust ecosystem. I wonder how much traction it will get, though.

    Some days ago there was an HN thread about Rust, conversing about the steep learning curve of Rust. The conclusion frequently is that maybe Rust is great for financial systems, kernels, rendering engines, media processors, etc... but just not necessarily the best tool for the job when there is no pressing need to avoid GC, and/or to squeeze the maximum performance while at the same time maintaining memory correctness. Which, on the other hand, tends to be the immense majority of application development out there...

    So Tauri seems to me has a similar issue than the Qt Framework (built on and for C++): its adoption as an Electron alternative might not be as much as it deserves, because of the difficult to learn programming language that is behind it.

    Thoughts?

    EDIT: I know Tauri is just a WebView component, but programming in Rust still seems to be an important part of developing apps with it (it is even prominently featured in the 100 seconds video of the entry)

  • by lucasyvas on 6/16/22, 2:00 PM

    For anyone not on board because of how the WebViews work, or that it uses WebViews at all, the roadmap has other renderers to be explored. I believe the majority of the Tauri framework is decoupled from "web" and it's merely supported first - likely through popularity.

    When WebView2 goes multiplatform, you might even be able to use it on every platform (if you like web, but want a consistent browser engine on each platform)

    I'm more interested in where Tauri will go next in terms of support - not where it is on day 1.

  • by galaxyLogic on 6/16/22, 3:19 PM

    An alternative to Electron I like is Vercel Pkg https://github.com/vercel/pkg .

    You write a server in Node.js, compile it to an exe with Vercel Pkg and users run the exe on their local machine and use it with their browser.

    Instead of running an app "in the cloud" they run it on the server on their machine. But the server could easily also be moved to the cloud as well.

    Using a browser to connect to an app running on your local machine has the nice feature that you can open any number of browser-views on it, looking at the app and your data and tools from multiple viewpoints. Since it is local they are the only user and don't need to login or "keep a session" and can thus interact with the app in multiple ways in parallel.

    I don't need to design in a feature that allows users to "open a new window". That is handled by the browser. Open a new tab to the same or different (bookmarked) url.

    Plus there is a benefit to coding both the server and the client in the same language.

  • by japanuspus on 6/16/22, 1:36 PM

    For anyone coming from the rust side and just looking for a cross-platform rust frontend framework: although not covered in any details by the docs, you can cut out all the web stuff and run everything from cargo.

    I have a small `hello-world` example of a rust-only Tauri application at https://github.com/Japanuspus/tauri-from-rust

  • by wener on 6/16/22, 11:35 AM

    Here is another one https://github.com/wailsapp/wails powered by Golang, but both of tauri and wails do not support BrowserView like feature in Electron, which means you can not build a brave browser on top of them.

    Depends on your skill set, wails maybe better, think building a UI based tailscale app, just make the embed web part display directly instead behind a http.Server with extra 3-5 MB

  • by crabbygrabby on 6/16/22, 11:12 AM

    Been using tauri since it was in alpha for hobby project. Experience overall is pretty good. You really can call backend rust from js, in a lightweight browser window.

    It is probably the most approachable technology for me for making desktop apps these days. Much leaner than electron, like it says on the tin.

  • by petercooper on 6/16/22, 11:08 AM

    Coincidentally I enjoyed this article yesterday about using Tauri and React to quickly build a desktop app: https://betterprogramming.pub/how-i-created-the-focus-app-us...
  • by jeremychone on 6/16/22, 1:50 PM

    Tauri is very well designed, from an app model to its component parts (wry, tao). In short, it’s a platform that allows writing Rust as the backend and use of the OS webview. So light and fast.

    I think and hope that many new desktop apps, even from the new big player, will be done in Tauri. I plan to use it for some of our future apps.

    I know mobile is a whole other beast, but I hope Tauri can also crack this one up. That would be amazing.

    Tauri rocks!

  • by AndrianV on 6/16/22, 1:57 PM

    I've always felt Tauri was too early to be a viable electron competitor, but now that I've seen it used in a huge project (Spacedrive), I think I might reconsider.
  • by hdjjhhvvhga on 6/16/22, 11:08 AM

    The other lightweight alternative to Electron is Neutralino.js:

    https://neutralino.js.org/

  • by zeandcode on 6/16/22, 3:40 PM

    Whatever their opinions on this project. I'm pretty much like it when start to create a small project, it's very light in terms of memory usage, also the size of the compiled binary is way smaller than electron.
  • by lynndotpy on 6/16/22, 2:57 PM

    That 100 second video was really very well done and convincing. I shouldn't have watched it on break because now I want to do go home and do something with Tauri :)
  • by akmarinov on 6/16/22, 10:13 AM

    Shal'kek nem'ron
  • by sourabhv on 6/16/22, 11:31 AM

    I would honestly prefer flutter instead of relying on system web view and all of its inconsistencies
  • by MuffinFlavored on 6/16/22, 3:22 PM

    https://github.com/tauri-apps/wry

    This rocks, especially with some IPC between the "native" things like filesystem + TCP sockets -> JavaScript "bridge".

  • by smdyc1 on 6/16/22, 12:37 PM

    Name inspired by Stargate?
  • by vegai_ on 6/16/22, 12:00 PM

    What is the system webview on Linux, where such a thing doesn't exactly universally exist?
  • by tensor on 6/16/22, 2:35 PM

    A similar project that I'm using is https://wails.io. It uses the native system webview and the backend is in Go. You can cross compile to Windows, Linux, and Mac.
  • by encryptluks2 on 6/16/22, 1:53 PM

    Doesn't the browser native messaging feature already provide the ability to call native applications and create a backend language API? I guess I don't understand the need for every app to basically have its own browser engine, no matter how "lite", when I can already develop apps with Chromium that use native messaging.

    I'd rather see a unified solution which pretty much exists then to have a bunch of alternatives that provide no greater benefits overall from what I can tell.

  • by api on 6/16/22, 11:15 AM

    I wonder if they've gotten around the horror of Windows distribution for native webview based apps?

    The usual problem is that you have to either use an antiquated IE based webview on Windows or install the Microsoft Edge runtime. The latter is painful to bundle and some people don't like it, especially enterprisey IT departments who consider it "another thing" they have to approve instead of just a part of the app since it's a separate OS component.

  • by sva_ on 6/16/22, 10:17 AM

    Sadly mobile support is still far off on the horizon it seems.
  • by IceHegel on 6/16/22, 3:22 PM

    I tried to use Tauri for a personal project back in January and it was missing some basic features like windows without a topbar.

    Have things matured meaningfully since then?

  • by mattlondon on 6/16/22, 11:45 AM

    Are there any good HTML ui component libraries that people are aware of?

    Not just styling buttons with CSS, but actual components like e.g. tab-strips?

  • by password4321 on 6/16/22, 4:46 PM

    Cmd+F accessibility: 0/0 - both this discussion and their site search. :(

    One issue from 2019: "Tracking : accessibility (a11y)" https://github.com/tauri-apps/tauri/issues/207

  • by synergy20 on 6/16/22, 4:42 PM

    In an ideal world, the browser could add a desktop or smartphone mode running in a separate process with web surfing(and others like cookies etc) optionally turned off, then it becomes a true universal GUI platform.
  • by CMCDragonkai on 6/16/22, 3:43 PM

    It's possible to embed nodejs (or V8 or demo) in a Rust binary. So perhaps we could embed nodejs into the rust backend and just run a nodejs app.
  • by aitchnyu on 6/16/22, 11:31 AM

    Why does Tauri say "faster" or "blazing fast"? I think it has same limitations as Electron, or did I miss something?
  • by bennyp101 on 6/16/22, 10:37 AM

    Awesome, I've been waiting for a 1.0 release to start playing around (I know its been fairly stable anyway, but still)
  • by knowsuchagency on 6/16/22, 7:56 PM

    Looks great but I can't find any references to how to implement a sidecar with the new documentation
  • by k__ on 6/16/22, 11:04 AM

    If I get this correctly, Tauri is neither about performance nor size, but about security?
  • by productceo on 6/16/22, 10:52 AM

    Is this a substitute for Flutter? (After mobile support ships)
  • by showmeademo on 6/16/22, 12:13 PM

    I had a look at the tauri site a few weeks ago but could not find a single screenshot or demo app to see what it looked like.

    It would be good to see what it actually looks like before investing in time to build something.

  • by SeasonalEnnui on 6/16/22, 10:13 AM

    Does anyone else find that the text-to-speech on the "Tauri in 100 Seconds" video sounds very unnatural?

    Tauri seems like a step in the right direction so will be giving it a go.

  • by billfruit on 6/16/22, 3:32 PM

    Is there something similar for C++.
  • by nachtigall on 6/16/22, 10:39 AM

    It still uses node.js, right? Since it is new and for the future, why not choosing deno?
  • by newbieuser on 6/16/22, 11:26 AM

    It would be really nice if they had their own app store or package manager.
  • by UmbertoNoEco on 6/16/22, 3:23 PM

    I like it,but even a trivial app becomes a huge +5GB folder in development. The dependencies folder alone will make a node project blush + all the stuff generated when compiling/building. I love to have several apps to work on them concurrently but I wont reserve 50 Gb of my already small SSD for this stuff.
  • by jbverschoor on 6/16/22, 2:58 PM

    5 clocks later too check if it’s also webviews. It is, so I stopped reading
  • by torginus on 6/16/22, 2:12 PM

    This is 'powered by Rust' the same way my gas car with electric windows is 'powered by electricity'