Skip to content

Add Cloudflare Workers adapter - #199

Merged
trueadm merged 2 commits into
mainfrom
codex/cloudflare-adapter
Jul 20, 2026
Merged

trueadm merged 2 commits into
mainfrom
codex/cloudflare-adapter

Conversation

@trueadm

@trueadm trueadm commented Jul 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • add @octanejs/adapter-cloudflare for Cloudflare Workers with Workers Static Assets
  • add a Web Worker production target across app-core, Vite, and Rsbuild
  • forward request-scoped { env, ctx } through Context.platform, including same-origin server-function dispatch
  • preserve Cloudflare nodejs_compat imports, stream SSR responses, and guard generated Worker/chunk output
  • document Wrangler setup and update package inventory, MCP guidance, RuleSync output, and release metadata

Why

Octane's full-stack build currently has a Vercel deployment adapter but no supported Cloudflare output path. This adds a Worker-native deployment surface while retaining the existing dist/client and dist/server layout and user-owned Wrangler configuration.

Validation

  • affected Octane, app-core, Vite, Rsbuild, and adapter TypeScript checks
  • broad affected-package Vitest run: 223 tests passed
  • post-review portability run: 25 tests passed
  • Vite and Rsbuild production output executed in Workerd with SSR, route status, bindings, execution context, named dynamic imports, and application-level node:buffer
  • generated corpus, package inventory, RuleSync, changeset, and package-pack checks
  • adapter tarball inspection and Wrangler deploy dry-run
  • repository-wide pnpm format:check and git diff --check

Note

Medium Risk
Changes the shared production handler and server-entry codegen used by all adapters; risk is mitigated by optional platform (Node unchanged) and broad adapter tests, but SSR/RPC threading is easy to get wrong under concurrency.

Overview
Introduces @octanejs/adapter-cloudflare, configured with adapter: cloudflare() in octane.config.ts. Vite and Rsbuild switch the server bundle to a Web Worker target and, after build, write dist/server/worker.js—a thin module Worker that lazy-inits createWebWorkerHandler() with the embedded HTML template (and optional client asset map) while static files stay in dist/client for Workers Static Assets.

@octanejs/app-core gains adapter serverTarget: 'node' | 'webworker' validation, a webworker server-entry mode that exports createWebWorkerHandler({ htmlTemplate, clientAssets? }) without Node boot/fs reads, and an optional second argument on the production handler(request, platform?). createContext only sets context.platform when a platform is passed; middleware, ServerRoute handlers, and same-origin server-function / RPC dispatch see the same bindings per request.

The adapter ships Cloudflare runtime primitives (hash + async context via nodejs_compat), a browser/worker export facade, guards against overwriting an app chunk named worker.js, and Miniflare-backed Vite/Rsbuild production tests. Docs, package inventory, and agent rule sync mention the new adapter and Wrangler-oriented SSR setup.

Reviewed by Cursor Bugbot for commit 91d0c3b. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
octane-website Ready Ready Preview, Comment Jul 20, 2026 12:32pm
octane-website-mcp Ready Ready Preview, Comment Jul 20, 2026 12:32pm

Request Review

@trueadm
trueadm marked this pull request as ready for review July 20, 2026 12:24
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 20, 2026 12:31 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 20, 2026 12:32 Inactive
@trueadm
trueadm merged commit a88f9ea into main Jul 20, 2026
22 checks passed
@trueadm
trueadm deleted the codex/cloudflare-adapter branch July 20, 2026 12:41

This branch was previously deployed

2 inactive deployments
Preview – octane-website — 91d0c3b9 Deployed Jul 20, 2026 by vercel[bot]
Preview – octane-website-mcp — 91d0c3b9 Deployed Jul 20, 2026 by vercel[bot]
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