Skip to Content
interleavedocs

interleave.yml reference

Every field of the recipe that tells the cloud sandbox how to boot your repo.

interleave.yml lives in your repo's root. interleave init drafts it from your machine. Commit it so PR runs use the same recipe. It never holds secret values, only secret://NAME references.

Interleave validates the file strictly: an unknown key is an error, so a typo fails loudly instead of being ignored. Durations are strings like "500ms", "120s", "5m" or "1h". Quote versions ("16", not 16).

Editor autocomplete

The JSON Schema is published at /schema/interleave.schema.json on this site. Point your editor's YAML extension at it, or add a $schema line.

Example

The recipe init drafts for a Next.js app with Postgres and Redis:

interleave.yml
version: 1
runtimes:
  node: "20"
  pnpm: 10.34.7
services:
  postgres:
    version: "16"
    port: 5432
    db: acme
    user: acme
    password: acme
  redis:
    version: "7"
    port: 6379
apps:
  web:
    install: pnpm install --frozen-lockfile
    build: null
    start: pnpm run dev
    port: 3000
    role: ui
    health:
      path: /api/health
      timeout: 180s
setup:
  - pnpm exec prisma migrate deploy
  - run: pnpm run db:seed
    soft: true
env:
  DATABASE_URL: postgresql://acme:acme@localhost:5432/acme?schema=public
  REDIS_URL: redis://localhost:6379
  NEXTAUTH_URL: http://localhost:3000
  NEXTAUTH_SECRET: secret://generated/NEXTAUTH_SECRET
auth:
  strategy: credentials
  username: ada@acme.test
  password: secret://TEST_USER_PASSWORD
triggers:
  pull_request:
    enabled: true
    branches: [main]

Boot order

  1. The PR's commit is checked out and runtimes are installed.
  2. Each app's install runs.
  3. services start and are waited on until healthy.
  4. setup steps run in order, with env set.
  5. Each app's build (if set) and start run.
  6. The ui app's health check decides when the environment is ready.

After the first successful boot, Interleave snapshots the sandbox. PR runs restore the snapshot and only reinstall apps whose lockfiles or install commands the PR changed. Editing anything except triggers builds a new snapshot.

Top-level fields

FieldTypeDefault
$schemastringOptional schema URL for editors. Ignored by Interleave.
version1requiredRecipe format version. Always 1.
runtimesmap{}Language runtimes and tools.
servicesmap{}Databases and other sidecars.
appsmaprequiredThe processes that make up your app. At least one.
setuplist[]Commands run after services are healthy, before apps start.
envmap{}Environment variables for setup steps and apps.
integrationsmap{}Third-party tooling the sandbox runs for you.
authmap{strategy: none}The test user the browser agent signs in as.
sandboxmap{size: small}How big the cloud sandbox is.
databasemap{reset: per-case}Whether cases share data or each starts clean, and your own reset command.
triggersmapWhen runs start without a comment.

runtimes

A map of tool name to version, installed with mise inside the sandbox. Any tool mise knows works.

runtimes:
  node: "22.11"
  python: "3.12"
  pnpm: "9"

services

Native sidecars started before setup. Each engine appears at most once.

EngineFields
services.postgresversion, port, db, user, password
services.mysqlversion, port, db, user, password
services.mongodbversion, port, db, user, password
services.redisversion, port
services.mailpitversion, port
FieldType
versionstring, requiredEngine version, quoted: "16".
portinteger, requiredPort the service listens on inside the sandbox (1–65535).
dbstringDatabase to create.
userstringUser to create.
passwordstringThat user's password. These are sandbox-only credentials, so plain values are fine.

mailpit catches outgoing email, so flows like sign-up confirmation can be tested without sending real mail.

apps

A map of app name to app. Names are lowercase letters, digits, - and _, starting with a letter or digit. Exactly one app must have role: ui.

FieldTypeDefault
apps.<name>.cwdstring.Directory, relative to the repo root, the app's commands run in.
apps.<name>.installstring or nullInstall command, e.g. pnpm install --frozen-lockfile.
apps.<name>.buildstring or nullBuild command. null runs in dev mode, the way you run it locally. Set it to test production builds.
apps.<name>.startstring, requiredStart command.
apps.<name>.portintegerPort the app listens on. Required for ui and api apps.
apps.<name>.roleui, api, workeruiui is what the browser opens and gates readiness. api serves the UI. worker runs in the background and needs no port.
apps.<name>.healthmapHow Interleave knows the app is up.

health

FieldTypeDefault
health.pathstring/Path to request. Must start with /.
health.modehttp-any, http-2xx, tcphttp-anyhttp-any: any HTTP response counts. http-2xx: only 2xx. tcp: the port accepts connections.
health.timeoutduration120sHow long to wait before the boot fails.
health.hoststringHost header to send, for host-routed apps (for example Django's ALLOWED_HOSTS).

setup

Commands run in order after services are healthy and before apps start: migrations, seeds, fixtures. Each step is a string, or a map:

FieldTypeDefault
setup[].runstring, requiredThe command.
setup[].softbooleanfalseA failing soft step warns instead of failing the boot. Useful for optional seeds.
setup[].cwdstringrepo rootDirectory to run it in.
setup:
  - pnpm exec prisma migrate deploy
  - run: pnpm run db:seed
    soft: true
    cwd: apps/web

env

Environment variables for setup steps and apps. Names are letters, digits and _, not starting with a digit. A value is either a plain string or a secret reference:

ValueMeaning
postgresql://…Plain value, committed as is. Use it for local URLs and config that isn't secret.
secret://NAMERead from the project's encrypted vault at boot. Set it with interleave secrets set NAME.
secret://generated/NAMEA stable placeholder Interleave derives from the project, for values that only need to exist and stay the same, like session signing keys.

Any other string that starts with secret:// is rejected. See Secrets for how values are encrypted and what Interleave blocks.

integrations

integrations.stripe

FieldType
integrations.stripe.forward_webhooks_tostringPath on the ui app. The sandbox runs stripe listen --forward-to to it, so checkout flows get their webhooks. Needs a Stripe test key in the vault.
integrations:
  stripe:
    forward_webhooks_to: /api/webhooks/stripe

auth

The test user the browser agent signs in as. Without it (strategy: none), cases start signed out and can only test public pages, or sign up a new user each time.

auth:
  strategy: credentials
  username: ada@acme.test              # or secret://TEST_USER_EMAIL
  password: secret://TEST_USER_PASSWORD
  login_path: /login
  # start: signed-out                  # opt out: every case signs in itself
  sign_in:                             # only if the login form isn't found on its own
    username_selector: "#email"
    password_selector: "#password"
    submit_selector: button[type=submit]
    check_path: /dashboard
  sign_up:                             # only if the user should be created through your app
    path: /signup
FieldTypeDefault
auth.strategynone, credentialsnonecredentials gives the agent a test user.
auth.usernamestring or secret refrequired with credentialsThe test user's email or username.
auth.passwordstring or secret refrequired with credentialsTheir password. Keep it in the vault.
auth.login_pathstring/loginPath of the sign-in page.
auth.startsigned-in, signed-outsigned-inHow each case's browser starts.
auth.sign_inmapHints for the one sign-in per run. Every field is optional.
auth.sign_in.username_selectorCSS selectorThe username or email field.
auth.sign_in.password_selectorCSS selectorThe password field.
auth.sign_in.submit_selectorCSS selectorpress EnterThe submit button. By default Enter is pressed in the password field.
auth.sign_in.check_pathstringA signed-in page opened after signing in. The session counts only if it doesn't land back on the login page.
auth.sign_upmapCreate the test user through your app's sign-up page when signing in fails.
auth.sign_up.pathstring/signupThe sign-up page.
auth.sign_up.submit_selectorCSS selectorpress EnterThe sign-up form's submit button.

Use a dedicated test account, never a real person's.

Where the test user comes from

The sandbox starts from your migrations and seed, not your local database, so an account you made by hand locally won't be there. init looks for a test user in your seed scripts, bootstrap env vars (FIRST_SUPERUSER_*, TEST_USER_* and similar) and README. If there isn't one, add it in any of these ways:

  • During init: pick Sign up a new user through my app, or pass --test-user qa@interleave.test (with --login-path and --signup-path if yours differ).
  • On the dashboard: Projects → your repo → Environment → Test user.
  • In interleave.yml: an auth: block as above. It wins over the dashboard setting.

With sign-up, each sandbox signs the user up through your app's own sign-up page (filling email, password, confirm-password and name fields and ticking required checkboxes), then signs in. Interleave generates the password per project, so nobody needs to know it.

For an account that already exists, for example in a Clerk or Auth0 dev instance, choose an existing account instead (--signup-path none). The password goes into the vault: init seals it on your machine, or run interleave secrets set TEST_USER_PASSWORD and name that secret on the dashboard.

Sign-up through the UI doesn't work for apps that need email verification or an invite. Seed the user, or use an existing account.

Signed-in start

With a test user, cases start signed in (start: signed-in):

  • The runner signs the user in once per run through your real login form and saves the browser session (cookies and localStorage). With parallel case sandboxes it's once per sandbox.
  • Each case starts with that session and opens signed-in pages directly, with no login steps.
  • Cases about signing in start signed out and sign in themselves: cases tagged auth, cases that type the test user's password, and cases that open the login page.
  • If a signed-in case fails because the session expired, the runner signs in once more before the retry. If the sign-in itself fails, cases start signed out and the run log says why.
  • The case report shows how each case started, for example "Signed in as ada@acme.test" or "Signed out · tagged auth".
  • The session never leaves the sandbox. It's kept in a private file deleted at the end of the run, it isn't in snapshots or artifacts, and its values are redacted from evidence.

start: signed-out makes every case sign in itself, which is slower but tests the login form each time.

database

Every case of a run uses the same database, which your setup steps seed once. Left alone, a "create folder" case would leave a folder behind for the "rename folder" case after it, and the second case fails for a reason that has nothing to do with your change. Resetting the data between cases is the best way to avoid those false failures.

FieldTypeDefault
database.resetper-case | noneper-caseper-case resets the data before every case and retry. none lets cases see each other's rows.
database.commandstring or { run, cwd }Your own reset, run instead of the built-in one. Works with any database.

Postgres: nothing to set up

With a services.postgres entry, Interleave copies the data before the first case and puts it back before every case and every retry. The test user's session survives, because the copy is taken after the sign-in. Sequences go back too, so ids repeat from run to run. Triggers don't fire during the restore, so the database diff only shows what the app changed.

Any other database: database.command

For MySQL, MongoDB, SQLite, a hosted database or anything else, give Interleave a command that puts the data back. It runs before every case and every retry, except before the very first case.

database:
  command: pnpm db:reset

Add a cwd when the script lives in a subfolder:

database:
  command:
    run: make reset-db
    cwd: api

Some commands that already do this:

StackCommand
Prismapnpm exec prisma migrate reset --force --skip-generate (runs your seed)
Djangopython manage.py flush --no-input && python manage.py loaddata seed
Railsbin/rails db:reset
Drizzle, Knex or your own scriptspnpm run db:reset
SQLitea small script that deletes the rows over a connection, e.g. bun src/db/reset.ts (don't copy over the file: the app keeps it open)

What the command has to do:

  • Leave the test user in place. Reset to the seeded state, with the account Interleave signs in as. If the command removes it, Interleave signs in again after each reset (and signs up through auth.sign_up if you set it), but that costs a few seconds per case.
  • Run with the same environment as setup, including DATABASE_URL and your secrets, from the repo root or the cwd you give. It gets five minutes.
  • Be quick. It runs once per case. Truncating and reseeding a small dataset is ideal; a full migrate-from-scratch on a big schema is slow.
  • Be safe to run while the app is up. Dropping and recreating the database can break the app's open connections. Prefer truncating tables or restoring a copy over the app's own connection.

A failing command logs a warning and the case still runs, so a broken reset shows up in the run log rather than failing the whole run.

Opting out

database:
  reset: none

Use it if your app can't take its tables being emptied and refilled between cases, for example when it keeps long-lived state in memory that mirrors the database. A command together with reset: none is an error. Setting INTERLEAVE_DB_RESET=off in the sandbox env does the same for one run.

When nothing resets the data

Without a Postgres service and without a command, cases share whatever earlier ones leave behind. Every run says so in its log. Interleave also tells the case writer to create what each case needs and not to rely on another case having run, which helps but can't undo a counter or a list that grew. Redis, files on disk and other stores are only reset if your command does it.

sandbox

How much CPU and memory the cloud sandbox gets. It holds your app, its databases and a browser at once.

FieldTypeDefault
sandbox.sizesmall | largesmallsmall is 2 vCPU / 4 GiB. large is 4 vCPU / 8 GiB and costs about twice as much per sandbox-minute.
sandbox:
  size: large

interleave init writes size: large when the app used 2 GiB or more of memory on your machine, or when the repo runs three or more apps. Otherwise the block is left out. Change it by hand at any time, and init --keep-recipe keeps it.

Each finished run records the most CPU and memory its sandboxes used, and how much of the time the CPU was saturated (95% or more). If a small run shows memory near 4 GiB or the CPU saturated for most of the run, set size: large. Changing the size builds a new snapshot on the next run.

triggers

When runs start without a comment. Without this block, only @interleave test comments (and the CLI and Action) start runs. Comments always work, whatever triggers says.

triggers:
  pull_request:
    enabled: true
    branches: [main, "release/*"]
    paths: ["apps/web/**", "!**/*.md"]
    skip_drafts: true
    instructions: Focus on the checkout flow.

triggers.pull_request can also be true, shorthand for { enabled: true }.

FieldTypeDefault
triggers.pull_request.enabledbooleanfalseStart a run when a PR is opened, pushed to or marked ready for review.
triggers.pull_request.brancheslist of globsevery branchOnly PRs into these base branches.
triggers.pull_request.pathslist of globsevery changeOnly PRs that change a matching file. A leading ! excludes.
triggers.pull_request.skip_draftsbooleantrueDon't run draft PRs. They run once marked ready for review.
triggers.pull_request.instructionsstringWhat automatic runs focus on, like the text after @interleave test. Up to 4,000 characters.

Globs support * (within a path segment), ** (any number of directories) and ? (one character). Patterns apply in order, like GitHub Actions: a !pattern removes what earlier ones matched, and a list of only exclusions starts from every file.

Read from the base branch

Interleave reads triggers from the tip of the PR's base branch, never from the PR itself, so a PR can't turn automatic runs on for itself or change their instructions. Changing triggers never rebuilds the environment snapshot.

See GitHub for how automatic runs behave on new pushes and fork PRs.

On this page

Graph view