He initially spoke out about resumable applications at the 2019 Angular Ng-Conf. During that presentation, he gave two rules for what a framework should do to create applications that start instantly: only download and execute code that is strictly necessary to handle the user interaction, and don’t duplicate work that the server has already done.
It was from these ideals that Qwik was created. “Frameworks set the rules of the game, and developers have to follow them,” Hevery said in an interview with The New Stack. “Because current framework rules are hydration to make the site interactive, all complex sites are slow to start up. To get out of this trap, you need a framework with resumability rather than hydration.”
The Benefits of Server-Side Rendering
In January 2021 Qwik began development, starting as a project where Hevery was “mostly toying with how far I could push the idea of delaying the execution of code on the client.” He says the original syntax didn’t have the tooling and therefore left a lot to be desired. Still, learning on the job provided to be fruitful.
“When I joined Builder.io in June 2022,” he said, “it became a full-time effort, and I was joined by Adam Bradly and Manu Martinez-Almeida to work on it full-time. Turns out that between the three of us, we have a lot of experience building frameworks, so we had a clear idea of what we wanted Qwik to be.”
To give a better understanding of Qwik’s appeal, Hevery describes how it stands up against other frameworks. “Current frameworks only care about client rendering. SSR [server-side rendering] is really an afterthought. As a result, client hydration is the only way to make an application work, and hydration is expensive and results in slow application startups.”
For example, when you navigate to a product page on Amazon you will encounter numerous pieces of the site. The shopping cart, ratings, product details, menu, etc. all have to be loaded. But, as Hevery notes, “as a user, you don’t need all of those parts at once.”
Refined Lazy Loading
Qwik boasts “fine-grained’ lazy loading, which refers to the way Qwik breaks applications into smaller pieces and grants servers the freedom to decide what large bits of code should be sent to the client and when.
“With current frameworks, lazy-loading falls as the responsibility of the developer,” said Hevery. “In Qwik, the lazy-loading falls on the framework. Each callback (effect, listener, render function) is lazily loadable. This fine-grained nature, with the ability to render components independently, gives Qwik the power to not download code if the code is not strictly needed.”
Hevery said that Qwik is vastly different from Wiz at its core and in its implementation and syntax, but the goal is the same — applications that start instantly.
What’s Next for Qwik?
Qwik is currently available on Builder.io’s GitHub. Hevery adds that the project is getting close to general availability. “We are pretty confident in Qwik, but want to have a complete solution before declaring it so. For this reason, we are also working on Qwik City, a meta-framework for Qwik that allows us to build websites with file-based routing. Additionally, we are working on Qwikify React, which allows migration from Qwik sites and allows Qwik to use React ecosystem libraries, such as Material Components.”
Hevery says Qwik gives developers a new approach to building web apps. “Fine-grained lazy-loading and resumability results in instant-on applications and SEO solutions from the start,” he promised.