i thought renderer process in electron sandboxed in chrome-like environment, meaning can mess dom. however, learned can access filesystem, run child processes , output, , import other node modules want.
if case, distinction between main process , renderer process? not hard separation? kind of code goes in main process , kind of code goes in renderer process?
if has in-depth reading/presentation on electron app architecture love @ too; might clear of confusion
the main/renderer process distinction isn't electron concept per se -- it's inherited chromium (here's article on chromium's architecture , reasoning behind it). architecture chrome uses performance , stability reasons. each webcontents instance runs in it's own process (a "renderer" process). main process (there can 1 of these) manages webcontents instances, among other things.
there's good discussion here on differences between two.
some apis available in 1 process or other, can sense of logic goes where. example, notifications (uses html5 interface implemented native notifications) can created renderer process. menu class can called within main process. read through electron modules' api docs , see goes where. can use ipc, remote module, or electron-remote coordinate between 2 processes (which 1 use depends on use case).
i "hard" separation. they're separate processes , don't share resources or state. paradigm shift js devs think (at least me). example if had stateful module set state in in main process, , required module in renderer, state won't there. they're 2 entirely different instances of module. sharing state best in main process , either use 1 of methods described above share state between renderer processes.
here list of real life apps , some sample apps.
shawn rakowski said (in comments below): "it may rule put code dealing platform infrastructure code (i.e. creating windows, registering global shortcuts, etc) in main process , application specific code (what app doing) in renderer processes."
[my app's functionality it] parses files , renders info screen
there's lots of approaches can take in electron because fs
module (and node.js modules) available in renderer process.
if you're dealing 1 browser window instance , not doing cpu intensive parsing, run fs
related code in renderer process instance. that's simplest way.
if you're doing cpu intensive work on these files, don't want lock ui, means can't processing browser window renderer, , can't in main (this lock renderers!). electron-remote or create invisible browser window instance runs heavy lifting.
this article main , renderer processes talks these topics more in-depth (disclosure: wrote that).