How to Deploy Your Next.js App on Cloudflare Workers using Vinext

Nitin and Dheeraj
By Nitin & Dheeraj

Mar 05, 2026

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 Cloudflare Deployment

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.

bash
npx create-next-app@latest my-app
cd my-app

2. 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.

bash
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.4

3. 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:

json
"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/og edge runtime, Vercel Analytics, and Vercel KV/Postgres bindings are excluded. Use Cloudflare equivalencies (like D1 or KV).
  • Native Node modules: Libraries like sharp or satori will crash in the Vite RSC dev environment, requiring auto-stubbing or platform-specific edge modules.
  • Next.js export: Legacy next export commands.
  • 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:

bash
npx vinext build
wrangler deploy --config dist/server/wrangler.json

Cloudflare 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:

json
"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!

Share this post :
Explore More
NextJSimage

Run a Next.js Project on Local Network Using WSL

Learn how to run your Next.js project on a local network using WSL 2: A step-by-step guide for developers

author

By PS

System Admin & Full Stack Developer

Date

Aug, 2024

AIimage

How We Built a Free, Multilingual AI Chat Widget using Next.js and Sarvam AI

Discover how mmtech.it.com leveraged Sarvam AI to build a free, multilingual AI-assisted website widget. Learn about the tech stack, implementation details...Read more

author

By PS

MM Tech Strategy Team

Date

Feb, 2026

Marketingimage

The Ultimate Guide to Digital Marketing Strategy in 2026

A comprehensive roadmap for creating a winning digital marketing strategy in 2026. Learn how to combine SEO, content, and automation for maximum business g...Read more

author

By PS

MM Tech Strategy Team

Date

Jan, 2026

MMTech Assistant

Powered by Sarvam AI • Supports 22 Indian languages

Hi! How can I help you with MMTech services today? Ask me in any language.