Skip to content

feat: add deployment-cloudflare module #14

@ronak-create

Description

@ronak-create

Summary

Add Cloudflare Workers (via Wrangler) as a deployment target, generating a wrangler.toml, Worker entry point, and CI deploy workflow.

Why

Cloudflare Workers is the leading edge deployment platform and pairs naturally with:

  • Hono (backend-hono)
  • Remix (frontend-remix)
  • PlanetScale / Neon (serverless databases)

It’s the most-requested deployment target not currently in Foundation CLI.


Files to generate

  • wrangler.toml — Worker config (name, compatibility date, routes)
  • src/worker.ts — Worker entry point (export default { fetch })
  • .dev.vars.example — Cloudflare equivalent of .env.example for local dev
  • .github/workflows/deploy.yml — Wrangler GitHub Action for main branch deploys

Implementation hints

  • Key dependency (dev):

    • wrangler
  • When backend-hono is selected:

    • src/worker.ts should mount the Hono app directly (app.fetch)
    • implement via onAfterTemplate hook inspecting selectedModules
  • When backend-express is selected:

    • emit advisory warning (Express doesn’t run natively on Workers)
    • suggest Hono as an alternative (not a hard conflict)
  • package.json patches:

    • "deploy": "wrangler deploy"
    • "dev": "wrangler dev"
  • Conflicts with:

    • deployment-docker
    • deployment-vercel
    • deployment-render
    • deployment-aws

Contributor guidance

Refer to CONTRIBUTING.md → "Adding a New Module"


Acceptance criteria

  • foundation create lists Cloudflare Workers as a deployment option
  • wrangler.toml is valid and passes wrangler deploy --dry-run
  • Hono + Cloudflare generates a working Worker entry point
  • Advisory warning shown when Express + Cloudflare is selected
  • GitHub Actions workflow deploys on push to main
  • Snapshot tests for:
    • Hono + Cloudflare
    • Next.js + Cloudflare combinations

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: deploymentRelated to deployment platforms, CI/CD, infrastructure, or hosting setups.new-modulebuild something here

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions