Every pull request gets its own machine running the branch’s exact code, live at a predictable *.boxd.sh URL that gets posted on the PR. Reviewers click it and land on a full Linux machine, so two reviewers can poke at two different PRs without stepping on each other’s writes. Close the PR and the machine is deleted.

Here GitHub Actions starts the preview. You can also skip GitHub Actions and run it on boxd, which is faster.

The whole thing is two small SDK scripts on top of one primitive: creating a machine from a snapshot.

How it works

You maintain a snapshot of your app: a machine with your app installed and running, re-saved on every push to main so it always reflects your latest code. That guide is the prerequisite for this page. On every PR, a script creates a machine from the latest snapshot, named for the PR:

Save a snapshot, then start a machine from it. Booted in 4ms.

The machine starts with the app already serving main’s code, since a snapshot captures memory and disk together. The script then checks out the PR branch inside it, rebuilds what the diff needs, and the preview is live at https://myapp-pr-482.boxd.sh. On new pushes the machine is recreated from the latest snapshot, and because the name is reused, the URL stays stable across the PR’s whole life. On close, one command removes it.

The scripts

Two small scripts cover the full lifecycle. The recommended way to run them is through the TypeScript or Python SDK, which reads a BOXD_API_KEY from the environment and handles authentication for you. Bring a preview up, or refresh it after a push:
preview-up.ts
Tear it down when the PR closes:
preview-down.ts
Swap the rebuild command (npm ci && sudo systemctl restart myapp) for whatever your stack needs. An API key from boxd auth keys create acts as you, so the preview is your private machine: with Git connected, the git fetch inside it works against private repos with nothing extra to configure. On a shared machine, git uses the GitHub App instead.

Wire it into CI

Store the key as a repo secret:
Then add one workflow. It brings the preview up on every push to the PR, comments the URL, and removes the machine when the PR closes:
.github/workflows/preview.yml
Any other CI works the same way: run the first script when a PR opens or gets a push, the second when it closes.

Or skip GitHub Actions

The fastest setup runs on boxd itself. An automation receives the pull request event through the boxd GitHub App and runs the same steps, so no runner has to start first and there is no API key to store.

Patterns

A stable URL per PR

The machine is named for the PR number, so each PR keeps https://myapp-pr-<n>.boxd.sh across every push. That makes it a steady target for screenshot diffs and Playwright runs, and reviewers keep refreshing the same link.
A preview asks for a bot protection check before it wakes, and with the On mode while it runs too. Reviewers pass it in their browser, but headless Playwright runs and other CI jobs may not. Turn it off for previews that automated jobs hit with boxd machine config set myapp-pr-482 bot-protection off.

Preview data without a staging database

Run a local database on the source machine before you snapshot it. Every preview then inherits a copy of that data, and writes stay inside that one preview. Reset comes free with the next recreate.

More than a URL

Each preview is a full machine you own. ssh myapp-pr-482.boxd gets you a shell in the exact environment the reviewer is looking at, and boxd machine exec lets other jobs run tests against it.

Previews sleep when not in use

The script sets a 5-minute auto-suspend and a 30-minute auto-hibernate, so an idle preview goes to standby and then hibernates. The next click on its link wakes it, and only that one.

Ten previews, all hibernated. Opening one wakes only that one.

FAQ

Very little, on two levels. The 5-minute auto-suspend puts an idle preview on standby, where it bills for memory and disk but no vCPU, and clicking the link resumes it in sub-millisecond time. The 30-minute auto-hibernate then moves it to disk, where it bills for disk only, and the next click wakes it in about 85ms. A PR sitting open over the weekend costs effectively nothing.
You get 5 machines, one per PR. The default cap is 50 machines per organization, extendable on request, and the source machine counts toward it too. Hibernated previews count as well.
The preview is created from the latest snapshot, which your refresh workflow re-saves on every push to main. The PR branch is then checked out on top, so the diff against main is exactly what the rebuild has to cover.
Recreating from the snapshot gives every push a clean, known starting state for the price of one boot, and the reused name keeps the URL stable. If your rebuild is expensive and pushes are frequent, reuse the machine and run the checkout step alone.