Design a one-page site, pay 0.01 USDC via x402, get it live at yourslug.pages.dev on Cloudflare Pages. Fully automated — no account, no checkout, no dashboard.
Live: https://picopages.botty4541.workers.dev
- You design a page in the builder (template, headline, tagline, colors, email…).
- The publish button returns an x402 URL for
/api/site?…. - Pay it with any x402-compatible wallet (e.g.
awal x402 pay '<url>'). - The worker verifies the payment, settles 0.01 USDC to the fee recipient, uploads the rendered HTML to Cloudflare Pages via the assets API, and returns your live
https://<slug>.pages.devURL.
- Cloudflare Pages direct upload does not use sha256 file hashes. Asset keys are
blake3(base64(utf8(content)) + ext), hex-encoded and truncated to 32 chars (the formatwrangler pages deployproduces). - The worker uploads assets through the Pages assets API scoped by a per-project
upload JWT:
GET /pages/projects/{slug}/upload-token→check-missing→upload→upsert-hashes→ create a deployment with a multipartmanifest+branchform. A freshly minted JWT can be transiently rejected, so the worker retries with a refreshed token and treats check-missing failure as "upload anyway". - Text is base64-encoded from its UTF-8 bytes (
btoaalone throws on non-Latin-1 characters like ◆ in the portfolio template).
| Secret | Purpose |
|---|---|
CLOUDFLARE_API_TOKEN |
Pages project/deployment management + assets API |
CLOUDFLARE_ACCOUNT_ID |
Account scoping for all Pages API calls |
Plus the x402 config in src/config.ts (fee recipient, price, RPC).
npm install
npm run typecheck
npx wrangler dev # local dev
npx wrangler deploy # deploy worker| Route | Purpose |
|---|---|
/ |
Builder UI + service metadata (x402 payment-required on paid routes) |
/api/site?… |
Paid endpoint: verify → settle → deploy → return live URL |