Electron Notes

Quick notes to get you started on programming the Electron


These are a limited set of nodes to get down to programming the Electron quickly. Official detailed documents are to be found here.

Key Concepts

The term key is subjective, but I think of these as the first things to be aware of to get a good grasp on the electron programming ecosystem.


An electron application has two processes that run the entire logic. The main and the renderer processes. These exchange messages over internal IPC mechanisms.

The main process

The main process is akin to a backend service, and holds the main entry routine from where it all starts. Very much a node process, and no browsery Javascript.

The renderer process(es)

The UI is handled by the renderer. From the windows to displaying the HTML with the right CSS, to executing DOM-centric Javascript. But with more privileges than the usual browser.


The IPC infrastructure is used for communicating between the main and renderer processes. It supports both synchronous and asynchronous style messaging. The IPC message handling objects are instances of the EventEmitter class.

  • ipcMain (Convenience)

In the main process for communicating with the renderer.

  • ipcRenderer (Convenience)

In the renderer process for communicating with the main process.


Convenient way to handle IPC from the renderer, giving the impression of working with local objects.

const {BrowserWindow} = require('electron').remote
let win = new BrowserWindow({width: 800, height: 600})

Remote Objects

Each object returned by the remote module represents an object in the main process. Hence, any interaction (method call) on those objects is actually synchronous remote-procedure calls. But using remote objects is tricky and the programmer needs to be acutely aware of how references are passed between main and renderer. Apart from life-cycles and garbage-collection.


The shell module provides functionality related to desktop integration. Like handling exploration of local files and filesystems, or invoking external handlers/applications as appropriate.

Useful tidbits

This is work in progress

In this section, I plan to capture useful tidbits in code that demonstrate something useful, or surprising. Like, useful snippets maybe…