Electron App Config Builder (secure defaults)

Fill in the app name, ID and window size and get a main.js, preload.js and package.json for Electron with context isolation, sandboxing and a Content-Security-Policy already switched on.

Use the tool

Why this tool exists

Most insecure Electron apps started from a tutorial that enabled nodeIntegration to make the first demo work. The safer settings are well known, but they are spread across the BrowserWindow options, the session headers, the navigation handlers and the preload script, so it is easy to forget one.

This builder gives you a starting point where context isolation and the sandbox are on, node integration is off, navigation and new windows are blocked, and the preload exposes only a narrow bridge. It also writes an electron-builder block for macOS, Windows and Linux. It is generated in your browser, so your app ID and URLs stay on your machine.

How to use it

  1. Enter the product name, app ID and the start file or URL.
  2. Set the window width and height, and tick single instance or hide menu if needed.
  3. Adjust the Content-Security-Policy and choose the build targets for macOS, Windows or Linux.
  4. Copy the three sections into main.js, preload.js and package.json, then run npm install.

Frequently asked questions

Is the generated app guaranteed to be secure?

No. It applies sensible defaults, but your own code can still add risks. Review the CSP against what your pages load, keep the preload bridge small and validate every IPC message in the main process.

Can I load a remote URL as the start page?

Yes. If the start value begins with http or https, the window loads that address, otherwise it loads the local file. Remote content deserves a strict CSP and careful navigation rules.

Which Electron versions does it assume?

The package.json pins recent major versions of electron and electron-builder as caret ranges. Update them to the versions you actually use and check the Electron release notes for breaking changes.