What is the Client/Server model when using Electron (Atom Shell)?

Electron doesn't seem to use Node.js as a web server but merely as an environment to run background JavaScript code, this code can use node modules to access the system. At the same time Chromium provides a user interface for the app, it displays regular web pages that run usual sandboxed JavaScript. Both are being embedded by the Electron executable, the former directly (Node.js can be built as a static library), the latter via libchromiumcontent. In a way, Node.js is the controller part of the application whereas Chromium is the view.

Typically, the concept used for web pages here is that of single-page applications: a web page represents one application window and as such it stays around as long as this window is visible (often for the entire lifetime of the application). Whenever it needs to display something different it requests data from the background code running in Node.js, just like AJAX applications request data from the server. The page itself is not reloaded, usually JavaScript templating will be used to update contents.

There isn't really a server/client relationship here however, the communication can actually go both ways. Both sides can use the ipc module to send messages to each other (main process, renderer). These messages can have any arguments attached to them, these don't need to be encoded explicitly (typically this is implemented by using JSON internally to encode parameters, I didn't verify whether that's the case with Electron). Internally, that message passing is implemented via platform-specific IPC mechanisms, using libuv to be exact.


We implemented fully functional nodejs server & angular UI with sqlite3, sequelize ORM using

*. https://github.com/theallmightyjohnmanning/electron-express

Some of the Projects helped us lot:

  • Framework: https://github.com/angular-fullstack/generator-angular-fullstack Windows Packaging: electron-packager": "github:electron-userland/electron-packager"
  • Creating Shortcuts and Auto Update: "electron-squirrel-startup": "^1.0.0",
  • Creating Release Installer: "electron-winstaller": "^2.3.4",