Add the API key to Pages
In the Cloudflare Pages project, open Settings, then Environment variables, and add BETTERCMS_API_KEY for production and preview.
Cloudflare touches a BetterCMS site in two places. Cloudflare Pages hosts the frontend and rebuilds from a deploy hook when content publishes, and Cloudflare Turnstile protects form submissions, which is why the form components take a Turnstile site key. Both are configured on your Cloudflare account; BetterCMS holds neither set of credentials.
Steps one to three are hosting. Step four is forms, and it is the part people forget until a submission fails.
On Astro, loadForms returns the turnstileSiteKey alongside the forms, so you pass it straight into BcmsBlocks or BcmsForm.
In the Cloudflare Pages project, open Settings, then Environment variables, and add BETTERCMS_API_KEY for production and preview.
Cloudflare Pages deploy hooks live under Settings, then Builds and deployments. Create one against the branch you deploy from and copy the URL.
In the BetterCMS project, open Settings and set the revalidation webhook to the deploy hook URL. Publishing now triggers a Pages build.
Create a Turnstile widget in your Cloudflare dashboard and take the site key. Pass it to the form component and submissions are gated by it.
This is why the form endpoint needs no API key: Turnstile is what stands between it and a bot.
import { BcmsForm } from "@bettercms-ai/next/form";
export function ContactForm({ form }) {
return (
<BcmsForm
form={form}
turnstileSiteKey={process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY}
/>
);
} There is no BetterCMS package built for the Workers runtime. The adapters target Astro and Next.js, and Pages runs those the way it runs any framework.
The widget, the site key and the secret live in your Cloudflare account. BetterCMS reads a site key you give it and holds nothing else.
Media lives on the BetterCMS media transform endpoint. There is no path today that stores assets in your own R2 bucket.
BetterCMS calls the deploy hook and does not read the result. A failed Pages build is visible in Cloudflare and not in the CMS.
Yes. BetterCMS runs headless, so an Astro or Next.js frontend deploys to Cloudflare Pages and reads content over the Delivery API with a BETTERCMS_API_KEY environment variable.
Yes, for form submissions. The form endpoint is Turnstile gated rather than key gated, which is why a public page can post to it without shipping an API key. You create the widget in your own Cloudflare account and pass the site key to the form component.
There is no adapter written for the Workers runtime today. What works is Cloudflare Pages running an Astro or Next.js build, which is how most Cloudflare hosted BetterCMS sites are deployed.
A deploy hook rebuilds the site on publish, or a revalidate route updates one page in about a second.
A build hook rebuilds the site on publish. Three steps, no plugin, and one caveat about build minutes.
First party adapter: a bettercms() integration, typed loaders, draft preview, and components that render page blocks.
See BetterCMS running on your pages, not on a sample site.