Cloudflare Variant
The ⓣ seeded GitHub template repo sketches an inactive Cloudflare Workers variant.
Variant files:
package.cf.jsonastro.config.cf.mjswrangler.cf.jsoncworker.cf.ts
These files swap the default Node adapter, SQLite, and local filesystem media for Cloudflare Worker, D1, R2, and compatibility bindings.
Treat this as a deployment sketch until the host project creates real D1/R2 resources and commits the target Worker files.
What Changes
Section titled “What Changes”| Local template | Cloudflare variant |
|---|---|
@astrojs/node adapter |
@astrojs/cloudflare adapter |
EmDash SQLite via better-sqlite3 |
EmDash D1 storage via @emdash-cms/cloudflare |
| Local media directory | R2 media binding named MEDIA |
| Node server entry | Worker entry exporting Astro handler plus PluginBridge |
astro.config.cf.mjs keeps the same EmDash actions provider and Mika native plugin entrypoint, but swaps database/storage config to D1/R2 bindings. wrangler.cf.jsonc declares DB, MEDIA, and a template-specific LOADER binding and uses nodejs_compat. Before activating the variant, verify the loader binding shape against the current Astro Cloudflare adapter, Cloudflare Workers, and EmDash Cloudflare integration docs.
Manual Trial
Section titled “Manual Trial”From ../emdash-mika-template, copy the variant files into the real filenames, then install and create the D1 database:
cp package.cf.json package.jsoncp astro.config.cf.mjs astro.config.mjscp wrangler.cf.jsonc wrangler.jsonccp worker.cf.ts src/worker.tsnpm installwrangler d1 create emdash-mika-templateReplace the placeholder "database_id": "local" in wrangler.jsonc with the D1 database ID before running npm run deploy.
The current worker.cf.ts sketch exports Astro’s Cloudflare handler and EmDash’s PluginBridge. It does not implement a Worker scheduled() handler, so a production Cloudflare host still needs to wire Cron Triggers to EmDash scheduled tasks if Mika maintenance should run on the edge.
Verify Or Roll Back
Section titled “Verify Or Roll Back”- Inspect
git diffafter copying the variant files. - Confirm D1 and R2 bindings exist before deploy.
- Confirm Mika maintenance still has a scheduler path if the host needs scheduled cleanup.
- Restore overwritten files from git if the variant is not the target deployment.
Next: Deployment Matrix compares the Node and Cloudflare responsibilities. Troubleshooting covers the overwrite recovery path.
External References
Section titled “External References”- Astro Cloudflare adapter for supported adapter configuration and Workers deployment behavior.
- Cloudflare Workers Astro guide for current Workers-specific setup notes.
- Cloudflare D1 for the serverless SQL database binding used by the variant sketch.
- Cloudflare Workers Node.js compatibility for
nodejs_compatbehavior.
Source Anchors
Section titled “Source Anchors”- ⓣ
../emdash-mika-template/README.md - ⓣ
../emdash-mika-template/package.cf.json - ⓣ
../emdash-mika-template/astro.config.cf.mjs - ⓣ
../emdash-mika-template/wrangler.cf.jsonc - ⓣ
../emdash-mika-template/worker.cf.ts