You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(platform): relocate deploy-target apps under platforms/
Move apps/{vercel,cloudflare} to platforms/{vercel,cloudflare} and
apps/site/vercel.json to platforms/vercel/vercel.json. Rebase all
relative path references across workflows, CODEOWNERS, docs, and
configs so tooling resolves from the new locations.
vercel.json now declares outputDirectory (../../apps/site/.next) so
Vercel can find the Next.js build when its Root Directory is set to
platforms/vercel, and uses build.env for NEXT_PUBLIC_DEPLOY_TARGET and
NODE_OPTIONS=--conditions=vercel instead of cross-env (which is not in
the --prod install tree).
Add NEXT_PUBLIC_DEPLOY_TARGET and NODE_OPTIONS=--conditions=cloudflare
to the Cloudflare deploy workflow's build and deploy step env blocks
so the outer opennextjs-cloudflare process resolves imports under the
cloudflare condition (matching the Playwright workflow).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/cloudflare-build-and-deployment.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,14 @@
2
2
3
3
The Node.js Website can be built using the [OpenNext Cloudflare adapter](https://opennext.js.org/cloudflare). Such build generates a [Cloudflare Worker](https://www.cloudflare.com/en-gb/developer-platform/products/workers/) that can be deployed on the [Cloudflare](https://www.cloudflare.com) network.
4
4
5
-
The build is gated on the `NEXT_PUBLIC_DEPLOY_TARGET=cloudflare` environment variable (set by the OpenNext `buildCommand`), which makes `apps/site` pull its Next.js, MDX, image-loader, and analytics overrides from [`@node-core/platform-cloudflare`](../apps/cloudflare). See the [Deploy Target Selection](./technologies.md#deploy-target-selection-next_public_deploy_target) section of the Technologies document for the full platform-adapter contract.
5
+
The build is gated on the `NEXT_PUBLIC_DEPLOY_TARGET=cloudflare` environment variable (set by the OpenNext `buildCommand`), which makes `apps/site` pull its Next.js, MDX, image-loader, and analytics overrides from [`@node-core/platform-cloudflare`](../platforms/cloudflare). See the [Deploy Target Selection](./technologies.md#deploy-target-selection-next_public_deploy_target) section of the Technologies document for the full platform-adapter contract.
6
6
7
7
## Configurations
8
8
9
-
All Cloudflare-specific configuration lives in the [`@node-core/platform-cloudflare`](../apps/cloudflare) package. The two key configuration files are:
9
+
All Cloudflare-specific configuration lives in the [`@node-core/platform-cloudflare`](../platforms/cloudflare) package. The two key configuration files are:
10
10
11
-
-[`apps/cloudflare/wrangler.jsonc`](../apps/cloudflare/wrangler.jsonc) — the Wrangler configuration
12
-
-[`apps/cloudflare/open-next.config.ts`](../apps/cloudflare/open-next.config.ts) — the OpenNext adapter configuration
11
+
-[`platforms/cloudflare/wrangler.jsonc`](../platforms/cloudflare/wrangler.jsonc) — the Wrangler configuration
12
+
-[`platforms/cloudflare/open-next.config.ts`](../platforms/cloudflare/open-next.config.ts) — the OpenNext adapter configuration
13
13
14
14
### Wrangler Configuration
15
15
@@ -19,7 +19,7 @@ For more details, refer to the [Wrangler documentation](https://developers.cloud
19
19
20
20
Key configurations include:
21
21
22
-
-`main`: Points to a custom worker entry point ([`apps/cloudflare/src/worker-entrypoint.ts`](../apps/cloudflare/src/worker-entrypoint.ts)) that wraps the OpenNext-generated worker (see [Custom Worker Entry Point](#custom-worker-entry-point) and [Sentry](#sentry) below).
22
+
-`main`: Points to a custom worker entry point ([`platforms/cloudflare/src/worker-entrypoint.ts`](../platforms/cloudflare/src/worker-entrypoint.ts)) that wraps the OpenNext-generated worker (see [Custom Worker Entry Point](#custom-worker-entry-point) and [Sentry](#sentry) below).
23
23
-`account_id`: Specifies the Cloudflare account ID. This is not required for local previews but is necessary for deployments. You can obtain an account ID for free by signing up at [dash.cloudflare.com](https://dash.cloudflare.com/login).
24
24
- This is currently set to `fb4a2d0f103c6ff38854ac69eb709272`, which is the ID of a Cloudflare account controlled by Node.js, and used for testing.
25
25
-`build`: Defines the build command to generate the Node.js filesystem polyfills required for the application to run on Cloudflare Workers. This uses the [`@flarelabs/wrangler-build-time-fs-assets-polyfilling`](https://github.com/flarelabs-net/wrangler-build-time-fs-assets-polyfilling) package.
@@ -54,15 +54,15 @@ Additionally, when deploying, an extra `CF_WORKERS_SCRIPTS_API_TOKEN` environmen
54
54
55
55
### Image loader
56
56
57
-
When deployed on the Cloudflare network a custom image loader is required. The Cloudflare platform config ([`apps/cloudflare/next.platform.config.mjs`](../apps/cloudflare/next.platform.config.mjs)) contributes it via the `images.loaderFile` field, which is merged into the shared Next.js config when `NEXT_PUBLIC_DEPLOY_TARGET=cloudflare` (the variable is set by the OpenNext `buildCommand` in [`open-next.config.ts`](../apps/cloudflare/open-next.config.ts)).
57
+
When deployed on the Cloudflare network a custom image loader is required. The Cloudflare platform config ([`platforms/cloudflare/next.platform.config.mjs`](../platforms/cloudflare/next.platform.config.mjs)) contributes it via the `images.loaderFile` field, which is merged into the shared Next.js config when `NEXT_PUBLIC_DEPLOY_TARGET=cloudflare` (the variable is set by the OpenNext `buildCommand` in [`open-next.config.ts`](../platforms/cloudflare/open-next.config.ts)).
58
58
59
-
The custom loader can be found at [`apps/cloudflare/src/image-loader.ts`](../apps/cloudflare/src/image-loader.ts).
59
+
The custom loader can be found at [`platforms/cloudflare/src/image-loader.ts`](../platforms/cloudflare/src/image-loader.ts).
60
60
61
61
For more details on this see: https://developers.cloudflare.com/images/transform-images/integrate-with-frameworks/#global-loader
62
62
63
63
### Custom Worker Entry Point
64
64
65
-
Instead of directly using the OpenNext-generated worker (`.open-next/worker.js`), the application uses a custom worker entry point at [`apps/cloudflare/src/worker-entrypoint.ts`](../apps/cloudflare/src/worker-entrypoint.ts). This allows customizing the worker's behavior before requests are handled (currently used to integrate [Sentry](#sentry) error monitoring).
65
+
Instead of directly using the OpenNext-generated worker (`.open-next/worker.js`), the application uses a custom worker entry point at [`platforms/cloudflare/src/worker-entrypoint.ts`](../platforms/cloudflare/src/worker-entrypoint.ts). This allows customizing the worker's behavior before requests are handled (currently used to integrate [Sentry](#sentry) error monitoring).
66
66
67
67
The custom entry point imports the OpenNext-generated handler from `.open-next/worker.js` and re-exports the `DOQueueHandler` Durable Object needed by the application.
Copy file name to clipboardExpand all lines: docs/technologies.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -302,25 +302,25 @@ Benefits:
302
302
303
303
`NEXT_PUBLIC_DEPLOY_TARGET` selects which platform adapter contributes its Next.js config, MDX flags, image loader, analytics, and Playwright webServer. It is consumed at build time by [`apps/site/next.config.mjs`](../apps/site/next.config.mjs), [`apps/site/mdx/plugins.mjs`](../apps/site/mdx/plugins.mjs), and [`apps/site/playwright.config.ts`](../apps/site/playwright.config.ts) via a dynamic import of `@node-core/platform-${target}/next.platform.config`.
|`cloudflare`|[`@node-core/platform-cloudflare`](../apps/cloudflare)| OpenNext `buildCommand` in [`open-next.config.ts`](../apps/cloudflare/open-next.config.ts)|
309
-
|_(unset)_| Falls back to the no-op defaults in [`apps/site/next.platform.config.mjs`](../apps/site/next.platform.config.mjs) and [`apps/site/playwright.platform.config.mjs`](../apps/site/playwright.platform.config.mjs)| Plain `pnpm dev` / `pnpm build` / `pnpm deploy`|
|`cloudflare`|[`@node-core/platform-cloudflare`](../platforms/cloudflare)| OpenNext `buildCommand` in [`open-next.config.ts`](../platforms/cloudflare/open-next.config.ts)|
309
+
|_(unset)_| Falls back to the no-op defaults in [`apps/site/next.platform.config.mjs`](../apps/site/next.platform.config.mjs) and [`apps/site/playwright.platform.config.mjs`](../apps/site/playwright.platform.config.mjs)| Plain `pnpm dev` / `pnpm build` / `pnpm deploy`|
310
310
311
-
Each adapter exports a default `{ nextConfig, aliases, images, mdx }` shape (any field optional). See [`apps/vercel/next.platform.config.mjs`](../apps/vercel/next.platform.config.mjs) and [`apps/cloudflare/next.platform.config.mjs`](../apps/cloudflare/next.platform.config.mjs) for reference.
311
+
Each adapter exports a default `{ nextConfig, aliases, images, mdx }` shape (any field optional). See [`platforms/vercel/next.platform.config.mjs`](../platforms/vercel/next.platform.config.mjs) and [`platforms/cloudflare/next.platform.config.mjs`](../platforms/cloudflare/next.platform.config.mjs) for reference.
312
312
313
313
#### Vercel Integration
314
314
315
315
- Automatic deployments for branches (ignoring automated branches)
0 commit comments