Repository navigation
Add Cloudflare Workers adapter - #199
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
trueadm
marked this pull request as ready for review
July 20, 2026 12:24
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@octanejs/adapter-cloudflarefor Cloudflare Workers with Workers Static Assets{ env, ctx }throughContext.platform, including same-origin server-function dispatchnodejs_compatimports, stream SSR responses, and guard generated Worker/chunk outputWhy
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/clientanddist/serverlayout and user-owned Wrangler configuration.Validation
node:bufferpnpm format:checkandgit diff --checkNote
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 withadapter: cloudflare()inoctane.config.ts. Vite and Rsbuild switch the server bundle to a Web Worker target and, after build, writedist/server/worker.js—a thin module Worker that lazy-initscreateWebWorkerHandler()with the embedded HTML template (and optional client asset map) while static files stay indist/clientfor Workers Static Assets.@octanejs/app-coregains adapterserverTarget: 'node' | 'webworker'validation, awebworkerserver-entry mode that exportscreateWebWorkerHandler({ htmlTemplate, clientAssets? })without Node boot/fs reads, and an optional second argument on the productionhandler(request, platform?).createContextonly setscontext.platformwhen a platform is passed; middleware,ServerRoutehandlers, 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 namedworker.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.