Steven's Knowledge

Electron

Engineering guide for Electron — process model, security, performance, packaging, auto-update, and native integration

Electron

Engineering knowledge for building production-grade desktop apps with Electron. Skips Chromium/Node basics in favor of what actually determines whether a desktop app ships safely and runs well: the process model, the security boundary between main and renderer, startup and memory cost, code signing/notarization, and reliable auto-update.

Topics

Process Architecture

Electron App
├── Main Process           Single Node.js process — app lifecycle, owns native
│   ├── App lifecycle      ready / window-all-closed / activate / before-quit
│   ├── Window management  BrowserWindow creation, state, multi-window
│   ├── Native surface     Menu / Tray / dialog / Notification / global shortcut
│   └── Privileged I/O     fs / child_process / DB / OS APIs (never in renderer)
├── Preload Script         Isolated bridge — runs before page, has limited Node
│   └── contextBridge      Exposes a narrow, typed API to the renderer
├── Renderer Process       One Chromium process per window — your UI
│   ├── UI framework       React / Vue / Svelte — same as web
│   └── ipcRenderer        Talks to main only through the preload contract
└── Utility Process        Optional sandboxed Node child for CPU/IO work
    └── MessagePort        Direct channel, keeps the main process responsive
StageFocusKey Outcome
Post-basicsMain vs renderer, BrowserWindow, loading a pageA window that renders your app
BridgePreload, contextBridge, typed IPCRenderer and main talk without leaking Node
SecuritycontextIsolation, sandbox, CSP, navigation guardsNo remote code can touch the OS
NativeMenus, tray, shortcuts, native modules, protocolsA real desktop app, not a hosted web page
PerformanceStartup, memory per window, V8 snapshotsFast launch, low idle footprint
DistributionCode signing, notarization, installersUsers can install without OS warnings
ProductionAuto-update, crash reporting, testing, CI/CDShip and keep shipping safely

Why focus on practice over syntax

Electron's docs cover the APIs well, but they cannot make the architectural decisions for you. What determines whether an Electron app is safe and pleasant to use is the security posture of the renderer, keeping the main process unblocked, a disciplined IPC contract, and a signed, auto-updating release pipeline. Get these wrong and the app either leaks the OS to untrusted content or frustrates users with jank and broken updates — these pages consolidate the lessons that usually come only from shipping one.

Electron is not the only option. Tauri (Rust + system WebView) produces far smaller binaries and a smaller attack surface; native toolkits win on footprint. Electron's advantage is a single bundled Chromium — pixel-identical rendering across OSes and full control of the runtime version. Choose it when consistency and web-stack reuse matter more than binary size.

On this page