> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Bach builds Windows installers from one bach.toml with the bach command: bach init, bach check, bach preview, bach build. Installs are per user and need no administrator rights by default. installer.scope = "machine" installs for every user after one Windows prompt. On Windows, run setup files with Start-Process -Wait -PassThru in PowerShell, and give signtool arguments that start with the word sign.

# How bach.toml works

> Understand the config file behind every Bach installer: where it goes, how TOML sections work, which settings are required and how Bach checks them.

`bach.toml` is the one file that tells Bach how to build your installer. This page explains how it's laid out, where it goes and what happens when something in it is wrong. It's worth reading after your [first installer](/docs/quickstart.md).

## Where it goes

Put `bach.toml` in your project folder and keep it in version control with your code. All paths inside it are relative to the folder that holds `bach.toml`, not to the folder you run the command from.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
hello-notes/
  bach.toml        source = "build" means hello-notes/build
  build/
  assets/
    logo.svg       logo = "assets/logo.svg"
```

Run `bach` commands from that folder. To use a file somewhere else, pass its path: `bach build installer/bach.toml`.

## Let Bach write the first version

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach init
```

This writes a `bach.toml` with comments that explain the common options. In Rust, Tauri, Electron, .NET, Godot, Unity, Flutter, Wails, PyInstaller and Qt projects it fills in the name, version, program and build folder from your project files. It never overwrites an existing `bach.toml`.

## Sections and settings

The file uses [TOML](https://toml.io). You only need to know a few things:

* A line like `name = "Hello Notes"` is a **setting**.
* A line like `[app]` starts a **section**. The settings below it belong to that section.
* A line with double brackets, like `[[components]]`, starts one item of a list. You repeat the whole block for each item.
* Text goes in quotes. `true`, `false` and numbers don't.
* Anything after `#` is a comment.

In Windows paths, use single quotes so that backslashes are kept as they are: `'%APPDATA%\Hello Notes'`.

## The part every installer needs

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[app]
name = "Hello Notes"          # shown in the window, Start menu and Settings › Apps
version = "1.0.0"             # your app's version
publisher = "Your Name"       # you or your company
executable = "hello-notes.exe" # the program to start, inside the build folder

[files]
source = "build"              # the folder to package
```

These are the only required settings for a Windows installer. Without them, `bach check` tells you which one is missing.

## Everything else is optional

Bach has a default for each optional setting, so you only write what you want to change. For example, by default a desktop shortcut is offered and ticked. To not offer one at all:

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[installer]
desktop_shortcut = "never"
```

The main sections are:

| Section | What it controls | Guide |
| - | - | - |
| `[app]` | Name, version, publisher, program, icon | [reference](/docs/reference/config/app.md) |
| `[files]` | What goes into the installer | [Choose files](/docs/guides/choose-files.md) |
| `[installer]` | Location, shortcuts, look, output file | [Customize the window](/docs/guides/customize-the-window.md) |
| `[uninstall]` | What can be deleted on removal | [Uninstalling](/docs/guides/uninstall-and-user-data.md) |
| `[[components]]` | Optional parts of your app | [Choices and components](/docs/guides/choices-and-components.md) |
| `[updates]` | Automatic updates | [Updates](/docs/guides/updates.md) |
| `[[requirements]]` | Software that must be installed first | [Requirements](/docs/guides/requirements.md) |

The [configuration reference](/docs/reference/config/overview.md) lists every section and setting.

## The id: keep it stable

Bach recognizes an installed copy of your app by its **id**. If you don't set one, the id is the app's name. The id also names the install folder and a registry entry.

When you release a new version, keep the id the same. If it changes, the new setup file doesn't see the old installation and installs a second copy next to it. If you ever want to rename your app, set the old name as `id` first:

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[app]
id = "Hello Notes"            # stays the same forever
name = "Notes by Hello"       # free to change
version = "2.0.0"
publisher = "Your Name"
executable = "hello-notes.exe"
```

## Versions

Write versions as numbers with dots, such as `1.4.2`. A suffix such as `2.0.0-beta.1` is fine. Setup files compare versions to decide whether they're updating or downgrading. If the version isn't in this form, Bach warns you, because installed copies can no longer tell which version is newer.

Instead of editing the file for every release, you can pass the version when you build:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach build --app-version 1.4.2
```

A leading `v` is removed, so a Git tag such as `v1.4.2` works directly. [`bach version`](/docs/reference/cli/version) can also raise the version in `bach.toml` and your other project files at once.

## Mistakes are caught before building

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach check
```

`bach check` reads the file, checks every setting, looks at the build folder and lists what would be installed. If something is wrong, it stops with one sentence that names the setting. Unknown settings are errors too, so a typo like `excutable` is caught instead of silently ignored.

Some things aren't errors but are probably mistakes, such as debug files in the build folder. Those are printed as **warnings**. To make a build fail when there are warnings, for example in CI, add `--strict`.

## Editor help

The first line `bach init` writes points editors at a schema for `bach.toml`:

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
#:schema https://raw.githubusercontent.com/usebach/bach-installer/main/schema/bach.schema.json
```

With the Even Better TOML extension in VS Code, or any editor that understands this line, you get completion and descriptions as you type. See [Editor support](/docs/reference/setup/editor-support.md).

## The config version

`config_version = 1` says which format the file uses. It's optional today. If a future Bach changes the format, it can tell you instead of building something wrong.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.