Skip to content

feat: add SSR deployment adapters for Cloudflare Workers, Vercel, and Deno#597

Draft
advl wants to merge 1 commit intofeat/ssr-adapter-typesfrom
worktree-feat-ssr-adapters
Draft

feat: add SSR deployment adapters for Cloudflare Workers, Vercel, and Deno#597
advl wants to merge 1 commit intofeat/ssr-adapter-typesfrom
worktree-feat-ssr-adapters

Conversation

@advl
Copy link
Copy Markdown
Contributor

@advl advl commented Apr 6, 2026

Done

Three new adapter packages that bridge @canonical/react-ssr renderers to platform-specific deployment targets. Depends on #596.

  • @canonical/ssr-adapter-denocreateHandler(config) for Deno.serve(), filesystem static assets, ~60 lines, 12 tests, 100% coverage
  • @canonical/ssr-adapter-cloudflarecreateFetchHandler(config) for Workers fetch(request, env, ctx), R2 static assets, Cache API with ctx.waitUntil, ~90 lines, 15 tests, 100% coverage
  • @canonical/ssr-adapter-vercelcreateNodeHandler(config) for serverless (Node.js, IncomingMessageRequest conversion) and createEdgeHandler(config) for Edge (Web Standard), Cache-Control headers, ~120 lines, 16 tests, 100% coverage

All adapters share types from @canonical/react-ssr/adapter (#596).

QA

For each adapter package (ssr-adapter-deno, ssr-adapter-cloudflare, ssr-adapter-vercel):

  • cd packages/react/<adapter> && bun run check:ts — passes
  • cd packages/react/<adapter> && bun run check:biome — exit 0
  • cd packages/react/<adapter> && bun run test:coverage — 100% coverage
  • cd packages/react/<adapter> && bun run build — clean tsc build

PR readiness check

  • PR should have one of the following labels:
    • Feature 🎁
  • PR title follows the Conventional Commits format.
  • The code follows the appropriate code standards
  • All packages define the required scripts in package.json:
    • All packages: check, check:fix, and test.
    • Packages with build steps: build to build the package for development or distribution, build:all to build all artifacts.
  • If this PR introduces a new package: first-time publish needed after merge (npm publish --access public from each adapter package directory).

… Deno

Three new packages that bridge @canonical/react-ssr renderers to
platform-specific deployment targets:

- @canonical/ssr-adapter-deno: Deno.serve() handler with filesystem
  static asset serving. Simplest adapter (~60 lines).

- @canonical/ssr-adapter-cloudflare: Workers fetch handler with R2
  static assets, Cloudflare Cache API for SSR caching,
  ctx.waitUntil for background cache writes.

- @canonical/ssr-adapter-vercel: Node.js serverless handler
  (renderToPipeableStream via IncomingMessage→Request conversion)
  and Edge handler (renderToReadableStream). Both with
  Cache-Control header support.

All adapters share the RendererFactory type from
@canonical/react-ssr/adapter and use the same route matching,
MIME detection, and cache control utilities.

43 tests across all three packages, 100% coverage each.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant