Exploring ElectronJS

THE ONE FRAMEWORK TO RULE THEM ALL

Aaryak Shah
tech@iiit-gwalior
4 min readMay 19, 2020

--

In the modern world, computers have a high demand. They are popular for their speed and versatility, and operating systems like Windows and macOS make them extremely user friendly (let’s not get into the debate of which is better). There’s obviously also the vast array of Linux and Unix based operating systems that are used by a lot of people, especially for servers and work computers. This diverse selection of OS’s (with all their versions), paired with a massive range of hardware combinations and related drivers makes it extremely complicated to develop cross-platform, fully functional computer applications.

Imagine you are a developer wanting to build a productivity app to aid project teams. Now you would have to consider all varieties of teams. Some may be using old or outdated operating systems, others may be working across multiple platforms, and your app should accommodate all of them. Traditionally, all platforms will provide different frameworks to enable the use of OS-specific features like notifications. This increases your development cost and time, as migrating your code from one platform to another is a tedious job, even ignoring the swarm of bugs you will have to solve.

The solution to this is obvious and yet elegant. One common framework to handle every platform. That’s where ElectronJS comes into play. Even if various systems run separate platforms with unique features, They all generally have one thing in common. A web browser. Web browsers like Chromium have already been built to support cross-platform usage of the internet, and they all compile the same code on every device. As a cherry on top, some are even open source!

Electron takes advantage of this commonality, allowing you to produce one application that runs uniformly across all systems. I’m sure some people know at least the basics of web development. You may know that web dev also requires adding compatibility code for supporting a wider range of browsers, including the legacy ones (Internet Explorer, I’m looking at you). Web applications also suffer the bane of slow internet. Now imagine if you could take the power of web development platforms, the OS-native features like file system access, the versatile debugging tools and APIs of Chromium, and fuse them all into one cross-platform framework. Presenting to you, Electron. With this, you can build purely JavaScript + HTML/CSS desktop applications with ease.

Here’s how it works:

Electron provides you with in-built javascript APIs that handle translating your code across platforms. Your User Interfaces are built as web pages. What’s great about this is you can actually use the ever expanding list of web dev tools like jQuery, Bootstrap, React, Angular and so many more!

Think of an Electron application as a miniature web browser that only compiles your app. This minimal ‘browser’ is bundled into your app package, so every copy of your app is essentially running on the same platform.

ElectronJS only gets more flexible as you dive deeper. Besides its built-in APIs, you have complete access to all the Chromium APIs, all of the built-in Node.js features, and comes with full support for third-party modules that were originally meant for web apps.

This platform is open source and has a growing, active community of users to help you develop with ease. A lot of communities are shifting towards using Electron, and you have most probably used some of the popular ones:

  • Slack: A team productivity and communication application
  • Visual Studio Code: A powerful text editor by Microsoft
  • Atom: The open-source text editor by GitHub
  • Skype: A popular VC app by Microsoft

Along with, like Discord, WordPress, Whatsapp for Desktop and many more.

Now I should probably address the elephant in the blog. It is exceedingly easy to build desktop apps on such a powerful platform, but should you? After all, every coin has two sides. This question is obviously subjective, but I would like to shed some light on the drawbacks of this framework that should be considered while building your app.

I mentioned that an Electron application is essentially bundled with a version of Chromium, and this has sparked some controversies amongst developers. While ingenious, making the user install an entire browser to run your application is a little odd. You end up running what is essentially a local webserver. The application becomes heavy and the installation becomes larger. The loading and unloading time for the app also becomes longer than it needs to be.

Now in my opinion, this is not a huge concern. Average consumer computers are becoming more and more optimized. In the past few years, even relatively low-level processors have shown great performance, and with the ever-improving range of reasonably priced hardware (thank goodness for AMD), Electron apps will run as smooth as any other. Anecdotally, I have even seen some Electron apps being used without a hitch on computers that are half a decade old.

Overall, Electron is a powerful, flexible and popular platform for your next desktop app. Truly a framework to rule them all!

--

--