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

# Template Boxes

> Build your stack once, then fork it per user, per task, or per CI run.

When many boxes need the same stack pre-installed, build it once and fork it, instead of installing on every fresh box.

1. Create a box and install everything: runtimes, packages, your app or daemon.
2. Stop it: `box stop <template-id>`. Its snapshot is now your template.
3. For each new box: `box fork <template-id>`. Forks are usable in a few seconds, at roughly constant cost regardless of how much the template holds.

<CodeGroup>
  ```bash CLI theme={null}
  box new                          # install your stack, then:
  box stop bx_template
  box fork bx_template
  box fork bx_template --no-env    # fork for one of your own users
  ```

  ```bash curl theme={null}
  curl -sS -X POST "$BOX_API_BASE/boxes/bx_template/fork" \
    -H "Authorization: Bearer $BOX_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"noEnv":true,"env":{"TENANT_ID":"acme"}}'
  ```

  ```ts TypeScript theme={null}
  const forked = await box.fork({
    boxId: "bx_template",
    forkRequest: { noEnv: true, env: { TENANT_ID: "acme" } },
  });
  ```

  ```python Python theme={null}
  forked = box.fork("bx_template", ForkRequest(no_env=True, env={"TENANT_ID": "acme"}))
  ```
</CodeGroup>

Forks inherit the whole filesystem: files, installed packages, enabled systemd services, Docker named volumes. Hand-run processes are not forked; start them in the fork. A fork inherits the source's per-box `env` unless the fork request passes its own (`env` on fork is API and SDK only), and a fork of a no-env box is always no-env.

## Updating the template

Keep the template stopped. To publish a new version: resume it, update the stack, stop it again. Forks always take the latest snapshot.

## Warm the template for faster first boots

A box learns the read order of your startup and prefetches those files first on the next restore. Forks inherit what the template learned: before publishing, resume the template, run your app's normal boot once, then stop it.

## Related

* [Build a Platform on Box](/box/platform-guide)
* [Snapshots](/box/snapshots)
* [Secrets & Setup](/box/secrets)
