DEV Community

Gabriel Jemail
Gabriel Jemail

Posted on

The Electron Framework and modern apps

Many of the apps the world uses every day are Electron apps. The ability to use webapps as native apps and use the same language in the backend is amazing. But everyone knows Electron has its cost. So, what is Electron actually useful for?

What is Electron?

If you aren't familiar with Electron, it is a framework/bundler for building native apps using web apps. It also uses a local Node.js backend, allowing you to write both sides in both languages. That seems great, and it is, until you analyze the end result.

Electron is known for memory and disk space requirements that seem insanely bloated, even for non-Electron apps that still use web code. This is because it bundles an entire instance of Chromium. It runs a headless version, but includes the whole browser. Chromium actually made an embedded framework called CEF (Chromium Embedded Framework), but Electron is not to be confused with that.

So, why is it so popular?

It's simple: Electron is better for teams.

Almost every developer who has done both native and web development will tell you that native code takes a lot of effort to work with, and can become a nightmare with even one mistake in team environments. Note that I mentioned teams there. Many use Electron because web code is much easier to work with in teams, especially for companies, and is also compatible with web frameworks, which satisfies the many framework-specific front-end developers out there. You can even bring in back-end developers if you must to work with the Node.js code.

But using Electron comes with the massive cost on users. Although it might seem like it, about 90% of users are not using powerful PCs. Around 25-30% of them don't have more than 4 GB of RAM.

My Personal Take

This might be a hot take for some, but...
Developers make apps to serve users, and modern frameworks like Electron and many libraries seem to be serving the developer. I understand it's hard to do things the right way (if you can acknowledge that), but if you have forgotten that you are serving users and not yourselves, you are not a developer.

I don't intend to offend anyone who uses Electron, but the better choice will always be native. If you want to use a web-based front-end, there are so many alternatives out there.

Electron Alternatives

If you or your company intend to start a project any time soon, I recommend one of these instead of Electron.

Tauri

Tauri is a Rust framework that uses whatever web engine integrated with your shell (such as WebView2 on Windows, Safari on macOS, and Gecko on most Linux distros) to render a web-based UI for your application. The backend is still Rust, but the front-end is so much lighter, and you'll have much more control over the app's lifecycle.

Size comparison (minimal app):
Tauri: <5 MB
Electron: 200+ MB

Flutter

If you have or plan to make a mobile app, your best option is Flutter. Flutter can also build desktop apps and even web apps (do not use!).

With Flutter, your app will be written in Dart code and compiled for different platforms. The Flutter SDK and overall requirements for debugging are very intensive, so it may not be suitable for all. In desktop build situations, Dart will be compiled to C++, then compiled again with Flutter's rendering engine and libraries. The output is similar to code written in native C++ and optimized for the specific platform almost perfectly, but it's platform independent.

Size comparison (minimal app):
Flutter: 20-30 MB
Electron: 200+ MB


In conclusion, Electron makes a lot of sense for teams, but there are alternatives out there that will better serve the user.

If you read this on the 25th, Merry Christmas.

Top comments (2)

Collapse
 
gabrieljemail profile image
Gabriel Jemail

Side note: The estimates I made are not perfectly accurate. A lot of that depends on the platform you build for. I picked the averages for my builds on Linux for each one.

Collapse
 
iccb1013 profile image
Chao Shu Shen

Great write-up! I liked how you clearly laid out both the strengths and trade-offs of using Electron in modern apps — especially the point about team productivity versus user impact. It’s an interesting balance of practical and user-centric thinking. Thanks for sharing!