Deploying full-stack Next.js applications traditionally requires a Node.js runtime, often tying you to specific cloud platforms like Vercel or AWS. But what if you could deploy your app directly to the edge via Cloudflare Workers? Let's explore how to achieve this using Vinext.

Vinext provides an innovative architectural bridge, allowing us to bundle Next.js 16 (App Router) projects and deploy them onto Cloudflare's massive edge network. The result? Sub-millisecond cold starts, zero traditional server costs, and blazing-fast performance globally.
The Step-by-Step Deployment Guide
1. Create a Next.js 16 App
Start by bootstrapping a fresh Next.js project. It's crucial to select the App Router and avoid experimental extras for optimal compatibility.
npx create-next-app@latest my-app
cd my-app2. Install Vinext & Dependencies
Since Vinext leverages Vite's ecosystem under the hood to compile Next.js constructs into worker-compatible bundles, you'll need the appropriate plugins along with React 19.
npm install vinext
npm install -D @vitejs/plugin-rsc
npm install react@19.2.4 react-dom@19.2.4
npm install react-server-dom-webpack@19.2.43. Project Configuration
Update your `package.json` to treat files as ES Modules by adding "type": "module". Then, modify your standard Next scripts to run through Vinext:
"scripts": {
"dev": "vinext dev",
"build": "vinext build"
}(Note: Avoid using `vinext deploy` natively on Windows, we'll use Wrangler directly).
Crucial Considerations & Limitations
As detailed in the official Cloudflare engineering blog post, "How we rebuilt Next.js with AI in one week", Vinext is a lightweight, edge-first alternative, but it makes deliberate trade-offs.
Image Optimization
Vinext does not support Next.js build-time image optimization. Update your next.config.ts with images: { unoptimized: true } and use standard <img> tags, or rely on remote dynamic CDN optimization (like Cloudflare Images).
What is NOT Supported (By Design)
- Vercel-specific features:
@vercel/ogedge runtime, Vercel Analytics, and Vercel KV/Postgres bindings are excluded. Use Cloudflare equivalencies (like D1 or KV). - Native Node modules: Libraries like
sharporsatoriwill crash in the Vite RSC dev environment, requiring auto-stubbing or platform-specific edge modules. - Next.js
export: Legacynext exportcommands. - Webpack Configurations: Vinext uses Vite and Rollup under the hood. You must use Vite plugins instead of Webpack plugins.
Deploying via Wrangler
Build and Push
With Wrangler installed globally (npm install -g wrangler) and authenticated (wrangler login), executing the build is straightforward:
npx vinext build
wrangler deploy --config dist/server/wrangler.jsonCloudflare will provision a worker and respond with your `.workers.dev` URL instantly.
Attaching Custom Domains
If your DNS is managed via Cloudflare, mapping a custom domain is trivial. Add a Proxied CNAME connecting your subdomain to the `.workers.dev` URL. Then edit your wrangler.jsonc:
"routes": [
{
"pattern": "vinext.yourdomain.com",
"custom_domain": true
}
]Run wrangler deploy again, and Cloudflare will automatically handle SSL provisioning and routing.
Key Takeaways for Developers
For developer teams looking to deploy Lightning-fast POCs or production applications, Vinext proves that you can run Next.js App Router applications on Cloudflare Workers seamlessly.
While this paradigm drastically improves edge TTFB (Time To First Byte) and reduces bundle sizes via aggressive tree-shaking, it strictly restricts Node.js specific APIs. You cannot rely on Node-native modules like fs, net, or child_process. Embrace modern edge runtimes, utilize Cloudflare bindings, and enjoy a blazing-fast, serverless Next.js architecture!



