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({
mode: 'directory',
}),
});
wrangler.jsonc
{
"main": "dist/_worker.js/index.js",
"name": "your-site-name",
"compatibility_date": "2026-01-21",
"compatibility_flags": [
"nodejs_compat",
"global_fetch_strictly_public"
],
"routes": [
{
"pattern": "example.com/*",
"zone_name": "example.com"
}
],
"assets": {
"binding": "ASSETS",
"directory": "./dist"
},
"observability": {
"enabled": true
}
}

Build and deploy:

Terminal window
npm run build
npx wrangler deploy

Mindful Auth requires the following environment variables to function correctly:

VariableRequiredDescription
INTERNAL_API_KEYYesYour tenant’s internal API key from Mindful Auth

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