Deployment¶
The Landing (swapps-campaigns) site deploys to Cloudflare Pages as a static,
prerendered site. vike build writes the HTML/CSS/JS into dist/client/, and Pages
serves the files directly. There is no Worker script and no Pages Function — this
keeps the deploy simple and the runtime JS minimal. Unknown paths fall through to
public/404.html automatically.
Project name
wrangler.toml declares name = "swapps-landing" and
pages_build_output_dir = "./dist/client". The GitHub repo is
swappsco/swapps-campaigns, and the platform DNS maps go.swapps.com to a Pages
project (*.pages.dev). Across the platform this app is referred to as
swapps-campaigns; use the exact project name shown in wrangler.toml for the
Pages dashboard.
Option A — direct upload (one-shot deploys)¶
cd swapps-landing
npm run deploy # = npm run build && wrangler pages deploy
wrangler pages deploy reads pages_build_output_dir from wrangler.toml, so no
path argument is needed. The first run prompts for the Pages project name.
Option B — git-based (continuous deploys, recommended)¶
Connect the swappsco/swapps-campaigns GitHub repo to Cloudflare Pages once (Pages
dashboard → "Connect to Git"). Configure:
| Setting | Value |
|---|---|
| Build command | npm run build |
| Build output directory | dist/client |
| Production env vars | BASE_URL, API_URL, RECAPTCHA_SITE_KEY, optional GTM_ID / GTAG_ID / LEADS_ENDPOINT |
Every push to main then redeploys; pull requests get a preview URL.
Pages does not read [vars] from wrangler.toml at build time
Cloudflare Pages does not inject [vars] from wrangler.toml into the build
environment (those are for Functions runtime, which this site doesn't use). Always
set the build env vars in the Pages dashboard → "Environment variables" →
"Production". The variable names and defaults are documented in
Getting Started → Environment variables.
Preview vs production¶
| Mode | How |
|---|---|
| Local preview (as Pages serves it) | npm run preview = npm run build && wrangler pages dev dist/client. |
| PR preview | Git-based deploys give every PR a Cloudflare Pages preview URL. |
| Production | Pushes to main (git-based) or npm run deploy (direct upload). |
Custom domain¶
Attach go.swapps.com once from the dashboard: Workers & Pages → swapps-landing →
Custom domains → "Set up a custom domain". This requires swapps.com to be on the
same Cloudflare account.
Secrets stay on swapps-worker
This site holds no server-side secrets. The reCAPTCHA secret, Pipedrive token and
sales-email config all live on swapps-worker, which the landing forms call via
/api/support/send. See
Architecture → Leads.