Use vinext to create or migrate a Next.js application and deploy it to Cloudflare Workers.
Cloudflare recommends vinext ↗ as the default way to run Next.js applications on Cloudflare Workers. vinext gives you two starting points: scaffold a new Workers-ready app with create-vinext-app, or add vinext to an existing Next.js 16 app with a single non-destructive vinext init (your existing next dev keeps working). You do not need a Cloudflare-specific template either way.
Already on OpenNext? See other Next.js deployment paths.
Next.js ↗ is a React ↗ framework for building full-stack applications.
Next.js supports server-side rendering, client-side rendering, static generation, React Server Components, Server Actions, route handlers, and middleware.
vinext ↗ is a Vite plugin that reimplements the Next.js API surface. You can keep your existing app/, pages/, next.config.js, and public/ directories while using the Vite toolchain.
vinext is in beta. Before adopting it for an existing production application, run the compatibility check from your project directory and review the vinext compatibility dashboard ↗.
npx vinext checkyarn dlx vinext checkpnpx vinext checkvinext supports most commonly used Next.js features on Cloudflare Workers:
| Feature | vinext support | Notes |
|---|---|---|
| App Router | Supported | Includes layouts, route handlers, metadata, loading, error, and not-found routes. |
| Pages Router | Supported | Includes getStaticProps, getStaticPaths, and getServerSideProps. |
| React Server Components | Supported | Uses Vite's React Server Components support. |
| Server Actions | Supported | Works with forms and server mutations. |
| Server-side rendering | Supported | Includes streaming rendering. |
| Static generation and static export | Supported | Use output: "export" for static exports. |
| Incremental Static Regeneration (ISR) | Supported | Uses a stale-while-revalidate caching model so Workers can serve cached content while refreshing it in the background. Refer to asynchronous revalidation. |
| Middleware and proxy routes | Supported | Includes middleware.ts and proxy.ts. |
next/* imports |
Mostly supported | Review the compatibility dashboard for module-level details. |
| Cloudflare bindings | Supported | Use cloudflare:workers in server components, route handlers, and server actions. |
| Image optimization | Partially supported | Cloudflare image optimization is available at request time. |
For detailed compatibility results, refer to vinext compatibility ↗.
Most Next.js projects can start from the same workflow: open a Next.js app, check compatibility, add vinext, then deploy to Workers.
- Use Add vinext with an agent if you want an agent to inspect the project and apply the migration.
- Use Add vinext with the CLI if you want a direct, repeatable command-line setup.
- Use Create a Cloudflare-ready project if you want to scaffold a new project already configured for Workers.
Use the vinext Agent Skill when you want a coding agent to inspect your Next.js project, run compatibility checks, update configuration, and start the vinext development server.
-
Open your Next.js project.
Use an existing project, or create a project with your preferred Next.js setup flow.
-
Install the vinext Agent Skill.
npx skills add cloudflare/vinextyarn dlx skills add cloudflare/vinextpnpx skills add cloudflare/vinext -
Prompt your agent.
In your coding agent, run the following prompt:
migrate this project to vinextThe skill runs vinext compatibility checks, applies the migration, and flags issues that need manual attention.
-
Develop with vinext.
Start the vinext development server.
npm run dev:vinextyarn run dev:vinextpnpm run dev:vinext -
Build with vinext.
Build the production output with vinext.
npm run build:vinextyarn run build:vinextpnpm run build:vinext -
Deploy to Workers.
Deploy with the vinext Cloudflare deploy command.
npx @vinext/cloudflare deployyarn dlx @vinext/cloudflare deploypnpx @vinext/cloudflare deploy
Use vinext init when you want a direct command-line setup. The migration is non-destructive: your existing Next.js setup continues to work alongside vinext while you test the Cloudflare Workers deployment.
-
Open your Next.js project.
Use an existing project, or create a project with your preferred Next.js setup flow.
-
Check compatibility.
Run the vinext compatibility check from your Next.js project directory.
npx vinext checkyarn dlx vinext checkpnpx vinext checkReview any reported compatibility issues before continuing.
-
Initialize vinext.
Run the vinext initializer and choose Cloudflare Workers as the deployment target when prompted.
npx vinext inityarn dlx vinext initpnpx vinext initvinext initinstalls vinext and Vite dependencies, adds vinext scripts, generates the Vite configuration, and creates the Cloudflare Workers configuration. -
Develop with vinext.
Start the vinext development server.
npm run dev:vinextyarn run dev:vinextpnpm run dev:vinext -
Build with vinext.
Build the production output with vinext.
npm run build:vinextyarn run build:vinextpnpm run build:vinext -
Deploy to Workers.
Deploy with the vinext Cloudflare deploy command.
npx @vinext/cloudflare deployyarn dlx @vinext/cloudflare deploypnpx @vinext/cloudflare deploy
Use the create-cloudflare CLI (C3) when you want to scaffold a new Next.js project already configured for Cloudflare Workers.
-
Create a new project with C3.
npm create cloudflare@latest -- my-next-app --framework=nextyarn create cloudflare my-next-app --framework=nextpnpm create cloudflare@latest my-next-app --framework=nextCommand behavior
C3 creates a new Next.js project, configures vinext for Cloudflare Workers, installs the required dependencies, and offers to deploy the application.
-
Develop with vinext.
Change to your project directory and start the local development server.
npm run devyarn run devpnpm run dev -
Build your application.
Run the generated build script before deploying or testing a production build.
npm run buildyarn run buildpnpm run build -
Deploy your project.
Deploy your project to a
*.workers.devsubdomain or a custom domain.npm run deployyarn run deploypnpm run deploy
In vinext applications deployed to Workers, use cloudflare:workers to access bindings from server components, route handlers, and server actions. Define bindings in your Wrangler configuration, then generate types with wrangler types.
For example, you can import env from cloudflare:workers in server-side application code to access D1, R2, KV, Durable Objects, Workers AI, Queues, Vectorize, and other bindings.
vinext is the recommended path for Next.js applications on Cloudflare Workers, but other deployment paths remain documented:
| Path | Use when |
|---|---|
| OpenNext adapter | You maintain an existing OpenNext application that cannot yet migrate to vinext because of a compatibility gap. |
| Static Next.js on Pages | Your application is a static export and you specifically want to deploy it to Cloudflare Pages. |