Skip to content

Go live

Deploy to Cloudflare

The inputs a real deployment needs, what the deploy command does for you, and how to verify the source first.

On this page

Owner-controlled operations

A real deployment needs the inputs below in your environment. Keep credentials outside the repository and terminal output. rer deploy --dry-run lists every missing input and where to get it before a deployment is configured; after configuration it compiles the generated Worker and assets without contacting Cloudflare.

Inputs Source
CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_API_TOKEN Your Cloudflare account and scoped API token
LAMP_PAGE_HOST, LAMP_APP_HOST Distinct public and operator hostnames
LAMP_PAGE_NAME, LAMP_PAGE_TAGLINE, LAMP_PAGE_TIMEZONE, LAMP_ACCENT_COLOR Your page branding, IANA time zone and six-digit hex colour
SETUP_OPERATOR_EMAIL Your first owner email
MAIL_FROM_ADDRESS, MAIL_PROVIDER_API_KEY, MAIL_DKIM_SELECTOR Verified sender, provider API key and sender DNS configuration
SUBSCRIBER_TOKEN_SECRET, WEBHOOK_SIGNING_SECRET Privately generated random secrets of at least 32 characters; WEBHOOK_SIGNING_SECRET also seals Slack and Teams channel addresses (list a new one first and keep the old while rotating)

MAIL_PROVIDER selects resend (default) or sendgrid. rer deploy verifies the source, creates or reuses your Cloudflare resources, checks sender SPF, DKIM and DMARC, writes the generated wrangler.toml, applies migrations, initializes ownership, uploads secrets with the Worker and checks live readiness.

For native workers.dev hosting, set LAMP_HOSTING=workers-dev and optionally LAMP_RESOURCE_PREFIX to your explicit resource namespace. With the prefix <prefix> (lamp-<environment> when you leave it out; the environment is production unless you pass --environment) and your account's workers.dev subdomain <subdomain>, set LAMP_APP_HOST to <prefix>.<subdomain>.workers.dev and LAMP_PAGE_HOST to <prefix>-page.<subdomain>.workers.dev; other names are refused. Lamp deploys separate app and public Workers and preserves their host gates. See native workers.dev deployment for exact naming and remote verification for running the full verifier on a trusted SSH machine.

Stop Lamp with rer dev --stop, then rer export and rer import move a local installation; after an import run rer setup --owner-email you@example.com and rer dev. For a deployed installation, pnpm run export:cloudflare writes every D1 entity as JSON and every R2 object with its original bytes and content type, and pnpm run import:cloudflare restores an archive only into an empty deployment after applying migrations. See OPERATIONS.md for provider setup, private backups, owner migrations and recovery into a fresh destination.

Your own domain

Lamp’s Worker custom domains require the zones for LAMP_PAGE_HOST and LAMP_APP_HOST to be active in the Cloudflare account used for setup. The hostnames can use one zone or separate zones. If a registrar or DNS provider is elsewhere, add each domain to Cloudflare, review and import its existing DNS records, then point each registrar’s nameservers to the nameservers Cloudflare assigns and wait until each zone is active. Enter two distinct hostnames in your private deployment inputs and run rer deploy. Cloudflare creates the Worker DNS records and TLS certificates for those hostnames. DNS hosted outside Cloudflare is unsupported; see the domain steps in OPERATIONS.md and Cloudflare’s Workers custom-domain guide.

Verify the source

Run the local verifier with:

Shell
rer verify

The coverage gate fails if a CONTRACT.md clause lacks a meaningful tagged behavior test. The final tag identity and clean-clone verifier result are recorded externally once the source is frozen. See TESTING.md for verification journeys and HANDOVER.md for adoption and migration guidance.

Browser journeys use the pinned Playwright package. Install Chromium once in a fresh clone before running them:

Shell
pnpm exec playwright install chromium

This page is drawn from README.md in the repository. Edit it on GitHub.