Distinction between main and renderer process


Someone asked a similar question last month and they were linked to this post. In that post it was basically stated that all code should go in the renderer process. And apparently this can be done easily: file system operations, calling things with child_process.exec, accessing the app global variable directly (well really through electron.remote), and all the cool node.js modules are available.

This surprised me because I saw the renderer process as existing in a “browser” like chrome or something, meaning you can’t access the computer system itself, just the DOM, but apparently this isn’t the case!

So my question is this, what exactly does the main process do? Because it seems all my logic and scripts and such can be moved to the renderer side and the only thing that needs to go in the main.js file is the boilerplate code from the quickstart.

Also, is there any in depth reading on the underlying architecture of electron short of the source code? I’m curious about how everything is really tied together under the hood (and I suspect this will answer most future questions like this I may have).


As I stated in the topic you linked:

The [main process] side is really just there to work with the OS to build the native window, set everything up and hand off to the Renderer.

It also provides a method of coordinating multiple GUI windows by having one central “point of contact” that manages all the windows.

Depending on what you mean by “in depth”, you’re asking for a description of the underlying architecture of Chromium, Node, and some Electron stuff. There is plenty of documentation on Electron here:


You might want to start with the Electron Quick Start here that describes some information on the difference between the Main and Renderer processes:


This article on the Source Code Directory Structure also suggests that you might want to refer to the Chromium Multi-Process Architecture.

But again, I’m not sure what you mean by “in depth” …


Ok, sorry for essentially restating the question, I was just confused by my own conclusions from the original post! I guess the renderer process is actually where most of the code should go (which initially seemed counterintuitive to me because renderers usually steer clear from logic).

“In depth” might not have been the best way of describing things. I know Electron is built on Node, Chromium, and V8, I was just curious how everything connected together and flowed.