How we rebuilt Next.js with AI in one week

One engineer used AI to rebuild Next.js on Vite in a week. vinext builds up to 4x faster, produces 57% smaller bundles, and deploys to Cloudflare Workers with a single command.

blog.cloudflare.com

Almost every line of code in vinext was written by AI. But here's the thing that matters more: every line passes the same quality gates you'd expect from human-written code. The project has 1,700+ Vitest tests, 380 Playwright E2E tests, full TypeScript type checking via tsgo, and linting via oxlint. Continuous integration runs all of it on every pull request. Establishing a set of good guardrails is critical to making AI productive in a codebase.

The process started with a plan. I spent a couple of hours going back and forth with Claude in OpenCode to define the architecture: what to build, in what order, which abstractions to use. That plan became the north star.

Cloudflare 推出了一项名为 vinext 的实验性项目,旨在解决 Next.js 在非 Node.js 环境(如 Cloudflare Workers)中部署困难且笨重的问题。vinext 并非 Next.js 的包装器,而是基于 Vite 重新实现的 Next.js API 兼容层。该项目由一名工程师在 AI(Claude)的辅助下,仅用一周时间、花费约 1,100 美元 Token 成本完成。

vinext 实现了 Next.js 16 约 94% 的 API 覆盖率,包括 App Router、Pages Router、RSC(React Server Components)和 Server Actions。初步基准测试显示,vinext 的构建速度比 Next.js 快达 4.4 倍,客户端包体积缩小了 57%。此外,vinext 引入了创新的“流量感知预渲染”(TPR)技术,通过分析实际流量仅预渲染高频访问页面,解决了大规模站点构建缓慢的问题。目前该项目处于实验阶段,已在 CIO.gov 等生产环境中进行初步应用。