# Hosting 𝕏 Commerce for phone field tests Phones (and X’s in-app browser) need a real **https** URL. This app is a static folder: `index.html`, `l.html`, `s.html`, `sw.js`, `manifest.webmanifest`, `chainwatch.js`, `orderbox.js`, `xpub.js`, `noble-crypto.js`, `qrcode.js`, and `assets/`, plus two optional Cloudflare files, `_worker.js` and `_routes.json`, that draw per-listing and per-store 𝕏 preview cards. There is no server API, no database and no account. The ready-to-upload folder is `deploy/site/` (zip: `deploy/x-commerce-site.zip`). Rebuild it after any change with `bash deploy/build-site.sh [https://your-domain]`. **Do not put private keys, seeds, or backups in the hosted folder.** Only the public app files. ## Before you start 1. Copy the `x-commerce` folder (or this repo’s artifacts build) to your computer. 2. Confirm locally: open `index.html` via a simple static server if needed; field-test diagnostics should later show `https: pass` and `crypto.subtle: pass` on the phone URL. ## Option A β€” GitHub Pages (zero cost) 1. Create a GitHub account (if needed) and a **public** repository, e.g. `x-commerce`. 2. Upload the static files to the repo root (or a `/docs` folder). 3. Repo **Settings β†’ Pages β†’ Build and deployment**: Source **Deploy from a branch**, branch `main` (or `master`), folder `/ (root)` or `/docs`. 4. Wait a minute. Open `https://.github.io//` on your phone. 5. Custom domain (optional): Settings β†’ Pages β†’ Custom domain; follow GitHub’s DNS instructions. HTTPS is provisioned by GitHub. ## Option B β€” Cloudflare Pages (zero cost) 1. Sign in at Cloudflare β†’ **Workers & Pages β†’ Create β†’ Pages**. 2. Connect the GitHub repo, or use **Direct Upload** and drag the folder. 3. Build settings: framework **None**, build command empty, output directory `/` (or the folder that contains `index.html`). With Direct Upload, drag the **contents of `deploy/site/`** (or upload the zip). `_worker.js` and `_routes.json` must sit next to `index.html`. 4. Deploy. Open the `*.pages.dev` URL on your phone. 5. Custom domain: Pages project β†’ Custom domains β†’ add your domain (Cloudflare DNS). ## Option C β€” Netlify (zero cost) 1. Sign in at Netlify β†’ **Add new site β†’ Deploy manually** (drag the folder), or connect Git. 2. Publish directory = the folder with `index.html`. 3. Open the `*.netlify.app` URL on your phone. 4. Custom domain: Domain management β†’ Add domain. ## X link previews (og-card) The home page has brand Open Graph / Twitter tags (`assets/og-card.jpg`). **Per-listing cards (Cloudflare Pages only).** `#l=` links are invisible to 𝕏's crawler (the part after `#` is never sent to a server). On Cloudflare Pages, `_worker.js` (Pages "advanced mode", ~24 KB, works with Direct Upload and Git) answers only `/l` and `/l/*` (`_routes.json`; every other path is served as static files and never invokes it): - `GET /l?d=[&u=]` checks the seller's wallet signature (noble secp256k1, the same rules as the app), then returns a tiny page with `og:`/`twitter:` `summary_large_image` tags: title, Β€ price (or Sold / Reserved / Ended / Expired), a short description, and the listing's first **signed https photo URL**, else the brand card. A bad or missing signature gets the generic brand card. Everything is HTML-escaped; the page has a strict CSP. - People are forwarded to `/#l=…` with a meta refresh, a `location.replace` script and a visible "Open listing" button (works in 𝕏 in-app, Safari, Chrome, Firefox). - No KV, no D1, no storage, no logging of our own. Free plan: 100,000 worker requests/day; each card view and the app's one-per-session `HEAD /l` probe count. - The worker reads every listing link version the app makes, including **v8** (signed address list, 2026-10-28). Redeploy `_worker.js` together with `index.html`. With an older worker, a v8 link's preview card falls back to the generic one (the app itself still opens the link). - The app only makes `/l?d=` links after that probe confirms the worker; on GitHub Pages / Netlify it keeps making `#l=` links, and `l.html` (static) forwards any `/l.html?d=` link to `#l=`. Old `#l=` links always work. - 𝕏 caches cards (including failures) for a while; re-sharing the same link won't refresh it at once. - `GET /s?d=` does the same for a seller's storefront (DCSTORE1): signature check, store name/@handle/bio/listing count card, then `/#s=…`. `s.html` is the static fallback (`/s.html?d=` β†’ `#s=`). `_routes.json` includes `/l`, `/l/*`, `/s`, `/s/*`; responses carry `x-dc-cards: l s` so the app knows both card routes exist. - Check locally without deploying: `npx wrangler pages dev deploy/site --port 8788` (Node 22+), then `curl -s 'http://127.0.0.1:8788/l?d=' | grep og:`. **Approximate USD.** The browser fetches coin/USD itself from CoinGecko, then Kraken, then Coinbase (all keyless, CORS-enabled); nothing to configure on the host. The app itself does not call the X API. ## Installable app (PWA) `sw.js`, `manifest.webmanifest` and the icons in `assets/` are plain static files; every host above serves them. The service worker only registers over https. `deploy/_headers` (Cloudflare Pages) serves `sw.js` and the manifest `no-cache` so a redeploy is picked up on the next visit; on other hosts keep `sw.js` uncached if you can. `build-site.sh` stamps a build hash into `sw.js` so each deploy gets a fresh cache. Use `deploy/site/` as-is; don't upload the source `sw.js` with its `__BUILD__` placeholder. ## After hosting 1. On each phone, open the https URL in Safari (iOS) and Chrome (Android). 2. Also open the same URL from an X DM/post so it loads in X’s in-app browser. 3. Run **#fieldtest** β†’ Run diagnostics β†’ Copy report. 4. Complete seller onboarding on the seller phone; run the tiny test-sale script with 1–2 coins only. ## What we will not do for you This guide does not create accounts, deploy your site, or upload files. You stay in control of the host and the keys.