Skip to content

Deploy to Cloudflare Pages

ACMS works with Cloudflare Pages for static and SSR applications. Pair it with the Cloudflare KV adapter for a fully Cloudflare-native setup.

  • A Cloudflare account
  • Your application working locally with acms dev
  • A production storage adapter configured in acms.config.ts

For a Cloudflare-native setup, use the Cloudflare KV adapter:

acms.config.ts
import { defineConfig } from '@useacms/client';
import { localFile, cloudflareKV } from '@useacms/cli/adapters';
export default defineConfig({
dev: localFile({ path: './acms.json' }),
production: cloudflareKV({
accountId: process.env.CF_ACCOUNT_ID,
namespaceId: process.env.CF_KV_NAMESPACE_ID,
apiToken: process.env.CF_API_TOKEN,
}),
strategy: 'build-time',
});

You can also use any other adapter (GitHub Gist, GitHub, etc.) with Cloudflare Pages.

Terminal window
acms push

In the Cloudflare Pages dashboard under Settings > Environment Variables, add:

  • CF_ACCOUNT_ID
  • CF_KV_NAMESPACE_ID
  • CF_API_TOKEN

In the Cloudflare Pages dashboard or wrangler.toml:

[build]
command = "npm run build"

Connect your Git repository in the Cloudflare Pages dashboard for automatic deployments, or deploy manually:

Terminal window
npx wrangler pages deploy dist

Use @astrojs/cloudflare adapter:

astro.config.mjs
import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';
export default defineConfig({
output: 'server',
adapter: cloudflare(),
});

Use @sveltejs/adapter-cloudflare:

svelte.config.js
import adapter from '@sveltejs/adapter-cloudflare';
export default {
kit: {
adapter: adapter(),
},
};

Use @cloudflare/next-on-pages:

Terminal window
npx @cloudflare/next-on-pages

For dynamic content without rebuilds, use the runtime strategy:

export default defineConfig({
production: cloudflareKV({ /* ... */ }),
strategy: 'runtime',
});

Content updates are available after acms push without redeploying, with KV propagation typically completing within 60 seconds globally.