Stacks and previews
This is the practical side of Stacks: what to put in the manifest, what to give Botallion, and what you do in the app.
1. Write the manifest
Section titled “1. Write the manifest”Add botallion.stack.toml to your repo. This is a three-Worker stack with a database, a bucket, a service binding and a secret:
name = "ladder"previewNaming = "{stack}-{branch}-{resource}"productionNaming = "{stack}-{resource}"deployOrder = ["api", "jobs", "web"]kv = []
[[workers]]name = "api"entry = "demo/api/src/index.ts"compatibilityDate = "2026-10-02"
[[workers.secrets]]name = "RESULTS_SIGNING_KEY"
[workers.secrets.source]type = "cf-secrets-store"storeId = "<your store id>"secretName = "ladder-results-signing-key"previewSecretName = "ladder-results-signing-key-preview"
[[workers]]name = "jobs"entry = "demo/jobs/src/index.ts"crons = ["*/15 * * * *"]compatibilityDate = "2026-10-02"
[[workers]]name = "web"entry = "demo/web/src/index.ts"compatibilityDate = "2026-10-02"
[[d1]]binding = "DB"name = "ladder"migrationsDir = "demo/api/migrations"workers = ["api", "jobs"]
[[r2]]binding = "AVATARS"name = "avatars"workers = ["api"]
[[services]]worker = "web"binding = "API_SERVICE"service = "api"Resource names come from previewNaming and productionNaming. Names over 63 characters are cut and given a stable hash.
2. Keep secrets in your own Secrets Store
Section titled “2. Keep secrets in your own Secrets Store”A secret in the manifest is a reference, never a value: the Secrets Store it’s in, and its name for production and for previews. Botallion binds it to the Worker by name. It never reads the value, never lists your secrets and never stores them.
The upload fails if the named secret doesn’t exist, which is how a missing secret fails a deploy. Create it in your own account before you promote. Use a separate preview key so a preview never holds a production secret.
3. Connect Cloudflare
Section titled “3. Connect Cloudflare”In Settings, or from the prompt in a run, choose Connect Cloudflare and give Botallion a scoped API token for the account that should host your stack. The token is encrypted at rest, used only by the deployer and revocable in Settings.
Create the token with only what the deployer uses:
| Permission | Used for |
|---|---|
| Workers Scripts: Edit | Uploading and deleting Workers, crons, Custom Domains |
| D1: Edit | Creating, querying and deleting databases |
| Workers KV Storage: Edit | Namespaces |
| Workers R2 Storage: Edit | Buckets |
| Zone: Workers Routes, DNS and Zone read | Preview hostnames and production Custom Domains, on the zone they’re served from |
Don’t grant Secrets Store read or edit. Botallion binds secrets by name, so it doesn’t need to see or change them.
A deploy for an organisation with no Cloudflare connection stops straight away with “Connect Cloudflare in account settings first”.
4. Preview
Section titled “4. Preview”Once packages land, the stack deploys as a preview. The run view shows each Worker’s URL and the migrations applied. Previews are isolated, so you can load test data into one without touching another.
5. Promote
Section titled “5. Promote”When the preview succeeds, choose Promote in the run view. It deploys to the production names on your account and applies any pending migrations once. Promote again and nothing new is applied.
6. Previews clean up after themselves
Section titled “6. Previews clean up after themselves”When a branch lands, its preview is torn down: routes first, then Workers, then buckets and databases it created.