DEV Community

Cover image for Tauri + NodeJS: Alternative to Electron
Marcin
Marcin

Posted on • Updated on • Originally published at marcin.codes

Tauri + NodeJS: Alternative to Electron

Tauri is a framework for building binaries for all major desktop systems. The main advantage is using Rust under the hood and webview for serving our frontend app. Thanks to such a setup apps produced by Tauri are fast and small. But it couldn’t fully replace the electron — until now!

Start with NodeJS then move to Rust

The learning curve of Rust can be overwhelming. That was my case. I made 3 tries to start writing some basic code in rust. I’m getting better and better every time but I can’t be that productive as I’m in NodeJS.

Tauri has a sidecar, a way to embed external binary running with your app. Thanks to this we can run node binary alongside our app and communicate with it!

Here are Tauri sidecar docs if you want to know more about how it works.

Taurine

Although it’s not straightforward how to make it sidecar work with node.

I made small starter repo. You can find it here https://github.com/marcincodes/taurine.

How does it work?

To run NodeJS as a sidecar we need to pack it into binary. Taurine is bundling your server code and preparing it for packing into a single binary. Using Vercel’s pkg CLI tool we can compile it into a single executable binary. That binary is running with the Tauri application.

Wait… there are more. Taurine comes also with support for Fastify and tRPC.

In development, taurine will reload binary when you save server-related files.

Comparison with Electron

Tauri has a small footprint by default but what about when we pack NodeJS binary with our app? The result of this is surprising. Taurine app is 3 times smaller than electron app. Compiled the Tauri app in .app the format has 63MB and the electron app in the same format has 205MB.

Learn more about the comparison of Taurine and electron.

Roadmap

Taurine is more like PoC and supports only React. I want to extend taurine further. I want to make it frontend agnostic, the same as Tauri is now. Also, comparison to Electron is not enough. There are other alternative interesting libraries like Socket SDK.

Let me know what you think about Taurine! You can find me on Twitter: https://twitter.com/marcin_codes

Top comments (0)