Docs
Development
Architecture

Electron Architecture

Desktop App is a Electron wrapper around packages/frontend/core under packages/frontend/electron.

Purpose of Desktop App is to provide some new abilities in the future such as

  • Portable DB files

  • Multiple window support

  • Extensions

Communication between web (renderer) and main

Native capabilities in main/helper process are exposed to renderer window as individual APIs in the runtime. There are two types of the APIs, i.e., handlers & events, where handlers is to let the web to call functions in the native side, and events let the web to register native event listeners.

You can list all of them by inspecting apis object in dev tools console:

CXwi4LADwTEWu0HlNYmsjFydLx1Irk6EHHREeyDYgWU=

These APIs are typed and inferred from where they are declared/implemented:

EIoT0flMt7lhCJgXQN0D6vLvi9q0XBjRl_3GB5S3C8Q=

Multi-Process Model

In the native side, we introduced another helper process using Electron’s new UtilityProcess API to offload the blocking job (workspace, DB, dialog). We use async-call-rpc to handle bi-directional IPC calls.

OxF4uVHrWKBJn2XHWbRVuQ5Z1gUhgJjxJG-BOgb0Sqg=

References

Some diagrams (maybe outdated)