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.
Prerequisites
Section titled “Prerequisites”- A Cloudflare account
- Your application working locally with
acms dev - A production storage adapter configured in
acms.config.ts
Configuration
Section titled “Configuration”For a Cloudflare-native setup, use the Cloudflare KV adapter:
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.
Deployment Steps
Section titled “Deployment Steps”1. Push Content
Section titled “1. Push Content”acms push2. Set Environment Variables
Section titled “2. Set Environment Variables”In the Cloudflare Pages dashboard under Settings > Environment Variables, add:
CF_ACCOUNT_IDCF_KV_NAMESPACE_IDCF_API_TOKEN
3. Configure Build
Section titled “3. Configure Build”In the Cloudflare Pages dashboard or wrangler.toml:
[build]command = "npm run build"4. Deploy
Section titled “4. Deploy”Connect your Git repository in the Cloudflare Pages dashboard for automatic deployments, or deploy manually:
npx wrangler pages deploy distFramework-Specific Setup
Section titled “Framework-Specific Setup”Use @astrojs/cloudflare adapter:
import { defineConfig } from 'astro/config';import cloudflare from '@astrojs/cloudflare';
export default defineConfig({ output: 'server', adapter: cloudflare(),});SvelteKit
Section titled “SvelteKit”Use @sveltejs/adapter-cloudflare:
import adapter from '@sveltejs/adapter-cloudflare';
export default { kit: { adapter: adapter(), },};Next.js
Section titled “Next.js”Use @cloudflare/next-on-pages:
npx @cloudflare/next-on-pagesRuntime Strategy
Section titled “Runtime Strategy”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.
Next Steps
Section titled “Next Steps”- Learn about the Cloudflare KV adapter
- Explore the Hosted SaaS platform