Skip to content

Mindful Auth - Deploy Astro Template to Cloudflare Workers

This template is pre-configured for Cloudflare Workers deployment using the official Astro Cloudflare adapter.

Ensure your astro.config.mjs and wrangler.jsonc are set up as follows:

astro.config.mjs
import cloudflare from '@astrojs/cloudflare';
export default defineConfig({
output: 'server',
adapter: cloudflare(),
});
wrangler.jsonc
{
"name": "your-site-name",
"compatibility_date": "2026-03-09",
"compatibility_flags": [
"global_fetch_strictly_public"
],
"routes": [
{
"pattern": "app.example.com/*",
"zone_name": "example.com"
}
],
"assets": {
"binding": "ASSETS",
"directory": "./dist"
},
"observability": {
"enabled": true
}
}

Build and deploy:

Terminal window
npm run deploy

This runs astro build followed by npx wrangler deploy in one command. The Astro Cloudflare adapter automatically generates dist/server/wrangler.json during the build, which wrangler uses for deployment.

Mindful Auth requires the following environment variables to function correctly:

VariableRequiredDescription
MAUTH_SITE_KEYYesYour tenant’s site key from Mindful Auth

Cloudflare Workers: Use npx wrangler secret put MAUTH_SITE_KEY or add via dashboard