Vite plugin that reimplements the Next.js API surface — deploy anywhere
Vite plugin that reimplements the Next.js API surface — deploy anywhere
Run Next.js applications on Vite, with Cloudflare Workers as the primary deployment target.
Website: vinext.dev
Documentation:
Read the announcement: How we rebuilt Next.js with AI in one week
Under active development. vinext supports substantial Next.js applications today, but it is not yet a drop-in replacement for every application or production workload. Expect compatibility gaps, especially in newer App Router features, and evaluate it against your own application before adopting it.
vinext reimplements the Next.js API surface on Vite rather than consuming next build output. It supports both the App Router and Pages Router, React Server Components, Server Actions, middleware, route handlers, ISR, static export, and the most commonly used next/* modules. Cloudflare Workers has the deepest integration; Node.js and other platforms are available with different levels of support.
output: "export", and standalone Node.js outputnext/link, next/image, next/navigation, next/headers, next/cache, and the Metadata APIvinext check, vinext init, and the vinext Agent SkillThese are active compatibility areas, not permanent exclusions:
"use cache" is partially implemented, but full cacheComponents behavior is still incomplete. Cache profiles, tags, partial shells, resume behavior, prefetching, and some dev/build cache semantics do not yet match Next.js in every case.sharp, resvg, satori, lightningcss, and @napi-rs/canvas can fail in Vite's RSC development environment. Production builds support more of these cases than development mode.runtime and preferredRegion route config are currently ignored, and some recently introduced or undocumented Next.js behavior may not yet be reproduced.Run vinext check against an existing application before migrating. If a gap is not listed here, check the open issues or file a focused reproduction.
Use the official setup commands below. They are the recommended way to create or migrate a vinext project because they configure dependencies, scripts, Vite, and your deployment target for you.
Start a new project with create-vinext-app:
pnpm create vinext-app@latest my-appMigrate an existing Next.js project with vinext init:
npx vinext initPrefer vinext init for a direct, repeatable migration. If you want an AI agent to investigate compatibility issues and guide the migration, vinext also includes an optional Agent Skill. It works with Claude Code, OpenCode, Cursor, Codex, and dozens of other AI coding tools:
npx skills add cloudflare/vinextThen open your Next.js project in any supported tool and say:
migrate this project to vinextThe skill handles compatibility checking, dependency installation, config generation, and dev server startup. It knows what vinext supports and will flag anything that needs manual attention.
npm install vinext
npm install -D vite @vitejs/plugin-reactIf you're using the App Router, also install:
npm install react-server-dom-webpack
npm install -D @vitejs/plugin-rscReplace next with vinext in your scripts:
{
"scripts": {
"dev": "vinext dev",
"build": "vinext build",
"start": "vinext start"
}
}vinext dev # Development server with HMR
vinext build # Production build
npx @vinext/cloudflare deploy # Build and deploy to Cloudflare WorkersWith Vite+, use vpx @vinext/cloudflare deploy, or
vp exec vinext-cloudflare deploy when running the locally installed bin.
vinext auto-detects your app/ or pages/ directory, loads next.config.js, and configures Vite automatically. No vite.config.ts required for basic usage.
Your existing pages/, app/, next.config.js, and public/ directories work as-is. Run vinext check first to scan for known compatibility issues, or use vinext init to automate the full migration.
| Command | Description |
|---|---|
vinext dev |
Start dev server with HMR |
vinext build |
Production build (multi-environment for App Router: RSC + SSR + client) |
vinext start |
Start local production server for testing |
npx @vinext/cloudflare deploy |
Build and deploy to Cloudflare Workers |
vp exec vinext-cloudflare deploy |
Build and deploy to Cloudflare Workers with Vite+ |
vinext init |
Migrate a Next.js project to run under vinext |
vinext check |
Scan your Next.js app for compatibility issues before migrating |
vinext lint |
Delegate to eslint or oxlint |
Options: -p / --port <port>, -H / --hostname <host>, --turbopack (accepted, no-op).
@vinext/cloudflare deploy options: --preview, --env <name>, --name <name>, --skip-build, --dry-run, --experimental-tpr.
vinext init prompts for a deployment target, defaulting to Cloudflare. Agents must ask the
user which target they want, then pass --platform=cloudflare or --platform=node.
Other options: --port <port> (default: 3001), --skip-check, --force.
If your next.config.* sets output: "standalone", vinext build emits a self-hosting bundle at dist/standalone/. Start it with:
node dist/standalone/server.jsEnvironment variables: PORT (default 3000), HOST (default 0.0.0.0).
Note: Next.js standalone uses
HOSTNAMEfor the bind address, but vinext usesHOSTto avoid collision with the system-setHOSTNAMEvariable on Linux. Update your deployment config accordingly.
Use create-vinext-app for new projects. It creates a TypeScript App Router project
with Tailwind CSS and then runs the same vinext init setup used for existing apps:
pnpm create vinext-app@latest my-appThe generated project is Cloudflare Workers-ready by default. Pass
--platform=node if you want the Node target instead.
vinext init automates the migration in one command:
npx vinext initThis will:
vinext check to scan for compatibility issuespostcss.config.js -> .cjs) to avoid ESM conflicts"type": "module" to package.jsondev:vinext, build:vinext, and start:vinext scripts to package.jsonvite.config.tswrangler.jsoncThe migration is non-destructive -- your existing Next.js setup continues to work alongside vinext. It does not modify next.config, tsconfig.json, or any source files, and it does not remove Next.js dependencies.
vinext targets Vite 8, which defaults to Rolldown, Oxc, Lightning CSS, and a newer browser baseline. If you bring custom Vite config or plugins from an older setup, prefer oxc, optimizeDeps.rolldownOptions, and build.rolldownOptions over older esbuild and build.rollupOptions knobs, and override build.target if you still need older browsers. If a dependency breaks because of stricter CommonJS default import handling, fix the import or use legacy.inconsistentCjsInterop: true as a temporary escape hatch. See the Vite 8 migration guide.
npm run dev:vinext # Start the vinext dev server (port 3001)
npm run build:vinext # Build production output with vinext
npm run start:vinext # Start vinext production server
npm run dev # Still runs Next.js as beforeUse --platform=cloudflare or --platform=node to skip the platform prompt. Cloudflare init
updates an existing JavaScript or TypeScript Vite config using its AST, preserving unrelated
settings. Use --force to replace an existing Node-target Vite config, or --skip-check to skip
the compatibility report.
Vite has become the default build tool for modern web frameworks — fast HMR, a clean plugin API, native ESM, and a growing ecosystem. With @vitejs/plugin-rsc adding React Server Components support, it's now possible to build a full RSC framework on Vite.
vinext reimplements the Next.js API surface on Vite so existing Next.js applications can run on a different toolchain. The answer, so far, is that substantial applications can.
vinext works everywhere. It natively supports Cloudflare Workers (with npx @vinext/cloudflare deploy or vp exec vinext-cloudflare deploy, bindings, KV caching), and can be deployed to Vercel, Netlify, AWS, Deno Deploy, and more via the Nitro Vite plugin. Native support for additional platforms is planned.
Alternatives worth knowing about:
next build output for AWS, Cloudflare, and other platforms. OpenNext has been around much longer than vinext, is more mature, and covers more of the Next.js API surface because it builds on top of Next.js's own output rather than reimplementing it. If you want the safer, more proven option, start there.What is this?
vinext is a Vite plugin that reimplements the public Next.js API — routing, server rendering, next/* module imports, the CLI — so you can run Next.js applications on Vite instead of the Next.js compiler toolchain. It can be d
vite build silently skips static export when invoked through npm's `.bin/vite` entry on Linux
Dev: client optimizeDeps excludes serverExternalPackages, which breaks optional requires in client deps (linkedom → canvas)
Cache Components: support `unstable_ensureStatic = "navigation"`
Draft Mode: render unlisted closed dynamic routes when the bypass cookie is valid
Cache Components: await configured cache-adapter registration before first render
Cache adapters: support host-aware cache identity for multi-host Workers
next/image ignores images.loaderFile for remote src (renders unoptimized); per-component loader prop yields width=0
"use cache": serve stale entries while revalidating in background (Next.js #74882 / #92636)
App Router: `BrowserRoot` writes its router-state ref during render, so an aborted navigation's uncommitted payload seeds the next navigation
workersCacheCdnAdapter() removes the route's browser Cache-Control whenever Workers Cache is used