Skip to main content
This guide turns an Electron app into a Bach setup file. You keep using your Electron tool to build the app; Bach takes the unpacked app folder it produces and makes the installer.

1. Build the unpacked app

Bach needs the app as a folder of files, not an installer made by your Electron tool.
This writes the app to dist/win-unpacked.
Start the .exe in that folder once, to check the app works before you package it.

2. Create bach.toml

Run this next to your package.json:
Bach reads package.json and fills in the name (productName, or the package name), the version, the author as publisher, the program name and the build folder. A result for an app called Notes looks like this (without the commented-out options):
bach.toml
Check two values, because they’re guesses:
  • executable must be the name of the .exe inside the folder.
  • source must be the folder you built in step 1.
If your project is a GitHub repository, bach init also turns on automatic updates and adds a release workflow. Read Automatic updates before you ship, or delete the [updates] section if you don’t want them.

3. Check and build

bach check lists every file that will be installed. Look through it for anything that shouldn’t ship. bach build writes dist/Notes-Setup-2.0.0.exe.
electron-builder also uses dist/ for its output. Bach puts its setup file in dist/ too, but only packages what’s inside files.source, so the two don’t mix. If your source is dist itself, change installer.output to another folder.

Add your icon

Bach doesn’t take the icon from your Electron config. Point it at your .ico file:
bach.toml
The icon appears on the setup file and in the install window. The icon of the installed app itself comes from your Electron build, as before.

Things that differ from electron-builder’s installer

  • Updates. electron-updater doesn’t know how to install a Bach setup file. If you use it, turn it off and use Bach’s updates instead.
  • Install location. Bach installs to %LOCALAPPDATA%\Programs\<name> by default. If your users already have the app from another installer, add a migration step so they don’t end up with two copies.
  • Links and file types. Register them with [[protocols]] and [[file_types]], not from your app on first start.

Keep the file list small

Electron apps can contain thousands of small files. Bach stores the list of files in the setup file and in the uninstaller, and bach check warns when that list gets large. Package your app code into an asar archive (both tools can do this) and leave out tests, documentation and source maps with files.exclude.

Next steps