Vinext
Vite plugin that reimplements the Next.js API surface — deploy anywhere
Install / Use
/learn @cloudflare/VinextREADME
vinext
The Next.js API surface, reimplemented on Vite.
Read the announcement: How we rebuilt Next.js with AI in one week
🚧 Experimental — under heavy development. This project is an experiment in AI-driven software development. The vast majority of the code, tests, and documentation were written by AI (Claude Code). Humans direct architecture, priorities, and design decisions, but have not reviewed most of the code line-by-line. Treat this accordingly — there will be bugs, rough edges, and things that don't work. Use at your own risk.
Quick start
vinext includes an Agent Skill that handles migration for you. It works with Claude Code, OpenCode, Cursor, Codex, and dozens of other AI coding tools. Install it, open your Next.js project, and tell the AI to migrate:
npx skills add cloudflare/vinext
Then open your Next.js project in any supported tool and say:
migrate this project to vinext
The 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.
Or do it manually
npm install -D vinext vite @vitejs/plugin-react
If you're using the App Router, also install:
npm install -D @vitejs/plugin-rsc react-server-dom-webpack
Replace 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
vinext deploy # Build and deploy to Cloudflare Workers
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.
CLI reference
| 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 |
| vinext deploy | Build and deploy to Cloudflare Workers |
| 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 deploy options: --preview, --env <name>, --name <name>, --skip-build, --dry-run, --experimental-tpr.
vinext init options: --port <port> (default: 3001), --skip-check, --force.
Starting a new vinext project
Run npm create next-app@latest to create a new Next.js project, and then follow these instructions to migrate it to vinext.
In the future, we will have a proper npm create vinext new project workflow.
Migrating an existing Next.js project
vinext init automates the migration in one command:
npx vinext init
This will:
- Run
vinext checkto scan for compatibility issues - Install
vite,@vitejs/plugin-react, and App Router-only deps (@vitejs/plugin-rsc,react-server-dom-webpack) as devDependencies - Rename CJS config files (e.g.
postcss.config.js->.cjs) to avoid ESM conflicts - Add
"type": "module"topackage.json - Add
dev:vinextandbuild:vinextscripts topackage.json - Generate a minimal
vite.config.ts
The 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 dev # Still runs Next.js as before
Use --force to overwrite an existing vite.config.ts, or --skip-check to skip the compatibility report.
Why
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 is an experiment: can we reimplement the Next.js API surface on Vite, so that existing Next.js applications can run on a completely different toolchain? The answer, so far, is mostly yes — about 94% of the API surface works.
vinext works everywhere. It natively supports Cloudflare Workers (with vinext 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:
- OpenNext — adapts
next buildoutput 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. - Next.js self-hosting — Next.js can be deployed to any Node.js server, Docker container, or as a static export.
Design principles
- Deploy anywhere. Natively supports Cloudflare Workers, with other platforms available via Nitro. Native adapters for more platforms are planned.
- Pragmatic compatibility, not bug-for-bug parity. Targets 95%+ of real-world Next.js apps. Edge cases that depend on undocumented Vercel behavior are intentionally not supported.
- Latest Next.js only. Targets Next.js 16.x. No support for deprecated APIs from older versions.
- Incremental adoption. Drop in the plugin, fix what breaks, deploy.
FAQ
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 deployed anywhere: Cloudflare Workers is the first natively supported target, with other platforms available via Nitro. Native adapters for more platforms are planned.
Is this a fork of Next.js? No. vinext is an alternative implementation of the Next.js API surface built on Vite. It does import some Next.js types and utilities, but the core is written from scratch. The goal is not to create a competing framework or add features beyond what Next.js offers — it's an experiment in how far AI-driven development and Vite's toolchain can go in replicating an existing, well-defined API surface.
How is this different from OpenNext?
OpenNext adapts the output of a standard next build to run on various platforms. Because it builds on Next.js's own output, it inherits broad API coverage and has been well-tested for much longer. vinext takes a different approach: it reimplements the Next.js APIs on Vite from scratch, which means faster builds and smaller bundles, but less coverage of the long tail of Next.js features. If you need a mature, well-tested way to run Next.js outside Vercel, OpenNext is the safer choice. If you're interested in experimenting with a lighter toolchain and don't need every Next.js API, vinext might be worth a look.
Can I use this in production? You can, with caution. This is experimental software with known bugs. It works well enough for demos and exploration, but it hasn't been battle-tested with real production traffic.
Can I just self-host Next.js? Yes. Next.js supports self-hosting on Node.js servers, Docker containers, and static exports. If you're happy with the Next.js toolchain and just want to run it somewhere other than Vercel, self-hosting is the simplest path.
How are you verifying this works? The test suite has over 1,700 Vitest tests and 380 Playwright E2E tests. This includes tests ported directly from the Next.js test suite and OpenNext's Cloudflare conformance suite, covering routing, SSR, RSC, server actions, caching, metadata, middleware, streaming, and more. Vercel's App Router Playground also runs on vinext as an integration test. See the Tests section and `
