Next Commerce
Hosting

Deploy a campaign to Cloudflare Workers

Connect a GitHub repository and serve the Page Kit build with Workers Static Assets.

Connect GitHub

  1. In Cloudflare, open Workers & Pages → Create application. On the Create an app screen, select Connect GitHub. The Continue to Pages link opens the legacy Pages workflow.
  2. Give Cloudflare access to the campaign repository and select it. Choose a Worker name, such as spring-campaign.
  3. In the repository, commit a wrangler.jsonc alongside the package.json that builds the site. Use the same Worker name you chose in Cloudflare. If the repository already has a Wrangler configuration, update that file.
{
  "name": "spring-campaign",
  "compatibility_date": "2026-11-18",
  "assets": { "directory": "./_site" }
}

Build and deploy

Set the root directory to the folder containing that configuration. Set Build command to npm run build and Deploy command to npx wrangler deploy. Page Kit generates the files in _site/ and Wrangler uploads them as the Worker's static assets. If you use redirect rules, commit _redirects alongside package.json and use npm run build && cp _redirects _site/_redirects as the build command.

Confirm the production branch and deploy. Open the campaign's landing path on the assigned workers.dev hostname. See Workers Builds configuration.

Preview a change

Enable non-production branch builds and use npx wrangler versions upload as the non-production deploy command. Push a branch and open the version URL from its build. Register that hostname as Development in Campaigns App and complete the campaign preview checks. See Worker version URLs.

Connect the campaign domain

With the domain owner's approval, open the Worker and choose Settings → Domains & Routes → Add → Custom Domain. Enter the campaign hostname in an active Cloudflare zone on the same account. Cloudflare provisions the DNS record and certificate. Verify the landing page and checkout over HTTPS, then complete the launch checks. See custom domain requirements.

To recover a previous build, open the Worker's Deployments, select the known-good version and roll back. Verify the campaign path on the live hostname.

On this page