Can a Compiler-First Framework Scale to Real Apps Without Reinventing React?
A few weeks ago, I wrote about Kudzu , an open-source compiler-first web framework that lets you write familiar React-shaped TypeScript/TSX without shipping React, a VDOM, or hydration by default. The original idea is straightforward: write familiar TSX analyze components, state, events, lists, effects, and dependencies at build time emit complete HTML ship only the JavaScript capabilities a page…
A new open-source web framework called Kudzu has been developed, which allows developers to write TypeScript/TSX code with React-like components without including React, a virtual DOM, or hydration by default. The framework works by analyzing components, state, events, lists, effects, and dependencies at build time and emitting only the necessary JavaScript for the specific capabilities required by the page.
However, while static pages can be made extremely small through compilation, turning Kudzu into a serious application framework capable of building large, long-lived applications requires careful consideration. A real application typically involves shared state, async data loading, cache invalidation, optimistic mutations, complex forms, nested routing, authentication, realtime updates, large lists, virtualization, editors, charts, maps, and code splitting.
If Kudzu cannot handle these features well, it may end up being just a good static-site compiler with some interactivity, which is not the intended goal.
The goal is not to avoid client-side JavaScript entirely, but rather to use only the JavaScript that the framework specifically needs. For example, a dashboard may require shared state and navigation, while a chat application may need WebSocket connections and optimistic updates. An editor may need a substantial JavaScript library. The idea is to ship JavaScript only when it is actually used by the application.
There are two potential dangers in expanding compatibility with React ecosystems:
1. Rebuilding React underneath Kudzu, which would make the framework's original architecture irrelevant.
2. Adding endless compiler special cases for various third-party libraries, turning Kudzu's compiler into a catalog of package-specific syntax patterns.
The author prefers a different approach, which consists of three layers:
1. Application model
2. Small Kudzu application model
3. Compiler
This architecture focuses on a small set of powerful application capabilities that can be composed to build diverse applications. Kudzu should compile down to HTML and only the necessary runtime capabilities required by the application, rather than replicating the internals of third-party libraries. Some packages can run normally, while others can be adapted to fit Kudzu's boundary.
Regarding React compatibility, the long-term goal is to maximize React ecosystem source compatibility while minimizing React runtime compatibility. This means some React-shaped patterns can be compiled away, while others may need explicit support or be deemed unsupported.
Performance tests for Kudzu have shown promising results, with the framework effectively limiting the amount of JavaScript shipped to what is actually required by the application.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.