How Cloudflare Rebuilt Next.js in a Weekend

đ **Source:** [How Cloudflare Rebuilt Next.js in a Weekend](https://leaddev.com/ai/how-cloudflare-rebuilt-next-js-in-a-weekend)
[](https://leaddev.com/ai/how-cloudflare-rebuilt-next-js-in-a-weekend)[motivating engineers-07](https://leaddev.com/ai/how-cloudflare-rebuilt-next-js-in-a-weekend)
**Key takeaways:**
* **AI has made âstart from scratchâ a realistic option**. Cloudflare rebuilt Next.js in a matter of days for $1,100, producing something faster and purpose-built for their infrastructure.
* Agentic coding shifts engineers from writing code to directing it.
* **Not every team should rebuild everything, but every team should be asking the question**: the build-versus-buy equation has fundamentally changed.
Weâve come a long way from in-line AI code suggestions. Now, developers are using [AI-coding](https://leaddev.com/ai/best-ai-coding-assistants) agents to [reverse-engineer](https://blog.kowalczyk.info/article/88aee8f43620471aa9dbcad28368174c/how-i-reverse-engineered-notion-api.html) entire software components and even major frameworks.
The latest case comes from Cloudflare. In early 2026, an engineering director rebuilt Next.js, the popular React framework, [in a matter of days](https://blog.cloudflare.com/vinext/) using Claude in OpenCode.
âOne weekend, an engineering director decided to point AI at it to see how far he could get with purely agentic coding,â Dane Knecht, CTO of Cloudflare, tells LeadDev. âAfter the first weekend, it worked pretty well.â
The result, [vinext](https://github.com/cloudflare/vinext), cost just $1,100 in tokens to produce. Compared to Next.js, itâs far more custom-tailored to Cloudflareâs infrastructure, resulting in a smaller footprint and better performance.
This is more than a one-off stunt. The ability to replace components using AI presents a major shift for development processes, collaboration, and overall IT strategy.
Now, the idea of âstarting over from scratchâ is a far more realistic option. âThe costs are just so much lower and you can build purpose-built from day one,â Knecht says. âThis kind of reinvents the factory floor.â
Knecht frames reproducing open-source software components using agentic coding as the next evolution of âforkingâ â the practice of copying free-to-use open-source software packages and iterating on them in a new branch.
Forking is commonplace and pre-dates AI-assisted coding by decades. For example, as Knecht notes, the [Webkit](https://github.com/WebKit/WebKit) browser engine spawned numerous forks, such as [Blink](https://www.chromium.org/blink/), which powers Google Chrome. Forks exist for SQLite, Rust, and plenty of others.
âForking isnât bad,â and itâs ânothing new,â says Knecht. For him, the ability to take a technology in a different direction is an intrinsic quality of open-source software development. âIf you want total control, donât open source your software.â
Itâs not just frontend frameworks, either. Across the stack, forking is common practice. JavaScript itself expanded into runtime ecosystems like Node.js. MariaDB forked from MySQL. Ubuntu was forked from Debian, and so on.
Whatâs changed with the dawn of AI is the ease at which components can be replicated or replaced. âIn a lot of ways, it makes sense to kind of reduce those dependencies unless theyâre truly needed,â says Knecht.
For Cloudflare, Next.js was one of those components that never quite fit their platform. Originally designed by Vercel, it felt bespoke to Vercelâs needs, not Cloudflareâs.
This platform lock-in made it challenging when deploying to other environments. As Steve Faulkner [describes](https://blog.cloudflare.com/vinext/), âyou have to take that build output and reshape it into something the target platform can actually run.â
Cloudflare had previously attempted to patch Next.js using [OpenNext](https://opennext.js.org/) to better align with their infrastructure requirements. However, as Knecht explains, âwe never had great parity.â Performance was also lacking.
What they needed was a version of Next.js designed natively for Cloudflare, to take advantage of better performance and security, explains Knecht.
The end result, the vinext project, is technically a plugin for Vite, a frontend build tool, that reimplements the Next.js Application Programming Interface (API) surface. âA lot of credit goes to Vite,â says Knecht. âWeâre building on the shoulders of giants.â
By eliminating dependence on Next.js and building closer to Vite, vinext can build production apps up to four times faster and produces 57% smaller client bundles, a major improvement over the predecessor Next.js.
âOnce you cover that surface area for that customer, the results â from build times to page sizes â are just phenomenal,â says Knecht. Select customers are already using it, and larger ones are in the process of migrating.
Its pre-rendering capability is highly beneficial for latency-sensitive sites, he adds, noting the [developer experience](https://leaddev.com/reporting/metrics-measure-developer-experience) benefit as well. âPeople familiar with Vite tools have a great experience with it.â
The project has seen a community emerge around it too, with over 50 contributors and 8,000 GitHub stars at the time of writing. These collaborators are continuing to iterate vinext in an agentic way. âTheyâre not in there writing code by hand,â says Knecht. âTheyâre creating plans and specs for the AI and prompts and telling the AI to go off and do it.â
Vinext is an impressive case study of using [modern AI tools](https://leaddev.com/ai/your-ai-coding-tools-buying-checklist-for-2026) to make wholesale custom-tailored replacements of existing systems. It also highlights how AI is augmenting the practice of software engineering as a whole.
For instance, agentic coding unlocks a shift away from low-level code details toward more architectural decision-making, says Knecht. âItâs less making sure that theyâre tabbing or spacing, and more thinking through architecture and planning.â
Itâs also shifting the day-to-day. âHow does an engineer spend their day? The skillset will have to evolve. Communication skills and time management will become more important.â
In that future, software ownership is fundamentally different, too. For example, although vinext has received community enhancements, the original creator is still the primary maintainer, indicating whatâs possible for solo-creators these days.
âOver time, weâll have someone dedicated to it,â says Knecht. âRight now, weâre more interested in figuring out what autonomous agentic coding looks like.â
This potential has influenced Cloudflare to invest heavily in AI tooling across the company. Itâs also influencing Knecht to reconsider how to reassign work in an agentic era, thinking in terms of âjobs to be doneâ rather than finding an existing off-the-shelf solution for every problem.
âItâs a losing battle to be adversarial with AI,â he says. âWe donât make people still write in Assembly or punch cards anymore.â For him, AI is a tool, like an electric screwdriver, and should be used when appropriate.
LDX3 London 2026 agenda is live - See who is in the lineup
The move from human-led to autonomous-led coding feels inevitable. That said, the rise of AI doesnât mean all companies should redraw their core software components tomorrow.
Knecht admits that Cloudflare, widely considered the worldâs largest content delivery network, operates at a massive scale with highly specific needs. âOf course, there are a lot of people that wonât have those unique criteria and they should use more building blocks,â he says.
If teams move away from established projects en masse, thereâs also a risk of a more fragmented open source landscape with less oversight. âThe bigger projects have more eyes on them,â says Knecht. Smaller projects may be more prone to security issues going unnoticed.
Still, Knecht believes that agentic coding can open up innovation at large. âIf one of the forks has a new idea that is revolutionary and the main authors donât want it, then, over time, it will get those eyes,â he says. âI think, at the end of the day, this is really healthy for the inventor community.â
The act of repurposing software could even yield a positive outcome for the open source community, he adds. âItâs going to give new projects new life and increase the number of people involved.â
Some are sounding the [âSaaSpocalypseâ bell](https://www.forbes.com/sites/stevebanker/2026/03/26/rethinking-the-saas-apocalypse/) in the wake of AIâs ability to [rewrite software components](https://www.cio.com/article/4146669/is-ai-the-end-of-saas-as-we-know-it.html). Todayâs technical leaders are increasingly interested in how agents can [unlock new optimizations](https://leaddev.com/ai/squarespace-is-redrawing-the-boundaries-of-platform-engineering). In the process, agentic coding is reshaping the build-versus-buy equation.
Knecht anticipates engineers at Cloudflare and beyond will continue to experiment, finding additional off-the-shelf components to fork, mimic, or fine-tune using agentic coding. âI think there are some major open-source projects that might be 20+ years-old where itâs time to go back to the drawing board.â
While Cloudflareâs vinext project mimicked an API surface area, he expects more true code-based forks to emerge quickly., How Cloudflare Rebuilt Next.js in a Weekend, leaddev.com, 01kqmtz7gewx4j3n1zg89eqc14.