DEV Community

Piero Borrelli
Piero Borrelli

Posted on

Why you should know about Electron.js in 2019

I won’t lie to you admitting that, with all the Javascript frameworks available out there, I don’t know most of them. And when I say they I don’t know these frameworks I don’t mean that I’m not able to code using them, but that for some of them I don’t even know about their existence.

And that’s it, you may call me a developer not well informed, but with all the tools available out there I honestly think it’s very hard to be constantly aware of new releases. This, unless a framework becomes really important or if you just discover it randomly. Just like it happened for me with Electron.js.  

I discovered this tool almost as an error, when, during a chat someone mentioned that Visual Studio Code was a web application.


I was like: “WHAT?”


And this person was actually right. Visual Studio Code is a web application, you are even able to inspect its elements if you want. But how is that possible? How can we open what we suppose is a desktop application and then discover that it’s actually a web product?
And here comes Electron.js

The platform struggle

This framework, like every good technology out there, arises from a necessity. In our modern, always-changing and fast-paced world of development, the ability of being able to create an application and then deploy it to many different platforms using a single codebase has become a serious problem. Relying on the old ways to do that can be extremely time-consuming and expensive, just think about how different the process to develop on Windows/OSX/Linux can be: 

  • Windows: applications for this OS are usually realized using C++ or C#. Sometimes the need to be able to use these applications on different sub-ecosystems can arise other problems such as ad-hoc development for Windows Store, Windows phones etc.
  • OSX: development for OSX can be quite hard since there are a ton of informations to learn. Usually, when developing for this OS you will have to interact with many “layers” such as Cocoa for the user application interface, Media for media operations and then the Core Services. 
  • Linux: Ad-hoc libraries are used for the application interface or, alternatively, Python. Other libraries like OpenGL can provide 3d and 2d rendering while the Kernel itself will provide core functionalities. 

With all these so-different ways of developing an application, developers struggle to find a way to fast-prototype a project and to deploy a single code base to multiple platforms. 
And that’s where Electron.js comes in handy!

What is Electron.js

Electron.js is an open-source framework that allows developers to build GUI desktop applications using components originally developed for a web application. Both on the front-end side and on the back-end. A typical Electron app will be so composed: 

  • An HTML & CSS part 
  • A Node.js part
  • A Chromium engine part(Chromium is an open-source web browser )
  • Eventually, a front-end framework like Angular, React, Vue. 

The Electron framework will take care of all the hard partsso that companies and developers can focus on the core of the application and make it better.

Advantages of Electron.js

Let’s try to get an overview of some of the great advantages you can have by making use of this framework: 

  • Reusability: since we are making use of only one code base, this can be shared across web applications and desktop applications making them extremely reusable. 
  • Making use of UI/UX frameworks: since we are making use of a web app code base, we get all the advantages of using front-end frameworks that will make our app look beautiful both in the browser and on the desktop, all with the application still looking the same across systems. 
  • Cost and time for realization: now that we can use a single code base for all our platforms, we won’t only save a lot of development time because we don’t have to port the application on different systems, but this will also save us a lot of money and expenses for doing so along the way!
  • Data security: when migrating your web app to the desktop using Electron, all the data will be stored locally. This will make you sure that no data of your app get compromised. 
  • Project management: still, using a unique code base is a tremendous advantage not only because the tech requirements will be the same across all the platforms, but also because it will save you a lot of time from having to fix errors on multiple code bases. 

Conclusion

Electron was an amazing discovery for me, a tool that can make life easier for thousands of developers out there. Hope this article not only showed to you something new, but that it also encouraged to make an effort to try to discover what incredible tools are hiding out there. And just remember that, for Electron, you can even contribute to it!

Top comments (0)