# Deploy record

## Production (Cloudflare Pages, free tier)

| What | Value |
|---|---|
| URL | https://wayreceipt.pages.dev |
| Cloudflare account | Foundry 500 venture account (id 3f1055c470d145b54c80ae3030b68a57) |
| Pages project | `wayreceipt`, production branch `main`, direct upload (no Git integration) |
| Pages config | `config/pages/wrangler.jsonc` (source of truth for bindings) |
| D1 database | `wayreceipt-log`, id `b948eb7a-9b2e-4b92-8a6e-bda2224eb7b0`, region WNAM, binding `DB` |
| D1 schema | `migrations/0001_init.sql`, applied remotely 2026-10-23 |
| Pages secrets | `RATE_SALT` (random, for the hourly rate-limit buckets; copy in `/workspace/venture/.secrets/wayreceipt_rate_salt`). `ADMIN_TOKEN` is not set, so `/admin/*` returns 404. |
| First deploy | 2026-10-23 |
| Plan | Free. No payment method on the account. |

The Worker runs as a Pages "advanced mode" `_worker.js` (same code as `worker/`, bundled by `build-site.js`).

## Redeploy

```
cd /workspace/venture/wayreceipt
export CLOUDFLARE_API_TOKEN="$(cat /workspace/venture/.secrets/cloudflare_api_token)"   # never print it
export CLOUDFLARE_ACCOUNT_ID=3f1055c470d145b54c80ae3030b68a57
npm test && node scripts/check-copy.js
SITE_ORIGIN=https://wayreceipt.pages.dev MCP_NAME=dev.pages.wayreceipt/wayreceipt \
  SERVER_JSON_OUT=server.pages-dev.json PAGES_BUILD=1 node scripts/build-site.js
(cd config/pages && npx wrangler pages deploy --branch main --commit-dirty=true)
```

New migration: add `migrations/000N_*.sql`, then `npx wrangler d1 migrations apply wayreceipt-log --remote` from the repo root.

Note: editing any file that goes into `/src/` (including this one) changes the tarball SHA-256, so rebuild before deploying.

## Live test entries

Entry 1 (receipt `urn:uuid:1c4d2aa9-23a7-4f5a-912e-e1b35fa947b1`, published 2026-10-23T19:35:14Z) is the QA smoke-test receipt, tombstoned by the QA seller key right after. Chain head after it: `bc3b790cad4815c8d7bc1a4361845a87b6d9e55d0514427c4976bfa7be719881`. Script: `qa/qa-log-live.mjs` (kept out of /src), output `qa/live-log-e2e.json`.

## How test entries work

The live smoke test publishes one receipt signed by the QA keys (`.demo-keys/qa-*.json`, listed in `config/internal-dids.json`, so `excluded: "ours"`) and then tombstones it with the seller's signature. Those entries stay in the hash chain as tombstones; `/stats` and the Toolsmith's counter skip them.
