STK-103Default Open source
Use Electron for desktop apps built from web code
Build a Mac, Windows and Linux app from web code with Electron, on one of its three newest major versions.
Review by
2027-04-30
How to do it
The electron npm package has shipped stable versions since July 2016. Electron 45.0.0 came out on 21 October 2026, with about 5.0 million weekly downloads and an MIT licence. Its makers patch only the newest three major versions, which are 43, 44 and 45 today. A new major arrives about every 8 weeks, so plan the upgrade as Keep the bundled browser engine current says. Keep web content apart from the operating system, as Keep web content away from the operating system explains. Choose something else when download size or memory matters most. Tauri uses the system's own web view and makes far smaller apps. Tauri reached 1.0.0 in June 2022, so it fails the five-year test until June 2027. Record that choice in a decision record.
Examples
JavaScript example
import { app, BrowserWindow } from 'electron';
app.whenReady().then(() => {
const window = new BrowserWindow({ webPreferences: { contextIsolation: true, sandbox: true, nodeIntegration: false } });
window.loadFile('index.html');
});
How to check
The electron version in package.json has a major version among the newest three on the Electron releases page.
Sources
Related rules
- DSK-9 Keep the bundled browser engine current in Desktop apps and extensions
- DSK-10 Keep web content away from the operating system in Desktop apps and extensions
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/stack/mobile-and-desktop-apps/electron">Agent Wranglers software choices playbook</a>. In code you write, add a comment next to it with the same link.