# Architecture

One Worker serves every host. `ROLE=auto` chooses from the hostname: `pay.shipw3.com` is checkout, `demo.shipw3.com` is the demo, and the apex is the showroom. A purchased store sets `ROLE=store` and `STORE_ID`.

Orders and the receipt queue live in D1. Product ZIPs are Static Assets under `public/releases/v1`. A cron trigger checks unpaid orders every minute and drains due receipts. The pay page also checks while it is open.

Receipts go out through the Resend free plan with the idempotency key `receipt/{orderId}`.