What Electron Does
- Main process — Node.js environment, OS APIs (filesystem, network, child processes)
- Renderer process — Chromium window, your web app
- IPC — bridge between main and renderer via
ipcMain/ipcRenderer - Native menus — Menu, MenuItem, Tray, dock icon
- Auto-updater — Squirrel-based updates
- Notifications — native OS notifications
- Power/clipboard/crash reporting — OS-level primitives
- Packaging — electron-builder / electron-forge
Architecture
One main process launches one or more BrowserWindows (renderers). Chromium renders HTML; Node.js runs in main (and optionally renderer via contextIsolation). IPC messages cross the boundary. Security rule: renderer is untrusted, always validate inputs.
Self-Hosting
Package locally then distribute:
npm run build
npx electron-builder --mac --win --linuxDistribute binaries via your site or auto-update server (like Nucleus, Hazel, or GitHub Releases).
Key Features
- Cross-platform (Win/Mac/Linux)
- Full Node.js in main process
- Native menus, tray, notifications
- Auto-updater
- Code signing support
- Crash reporter
- DevTools extensions
- MAS (Mac App Store) signing
- v28+ drops Node 18, uses ESM
Comparison
| Framework | Binary Size | Runtime | Language | Memory |
|---|---|---|---|---|
| Electron | ~150MB | Chromium + Node | JS | ~200MB idle |
| Tauri | ~3-10MB | OS WebView + Rust | Rust + JS | ~80MB idle |
| Neutralino | ~2MB | OS WebView | JS (no Node) | ~50MB |
| NW.js | ~150MB | Chromium + Node | JS | ~200MB |
| Wails | ~8MB | OS WebView + Go | Go + JS | ~80MB |
FAQ
Q: Why is the bundle so large? A: Chromium (~100MB) + Node.js (~30MB) are bundled into every app. This is the cost of cross-platform consistency.
Q: Any security concerns?
A: Enable contextIsolation, disable nodeIntegration, and expose a restricted API via preload. Never execute remote code.
Q: When should I pick Tauri instead? A: Pick Tauri when you want a small footprint, performance, and the Rust ecosystem; pick Electron when you need the full Node ecosystem or strict Chromium consistency.
Sources & Credits
- Docs: https://www.electronjs.org/docs
- GitHub: https://github.com/electron/electron
- License: MIT