So far we have seen Javascript is being used for developing dynamic and hybrid web and mobile applications. This, however, may be the first time for you that JS is being used to develop desktop application. Electron is one framework which helps us achieve this.

Electron JS

Formerly known as Atom Shell, Electron is a framework developed by GitHub for which uses chromium on the front-end and Node.js on the back-end. It was first released in 2013 and it’s current stable release came in 2018. Applications developed using Electron are cross platform. These applications would work in Windows, Linux and Mac.

How does it work?

You can develop Electron applications purely using JavaScript. Instead of binding native GUI libraries to JavaScript, Electron application pages are web pages which are running in your application leveraging operating system APIs. What electron does is it takes and executes a JSON file with the name of package.json. The information is then transferred to the main file which creates web pages and render web pages by interacting them to the native GUI.

When the main process starts, it communicates with the native GUI of your operating system. It then creates the application GUI after starting. Along with this main process, a BrowserWindow module is used to create application windows. This renders the window GUI by taking the required HTML, CSS, JavaScript and images etc of that rendered window.

First program on Electron

First of all we create a js file where we put our code. We can name this mainfile.js.

Afterwards we create an .html file to put create the structure of the page, just like a web-page

then we can run our code using the cli

and we get the required output.

This is how you can setup your first Electron application. Electron is not yet much powerful but this can be a good start for those to build desktop application for those having a good experience in developing web applications. Other than this, Electron can also be a good platform for developing symmetric applications,