deployers/cloudflare/README.md
A Cloudflare Workers deployer for Mastra applications.
pnpm add @mastra/deployer-cloudflare
The Cloudflare deployer is used as part of the Mastra framework:
import { Mastra } from '@mastra/core/mastra';
import { CloudflareDeployer } from '@mastra/deployer-cloudflare';
const deployer = new CloudflareDeployer({
name: 'your-project-name',
routes: [
{
pattern: 'example.com/*',
zone_name: 'example.com',
custom_domain: true,
},
],
assets: {
directory: './assets/',
},
});
const mastra = new Mastra({
deployer,
// ... other Mastra configuration options
});
The CloudflareDeployer constructor accepts the same configuration options as wrangler.json. See the Wrangler configuration documentation for all available options.
Deprecated fields: If migrating from an earlier version, note that projectName, d1Databases, kvNamespaces, and workerNamespace are deprecated. Use the standard wrangler.json property names instead (name, d1_databases, kv_namespaces).
The deployer will automatically load environment variables from:
.env files in your project