Why People Hate Electron.js (and Why It&#8217;s Still So Popular)
Electron is cancer, Electron is flash for desktop, say no to Electron! Discussion forums and blog platforms are abuzz piling hate on electron – a JavaScript GUI framework that lets developers create desktop applications using JavaScript, HTML and CSS. Electron allows a developer to build a website or a web app, wrap it inside a chromium browser without all the browser controls and distribute it as if it were a native application. With Electron, you can build cross-platform programmes that run on Windows, macOS, and Linux with no prior knowledge of native development by incorporating Chromium and Node.js into their binary. It’s bad… Electron apps bundle Chromium and NodeJs out of the gate, leading to a very large app size. Even a simple app built on Chromium can be resource-intensive and probably use more CPU and RAM than a native app. The intensive use of RAM further slows down the speed of the computer and drains the battery faster. This also affects the overall user experience without the user knowing the cause of it. Yet popular… But here’s the thing, these drawbacks don’t matter much for most developers when it comes to the big picture. Despite all the hate, it is still the most-loved framework used by platforms like Discord, Whatsapp, Microsoft Teams, Slack, Twitch and many others. It is open-source and maintained by the OpenJS foundation and its cross-platform, which means that apps built with Electron run on Windows, Mac and Linux. It allows developers to build automatic updates inside of their apps to integrate with the native menu system of the operating system and with its notifications. This means that for a web or NodeJs developer, Electron offers an amazing developer experience and makes desktop apps a practical business decision for companies. Even big companies with tons of talent and cash still choose Electron because it makes more business sense at the end of the day. The only thing that matters is that you build an awesome user experience, which you can absolutely do with Electron and your users won’t even know or care what technology you used to build the app. An Electron hater, but a user summarises his experience, “To paraphrase Churchill, Electron is the worst architecture for desktop applications, except for all the other ones that have been tried.” Tauri: A panacea For a long time, developers were looking for an alternative to build cross-platform apps. Now, the wait has come to an end with Tauri. It is a toolkit for building native desktop apps with rented web technologies and a lightweight Rust backend. Tauri allows developers to use their favorite javascript framework to design a UI, and then package it for MAC OS, Windows and Linux from a single code base. Unlike Electron, which provides a back-end in Nodejs and a front-end with the Chromium browser, Tauri takes a different approach by replacing Node.js with Rust and Chromium with libraries like Tau and Wry. This approach provides a lightweight webview and the end result is a smaller bundle size and more efficient memory consumption. It also takes security very seriously and provides an isolation pattern to prevent untrusted scripts from accessing the backend from a webview. The Tauri API provides a secure way to access native functionality like the file system http and system notifications. It’s secure by default and the only way for the front-end to call back and code is when the developer explicitly allows it. Developers feel that Tauri may develop further to the point where it displaces Electron as the eminent “front-end” GUI framework. The fact that it’s created in Rust may intimidate some developers, but the brief amount of time it takes to grasp how it works is definitely worth it.
Tauri is a toolkit for building native desktop apps with rented web technologies and a lightweight Rust backend
Tauri is a toolkit for building native desktop apps with rented web technologies and a lightweight Rust backend
["Javascript", "Linux", "Rust", "Windows"]
["API", "programming_languages:R", "AI", "Javascript", "ML", "JavaScript", "programming_languages:Java", "Windows", "Rust", "Linux", "R", "Java", "programming_languages:JavaScript"]
["AI", "ML", "R", "JavaScript", "Rust", "Java", "API", "programming_languages:R", "programming_languages:JavaScript", "programming_languages:Java"]
Tausif Alam has been covering technology for almost a decade now. He is keen about connecting dots and bringing a wholesome picture of the tech world.