Recently I've released to the public a new side project of mine, Vermilion. It's a fast and stylish music player with a bunch of streaming services integrated, written with electron, svelte and typescript.
A lot of people have seen it already, and if there was one thing people did not like, it would be the fact it's electron.
Corporate electron apps have plagued us for ages and skewed our opinions on this tool.
Electron ain't bad
Electron is essentially a chromium browser displaying a webpage, but locally. Shocker, right?
This fact alone makes a lot of people consider electron to be slow, inefficient, and "not native", whatever that means at this point. However, the reality is that none of these are true.
Efficiency
Electron is extremely efficient. If it wasn't, your favorite chromium-based browser wouldn't run at all on your computer. It's just that electron bundles a lot of things all at once, to make your app run well. Like, well, any other toolkit.
RAM
"Electron eats up all my RAM!!!!!"
No, it doesn't. You are just gaslighting yourself. Any modern app will use a bunch of RAM to render pretty graphics. Just right now, I checked:
- Vermilion (electron): 215MB
- Dolphin (qt6 / kde): 258MB
- Nautilus (gtk4 / libadwaita): 374MB
Electron is not heavy. Modern app development is. As our apps do more, they also become more expensive to run. What a shocker.
Storage
"Electron apps are huge!!!!!"
Yes, because they bundle all the dependencies. Flatpaks and appimages also are. Doesn't mean they are bad. In fact, it makes them more portable and reliable.
Speed
"Electron apps are slow!!!!"
No, corporate-made apps are often just poorly written. Their websites are slow too, doesn't mean every website is.
Electron is just plain better for some things
Especially as I am dealing with an app to stream music, all of these streaming services are built on top of web technologies. It's a great idea to also use them. Some examples:
DRM
Yes, these services often use DRM. That DRM requires you to use (something) made by someone else. Yes, that (something) is 99% compatible and readymade for web.
For example, with Tidal, I had to implement widevine by Google. There's already a well-maintained electron fork with Google's implementation of the trust pipeline, and a google-made nodeJS package which implements the "glue" between that and the remote server.
With anything else it would've been reasonable to say this would be extremely hard (if not potentially impossible) to implement.
Another example, with Spotify, the only legal way to play Spotify music in your app is via their JS module, that is live fetched from their server. Anything else will risk getting you banned, or into legal trouble.
Development speed
Typescript and electron in general are made for very rapid development. Especially if you have experience in web technology (html / css / js), it's really easy to make good-looking apps really quickly.
GTK and QT have their own respective frameworks for that, but they are not nearly as easy to grasp and use as web technology is. The web has had way more development effort put into it, let's be real.
Networking
Async networking is a constant occurrence in these apps. Web tech is made for this.
Is electron for everything then?
Technically, yes. Practically, of course not. Some apps should be minimal and fast, especially core applications of your desktop. However, for complicated apps, often ones that are heavily online and cross-platform, it is completely logical to use electron.
What we have to keep in mind is that electron, just like any framework, can be fast, as long as the developer doesn't make it slow. There are many apps based on electron that work really well, for example obsidian or vs code. They show how writing an app in electron doesn't immediately make it slow.
Especially with the recent advancements in WASM, if one is willing to offload some of the heavylifting of their app into that, it could make electron apps absolutely competitive with other apps, written with more traditional desktop toolkits.
Closer
Let's be real. None of us would be complaining about electron if not for the garbage that companies make with it. Half the damn complaints are about outdated electron, for crying out loud, not electron itself.
Just see how many tabs an average person can have open, even on their phone, and you'll realize that just because it's a browser page, doesn't mean it's slow :)