adapter-cloudflare
Cloudflare Workers adapter for Catmint. Transforms Catmint build output into a Cloudflare Workers-compatible bundle deployable with wrangler.
Import
import cloudflare from '@catmint/adapter-cloudflare'
Signature
function cloudflareAdapter(options?: CloudflareAdapterOptions): CatmintAdapter
The default export is the cloudflareAdapter factory function.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
options | CloudflareAdapterOptions | No | Configuration for the Cloudflare Workers deployment. |
CloudflareAdapterOptions
| Property | Type | Default | Description |
|---|---|---|---|
routes | string[] | ['/*'] | Worker route patterns. |
compatibilityDate | string | Current date | Cloudflare Workers compatibility date. Defaults to today's date in YYYY-MM-DD format. |
Return Value
Returns a CatmintAdapter object with name: '@catmint/adapter-cloudflare'. When the adapt() method is called during build, it:
- Generates
worker.js— the Workers entry point - Generates
asset-manifest.json— maps URL paths to static files - Generates
wrangler.jsonc— Wrangler configuration with the specified compatibility date and routes - Copies client assets and pre-rendered pages to
public/ - Copies the server bundle into the output directory
Output is written to dist/cloudflare/.
Examples
// catmint.config.ts — defaults
import { defineConfig } from 'catmint/config'
import cloudflare from '@catmint/adapter-cloudflare'
export default defineConfig({
adapter: cloudflare(),
})
// With custom compatibility date and routes
import { defineConfig } from 'catmint/config'
import cloudflare from '@catmint/adapter-cloudflare'
export default defineConfig({
adapter: cloudflare({
compatibilityDate: '2026-01-01',
routes: ['example.com/*'],
}),
})
After building, deploy with:
npx wrangler deploy --config dist/cloudflare/wrangler.jsonc
