One Engineer and AI Rebuild Next.js in a Week: Introducing vinext, a Faster, Smaller Vite-Based Framework for Cloudflare Workers
One engineer and an AI model rebuilt the most popular front-end framework, Next.js, from scratch in just one week. The result is vinext, a drop-in replacement built on Vite that deploys to Cloudflare Workers with a single command. Early benchmarks show it builds production apps up to 4.4 times faster and generates client bundles up to 57% smaller than Next.js. The entire project cost about $1,100 in AI tokens. The core issue with Next.js lies in deployment. While it offers an excellent developer experience, its build system is tightly coupled to Node.js and Turbopack, making it difficult to deploy efficiently on serverless platforms like Cloudflare, Netlify, or AWS Lambda. Tools like OpenNext attempt to bridge this gap by reverse-engineering Next.js output, but they’re fragile and require constant maintenance. Even with Next.js’s upcoming adapters API, developers still face limitations—especially during development, where the dev server runs only in Node.js and can’t access platform-specific features like Durable Objects or AI bindings. vinext solves this by reimagining the entire API surface of Next.js on top of Vite, a modern build tool used by frameworks like Astro, SvelteKit, and Remix. It’s not a wrapper or adapter—it’s a clean, independent implementation of routing, server rendering, React Server Components, server actions, caching, and middleware. Because Vite outputs standard ESM and supports the Vite Environment API, the resulting code runs natively on any platform, including Cloudflare Workers. The project began on February 13. By the end of that day, both the Pages and App Routers were rendering server-side content with middleware and streaming support. By day two, 10 out of 11 routes in the Next.js App Router Playground were working. By day three, the full deployment pipeline to Cloudflare Workers was functional. The remaining days focused on testing, edge case fixes, and expanding coverage to 94% of the Next.js 16 API surface. The benchmarks are promising. On a 33-route test app, vinext with Vite 8 and Rolldown completed builds in just 1.67 seconds—4.4 times faster than Next.js 16.1.6 with Turbopack. Client bundles were reduced to 72.9 KB (57% smaller) when using Rolldown. vinext is designed from the start for Cloudflare Workers, with a single command to build and deploy. It supports full client hydration, interactive components, and client-side navigation. It also includes a pluggable caching layer—by default using Cloudflare KV for Incremental Static Regeneration (ISR)—and can be extended to use R2 or other backends. What sets vinext apart is its use of AI. Nearly every line of code was generated by AI, but it was rigorously tested: over 1,700 Vitest unit tests and 380 Playwright end-to-end tests, including direct porting of tests from the Next.js and OpenNext suites. The project uses automated CI with linting, type checking via tsgo, and AI-powered code review agents. The human role was critical—not in writing code, but in setting direction, validating correctness, and managing the feedback loop. The project succeeded because several conditions aligned: Next.js is well-documented, has a massive test suite, and its API is deeply embedded in training data. Vite provides a solid, extensible foundation. And modern AI models can now handle large-scale, coherent code generation with high accuracy. vinext is still experimental and not yet battle-tested at scale. It doesn’t yet support static pre-rendering at build time, though it does support traffic-aware pre-rendering (TPR)—a novel feature that uses Cloudflare’s traffic analytics to pre-render only the pages that get the most visits, dramatically reducing build times for large sites. The broader implication is profound. This project shows that AI can now handle the complexity of building full-stack frameworks, reducing years of work to days. It raises questions about the future of software abstraction: if AI can write code directly from specifications, do we still need layers of frameworks and wrappers? vinext is open source and available at github.com/cloudflare/vinext. A migration skill is available to help users switch from Next.js with minimal effort. The project welcomes contributions and collaboration from other hosting providers.
