run402 example
The agent buys its own backend.
One script starts with no project, no database and an empty wallet. It draws testnet money from a faucet, pays for a tier with it, provisions Postgres, applies a migration, deploys a site, and then fetches the result to prove the URL is really serving. No human touches anything after the first line.
node provision.mjs
- 8 steps
- $0.00 real money
- 0 humans in the loop
- exits non-zero unless the URL answers
What the script does
Each step is a run402 CLI call, echoed into the transcript before it runs, and each one has to succeed before the next is attempted. A step that fails ends the run, names itself, and leaves the exit code non-zero.
- 1cliFind the run402 command and record its version. Nothing is spent before this answers.
- 2allowanceCreate the local wallet that signs payments, if the machine does not already have one.
- 3fundsRead the on-chain balance and ask the faucet for testnet USDC only when it is too low. The faucet is rate limited, so asking on every run is how you break a working machine. Free
- 4tierSubscribe to the Prototype tier, paid with x402 from the wallet above. $0.10 in testnet USDC
- 5projectProvision a Postgres project, which is where the schema and the site are about to land.
- 6deployApply the migration, upload the page, publish the route, claim the subdomain, wait for the edge.
- 7schemaQuery the new database and confirm the migration left its row behind. A site can be live while a migration silently was not applied.
- 8reachableFetch the URL from outside the platform and insist on a 200 and the marker string this app plants. This is the only step that can turn the run into a success.
The run ends by printing the live URL and a receipt: the steps, their durations, and the version of the CLI that did the work. The receipt is what the form below accepts.
The reference run
Below is a real run of provision.mjs,
copied in exactly as it printed, with nothing reconstructed and nothing trimmed for
effect. It went from no project at all to a live URL in 29.4 seconds, paying for the
project out of the testnet faucet, with no human touching any step.
plan subdomain selfserve-demo-run.run402.com
plan project name selfserve-demo-run, tier prototype, cli npx -y run402@4.17.8
cli $ npx -y run402@4.17.8 --version
cli ok run402 4.17.8 in 1.8s
allowance $ npx -y run402@4.17.8 allowance status
allowance ok reusing 0xA22F..a1cA in 1.9s
funds $ npx -y run402@4.17.8 allowance balance
funds ok $0.55 already on Base Sepolia, faucet not needed, in 3.9s
tier $ npx -y run402@4.17.8 tier status
tier ok prototype lease already active, nothing to pay, in 4.1s
project $ npx -y run402@4.17.8 projects provision --tier prototype --name selfserve-demo-run
project ok prj_1786625626495_0032 in 4.4s
deploy app copied to C:\Users\volin\AppData\Local\Temp\run402-selfserve-qx7ROI
deploy this is the slow step, about a minute
deploy $ npx -y run402@4.17.8 up --yes --verify --quiet --project prj_1786625626495_0032
deploy ok release rel_1786625632986_948ff60d in 8.7s
schema $ npx -y run402@4.17.8 projects sql prj_1786625626495_0032 "select marker from provision_log limit 1"
schema ok provision_log holds "run402-self-serve-app" in 4.1s
reachable GET https://selfserve-demo-run.run402.com
reachable ok 200 with the marker after 1 attempt in 0.5s
done 8 steps in 29.4s
LIVE https://selfserve-demo-run.run402.com
created project prj_1786625626495_0032, subdomain selfserve-demo-run.run402.com
cleanup npx -y run402@4.17.8 projects delete prj_1786625626495_0032 --confirm
receipt paste this at https://selfserve.run402.com to record the run
{
"receipt": "run402-selfserve.v1",
"site_url": "https://selfserve-demo-run.run402.com",
"project_id": "prj_1786625626495_0032",
"release_id": "rel_1786625632986_948ff60d",
"cli_version": "4.17.8",
"url_source": "deploy",
"started_at": "2026-08-13T12:53:20.547Z",
"total_ms": 29446,
"steps": [
{ "name": "cli", "ms": 1848 },
{ "name": "allowance", "ms": 1853 },
{ "name": "funds", "ms": 3933 },
{ "name": "tier", "ms": 4054 },
{ "name": "project", "ms": 4430 },
{ "name": "deploy", "ms": 8686 },
{ "name": "schema", "ms": 4097 },
{ "name": "reachable", "ms": 544 }
]
}
Runs recorded here
Every entry is a project somebody provisioned with this script. Run it, then paste the receipt it printed. Recording a run needs an account, because a wall that anyone can write to anonymously is a wall that fills with things nobody ran.
Sign in, or create an account with any email and a password of six characters or more.
No runs recorded yet
The wall fills up one receipt at a time. Run the script and paste yours to be the first.
The wall did not load. Something broke on the server.
How this page is built
This page holds no project key and never calls api.run402.com. It fetches
/api/runs on its own origin, and a Node 22 function on the other side of that
path does the database work with the caller's own credential. The runs table is
published with a policy that lets anyone read it and lets you write only rows you own.
The page you are reading was deployed by the same command the script runs:
npx run402 up --yes --verify. The full source, every file, is in the README.