A Quick Post on Electron to Tauri Conversion

I will start to say, I am by no means an expert on anything in this post.

Over the life-pause of 2020/2021 I started working on some text journaling tools to fill some gaps in my life caused by programs being abandoned and turned into subscription models.

One of the tools was made with Electron and Svelte, and I am quite proud of it and use it nearly daily for journaling and rapid notes.

I recently got a Framework laptop and run Fedora Linux (KDE) on it. Love it, it’s great. I was able to, after some reading, build the Electron app for Linux and use it there.

Recently I started re-investigating Tauri. Tauri is a stack similar to Electron in the sense that it uses web tech (HTML, CSS, Javascript) for the UI with a Node.js / web view foundation.

I had looked at Tauri when I started this app, but at the time Tauri was in Alpha and lacked several features I needed.

I thought, what would it take to port this Electron app to Tauri?

I started on Monday evening, starting with setting up the Tauri app template. It has a Svelte option and was easier to set up the two than Electron had been.

From there, however, the youth of Tauri started to show itself. Often the biggest speed-bump to getting things changed was the lack of documentation or examples.

Admittedly part of this is going to fall on me and my skillset.

It took two evenings to get things mostly set up. The Svelte UI worked just fine, and I didn’t have to change anything, save for a single CSS mod. It was really just the hooks back to the operating system that needed changed, and the quirks that came with it.

For example, the functions to write txt files in Electron call back to the backend, but can be called from the Svelte files.

In Tauri they live in the frontend with the right plugin loaded, which makes them easier to set up; however, they can’t live in the Svelte files, and so I had to make a util.js file to hold those type of functions. This wasn’t obvious from the documentation, and it took trial and error to figure out why this wasn’t working.

One of the advantages touted of Tauri is the smaller file size. The Electron app is about 65 megs. The .deb (Debian Linux file type) version of the app was 4.6 megs!

But. Because there has to be a but. Tauri does not export to RPM (Fedora Linux file type). Instead it does an appimage, which is an all in one file that runs on most Linux distributions. It was 80 megs in size.

Tauri did use less ram, 165 megs v 230 megs.

My port was only about 80%. It works, but lacks some things like a menu, spell check, remembering window size, things that I have no doubt could be set up with some more work, but were not as straight forward to set up as they had been on Electron. Again, this is probably a combination of my experience and the documentation.

I plan to write up the apps themselves independent of the framework, so more to follow.