Introducing Waku: The Minimal React Framework

Waku is an ongoing project aimed at developing a React framework with first-class support for React Server Components. In this talk, I will provide an overview of Waku and walk you through how you can start developing a new project using Waku.

Rate this content
Bookmark
Video Summary and Transcription
Waku is a minimal React framework that focuses on providing a fast and efficient developer experience. It leverages React Server Components (RSC) to offer features like code splitting, routing, and data fetching, making it suitable for small to medium-sized projects. Waku integrates with VIT for hot reload and hot module replacement, ensuring a smooth development process. The framework is designed to be router-agnostic, focusing on stability and maintainability while allowing integration with client state management libraries like Jotai and Valisio. Developers can start a new Waku project using npm create-waku-at-latest and deploy their apps on platforms like Vercel, which handles both RSC and SSR. Waku is under active development, with version 0.20 supporting basic features and version 0.21 aiming to support server actions. For more information, developers can visit waku.gg or follow updates on GitHub. This video also discusses the use of Waku for React, highlighting its minimalist approach and the potential for ecosystem growth.

This talk has been presented at React Summit 2024, check out the latest edition of this React Conference.

FAQ

Rustand, Jotai, and Valisio are React state management libraries developed by Daishi Kato. Rustand is a minimal state management library, Jotai abstracts states as atoms, and Valisio enables a JavaScript object to be a React state using proxies.

The developer behind Waku is Daishi Kato, who specializes in developing React libraries, including Rustand, Jotai, and Valisio.

Key features of Waku include code splitting, routing, data fetching, generating HTML (SSR), and bundling for production. Waku also focuses on providing a fast developer experience and a minimal learning curve.

The motivation behind developing Waku is to leverage the capabilities of React Server Components (RSC) to build a React framework that offers a faster developer experience and minimal learning curve, targeting small to medium-sized projects.

You can deploy a Waku project on various cloud services like Vercel, Netlify, Cloudflare Workers, DenoDeploy, PartyKit, and AWS Lambda. For Vercel, simply run the Vercel command to build and deploy the project.

To learn more about Waku, you can visit the website waku.gg, where you can find basic information and tutorials. You can also follow Daishi Kato's activity on GitHub for more technical details and updates.

Waku uses React Server Components (RSC) for server-side rendering and supports async components for data fetching. It also employs hot reload for server components and hot module replacement for client modules to improve the development experience.

Waku is currently under active development, working towards V1 alpha. Basic features are already available, and the team is focused on enhancing library compatibility, adding new features, and improving stability.

Waku is a React framework that heavily depends on React Server Components (RSC) for design and implementation. It aims to provide capabilities like code splitting, routing, data fetching, and generating HTML, focusing on delivering a faster developer experience for small to medium-sized projects.

To start a new Waku project, run the command npm create-waku-at-latest. You will be asked for a project's name, and after that, move into the folder and run npm install. To start the development server, run npm run dev.

1. Introduction to Waku and React Libraries#

Short description:

I will talk about my recent project, Waku, and my React libraries - Rustand, Jotai, and Valisio. Rustand is the most popular, while Jotai and Valisio have room for more attraction. People often ask me why I develop three similar libraries, and it's because I find it interesting to compare them.

Hi. First of all, thanks for this great opportunity to give a talk. I will talk about my recent project, Waku. It's an active project, so please note that what I talk about today might not be accurate in the future, but at least it is what it is now.

Before we dive into the main topic, let me introduce myself. My name is Daishi Kato, and I specialize in developing React libraries. You might already be using or at least have tried one of my libraries. Most of them are for React global states. If you haven't tried them before, I think it's a great chance to give them a shot.

Rustand is a state management library that is bare minimum and easy to learn. It's such a small library that I actually wondered if it was worth being a library. Nevertheless, it's widely used now.

Jotai is another state management library. It abstracts states as atoms. Atoms are definitions of states. With atom abstraction, we can define state logic. It's very handy. And the ecosystem is growing, too.

The third one is called Valisio. It enables a normal JavaScript object to be a React state. Usually, React state has to be immutable. But a JavaScript object is mutable. To bridge the gap between immutability and mutability, Valisio uses proxies extensively. It works like magic. To compare the popularity of these libraries, let's quickly check the number of NPM downloads. As you can see, Rustand is by far the most popular library. Jotai and Valisio have room to get more attraction.

By the way, people sometimes ask me why I develop three similar libraries. It's a long story. But what I found interesting is that I can compare these similar libraries.

2. Waku: A React Framework#

Short description:

Waku is a React framework that depends heavily on React Server Components (RSC). It provides capabilities like code splitting, routing, data fetching, and SSR. The framework's job is to make these capabilities available to developers. Bundling with RSC and SSR can be tricky.

Not only can we compare the statistics, but we also get triple feedback. As you might expect, this results in triple the workload.

Well, that's enough for my introduction. Let's move on.

So, what is Waku? I started the project in March 2023. Waku is a React framework. It actually means framework in Japanese. Waku depends heavily on React Server Components, or RSC. Both in terms of the design and the implementation. Our current target is small to medium-sized projects. And we focus on delivering a faster developer experience.

Now, let's discuss a bit more in detail for each aspect. What exactly is a React framework? Honestly, I don't think I have the right answer to this question. But anyway, in the React docs they mention React should be used with a framework. And such a framework should provide capabilities like code splitting, routing, data fetching and generating HTML. Waku provides those capabilities. It supports code splitting. It does routing. We can fetch data. And generating HTML, also known as SSR, is supported. However, that doesn't mean we implement everything in a framework. The basic parts of those capabilities are already implemented by the React library. So, the framework's job is basically to make them available to developers.

Another big job of the framework is bundling. It's to generate the final output for production, which might vary depending on the cloud service used for deployment. I found bundling is tricky with RSC and SSR. To be honest, I don't think I fully understand every detail yet. Let's move on to the next topic, RSC. RSC. Waku is based on React components.

3. React Components and Waku's Goals#

Short description:

Waku uses React components based on RSC for capabilities like data fetching, code splitting, and routing. The biggest benefit is reusability, as RSC works with different frameworks. Waku provides a fast experience with VIT, hot reload, and hot module replacement. The API design aims to be simple and minimal for a better developer experience. Waku aims to be minimal for an easier learning curve.

And it was my motivation to start developing a framework.

So, what does React components provide? As I mentioned, Waku uses the React library for some capabilities. Those capabilities are based on RSC. One good example is data fetching. RSC supports async components and we can fetch data at the component level. RSC also enables code splitting and routing to some extent. All those capabilities are good. But the biggest benefit of RSC, I suppose, is reusability. RSC is defined by React, and if frameworks follow the React, the RSC convention, the difference between the frameworks is not noticeable to developers. That means, if a developer creates a component with RSC, it works with different RSC frameworks without modifications. So, when it comes to RSC, using Waku doesn't result in lock-in. I think interoperability between different React frameworks would be wonderful, and I hope such a future will come.

Another aspect is developer experience. One of Waku's goals is to provide a fast experience. To this end, Waku takes advantage from VIT. VIT's dev server allows us to avoid bundling everything at one time. It lazily compiles things as needed. Waku and VIT take care of hot reload or hot module replacement. So, if you edit files, the result will be shown without manual reloading. Currently, hot reload is for server components, and hot module replacement is for client modules. Waku also cares about the learning curve. Our API design aims to be simple and minimal, so that developers feel comfortable. I wouldn't say it has reached the goal yet. There's plenty of room for improvements, and we should keep working for a better developer experience.

Waku aims to be minimal. Why is it so? There are two major thoughts behind it. The first one is, as I just said, about the learning curve. Learning a small thing would be easier than learning something bigger. The API should be small, and so is the implementation. I notice early adopters read the Waku code.

4. Waku's Ecosystem and Future Development#

Short description:

Waku takes a minimalist approach and aims to grow the ecosystem. Currently under active development, Waku is working towards V1 alpha and exploring Waku-specific features. Version 0.20 has basic features for blog-like websites, while version 0.21 will support server actions for more interactive websites. Integration with client state management libraries like Jotai is being considered. Waku aims to be router-agnostic and focuses on stability and maintainability. Starting a new Waku project involves using the npm create-waku-at-latest command and providing a project name.

My belief is that the readability and understandability of the framework itself is important for wider adoption. The second one is about the ecosystem. We are a small team, and we can't implement all required features, so Waku takes a minimalist approach. We only provide a limited set of features, but make them extensible so that collaborators can build new features around the core features. Really, the goal is to grow the ecosystem.

Currently, Waku is under active development. We are working hard toward V1 alpha. At that point, we will have completed most RST features, and we will start exploring more on Waku-specific features. Version 0.20 already has basic features to build websites using a file-based router. It's well suited for blog-like websites. Version 0.21 will support server actions for more server-interactive websites. There still remain some issues with library compatibility that should be solved, and there are some more features requested for Waku. After those issues are resolved, I would like to explore a possibility to integrate a client state management library. My first target will be Jotai. Another trial would be developing an alternative router implementation that will support Waku-specific features to build websites. Another trial would be developing an alternative router implementation. That way, we can confirm that Waku is a router-agnostic framework. Of course, we will need to work on more stability. We may refactor for more maintainability, and to help grow the ecosystem. I hope to reach V1's table not too far in the future, but it requires help from the community, so any feedback and contributions are very welcome.

In the rest of the talk, I would like to walk you through how we can start a new Waku project. It is just to show how to use Waku. It's not about how Waku itself is implemented or how or what React Server Components are. If you are interested, please watch my previous talk, which I talked about the fundamentals of React Server Components. To create a new Waku project, run npm create-waku-at-latest. In addition to npm, we also support yarn and pnpm. After you run the create command, you will be asked for a project's name, which will be a folder name. The default value, Waku Projects, should work fine for the first time. After that, we move into the folder and run the npm install command. Then you are all set.

5. Developing and Building Waku Apps#

Short description:

To develop your app, start a dev server with npm run dev. Make modifications in the source folder and benefit from hot reloading. Understanding React Server Components is essential for Waku app development. After development, build the app with npm run build. The resulting build can be run in production mode with npm start. Waku also supports building static sites, which can be deployed to any hosting service. Static sites can still be interactive with client components. Waku supports deploying on Vercel.

To develop your app, you want to start a dev server. Just run npm run dev in the project folder. By default, it will listen on port 3000. So you open localhost 3000 in your browser and see the running app. You can then modify files in the source folder. Most file changes are detected and the browser will hot reload. In some cases, you may need a manual reload or restarting the server. Feel free to report to us if such cases occur.

Developing a Waku app requires a basic understanding of React Server Components. You can learn it on the Waku website, as well as the React website. When you are done with developing your project, it's time to build it. The command is npm run build. Take some time, but once it's finished, the result is in the dist folder under your project. By the way, the reason it takes time is that we run the build process four times. I believe this can be improved and we plan to work on it in the near future.

Now what can we do with the build result? You can run the build result in production mode. Simply run npm start command and it will listen on port 8080. If you open localhost 8080, you will see app running exactly as you saw in the development mode. If you have a server somewhere that you can run Node.js, it's possible to upload the project folder and run your app on the server. Waku also supports building static sites. If all of your server components are static, the build result is basically a static site. It's located in dist slash public folder. To test it locally, you can run npx serve dist slash public. It will serve files in the folder which you can open in your browser. You can deploy the dist public folder to any hosting service and publish it as a static site. To mark a server component as static, you need to configure it explicitly. It's done by exporting the getConfig function. Notice that static sites doesn't mean no interactivity. We can still make them interactive with client components. Waku supports deploying on Vercel out of the box.

6. Deploying Waku Apps and Conclusion#

Short description:

To deploy your Waku app on Vercel, simply run the Vercel command. The serverless function takes care of both RST and SSR. Waku also supports other cloud services, and a plugin system is in consideration for extended support. After this overview, visit waku.gg to learn the basics and start developing your small project. Stay tuned for more technical details and follow my activity on GitHub.

All you need is to run the Vercel command. This builds the project and deploys static files and the serverless function. The serverless function takes care of both RST and SSR. You can visit demo.waku.gg to see a demo app deployed on Vercel.

If your app is a static site, you can add the withVercel static option to your build command in package.json. And it will keep deploying a serverless function on Vercel. In addition to Vercel, Waku currently supports a variety of other cloud services to some extent, including Netlify, Cloud Fireworkers, DenoDeploy, PartyKit, and AWS Lambda. While we may add more options, I'm considering creating a plugin system to allow collaborators to extend support for additional cloud services easily.

As we approach the end of this talk, let's wrap up things. In this talk, I've explained the overview of Waku and how to get started with it. I hope this encourages you to give it a try. The first thing you want to do is visit waku.gg and learn some basic Waku basics. Once you are familiar with fundamentals, you can start developing a small project. I hope you will find it enjoyable. Given the scope of this talk, I have not explained the technical details of Waku. I plan to share them at some point, but meanwhile, you can follow my activity on GitHub. That's it. Thanks for your attention. I hope you enjoyed it.

Daishi Kato
Daishi Kato
19 min
18 Jun, 2024

Comments

Sign in or register to post your comment.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Simplifying Server Components
React Advanced 2023React Advanced 2023
27 min
Simplifying Server Components
Top Content
Watch video: Simplifying Server Components
React server components simplify server-side rendering and provide a mental model of components as pure functions. Using React as a library for server components allows for building a basic RSC server and connecting it to an SSR server. RSC responses are serialized virtual DOM that offload code from the client and handle interactivity. The client manifest maps serialized placeholders to real components on the client, enabling dynamic rendering. Server components combine the best of classic web development and progressive enhancement, offering the advantage of moving logic from the client to the server.
Building Better Websites with Remix
React Summit Remote Edition 2021React Summit Remote Edition 2021
33 min
Building Better Websites with Remix
Top Content
Remix is a web framework built on React Router that focuses on web fundamentals, accessibility, performance, and flexibility. It delivers real HTML and SEO benefits, and allows for automatic updating of meta tags and styles. It provides features like login functionality, session management, and error handling. Remix is a server-rendered framework that can enhance sites with JavaScript but doesn't require it for basic functionality. It aims to create quality HTML-driven documents and is flexible for use with different web technologies and stacks.
Speeding Up Your React App With Less JavaScript
React Summit 2023React Summit 2023
32 min
Speeding Up Your React App With Less JavaScript
Top Content
Watch video: Speeding Up Your React App With Less JavaScript
Mishko, the creator of Angular and AngularJS, discusses the challenges of website performance and JavaScript hydration. He explains the differences between client-side and server-side rendering and introduces Quik as a solution for efficient component hydration. Mishko demonstrates examples of state management and intercommunication using Quik. He highlights the performance benefits of using Quik with React and emphasizes the importance of reducing JavaScript size for better performance. Finally, he mentions the use of QUIC in both MPA and SPA applications for improved startup performance.
Full Stack Documentation
JSNation 2022JSNation 2022
28 min
Full Stack Documentation
Top Content
The Talk discusses the shift to full-stack frameworks and the challenges of full-stack documentation. It highlights the power of interactive tutorials and the importance of user testing in software development. The Talk also introduces learn.svelte.dev, a platform for learning full-stack tools, and discusses the roadmap for SvelteKit and its documentation.
Exploring React Server Component Fundamentals
React Day Berlin 2023React Day Berlin 2023
21 min
Exploring React Server Component Fundamentals
Top Content
Watch video: Exploring React Server Component Fundamentals
This Talk introduces React Server Components (RSC) and explores their serialization process. It compares RSC to traditional server-side rendering (SSR) and explains how RSC handles promises and integrates client components. The Talk also discusses the RSC manifest and deserialization process. The speaker then introduces the Waku framework, which supports bundling, server, routing, and SSR. The future plans for Waku include integration with client state management libraries.
SolidJS: Why All the Suspense?
JSNation 2023JSNation 2023
28 min
SolidJS: Why All the Suspense?
Top Content
Suspense is a mechanism for orchestrating asynchronous state changes in JavaScript frameworks. It ensures async consistency in UIs and helps avoid trust erosion and inconsistencies. Suspense boundaries are used to hoist data fetching and create consistency zones based on the user interface. They can handle loading states of multiple resources and control state loading in applications. Suspense can be used for transitions, providing a smoother user experience and allowing prioritization of important content.

Workshops on related topic

Building WebApps That Light Up the Internet with QwikCity
JSNation 2023JSNation 2023
170 min
Building WebApps That Light Up the Internet with QwikCity
Featured WorkshopFree
Miško Hevery
Miško Hevery
Building instant-on web applications at scale have been elusive. Real-world sites need tracking, analytics, and complex user interfaces and interactions. We always start with the best intentions but end up with a less-than-ideal site.
QwikCity is a new meta-framework that allows you to build large-scale applications with constant startup-up performance. We will look at how to build a QwikCity application and what makes it unique. The workshop will show you how to set up a QwikCitp project. How routing works with layout. The demo application will fetch data and present it to the user in an editable form. And finally, how one can use authentication. All of the basic parts for any large-scale applications.
Along the way, we will also look at what makes Qwik unique, and how resumability enables constant startup performance no matter the application complexity.
Back to the Roots With Remix
React Summit 2023React Summit 2023
106 min
Back to the Roots With Remix
Featured Workshop
Alex Korzhikov
Pavlik Kiselev
2 authors
The modern web would be different without rich client-side applications supported by powerful frameworks: React, Angular, Vue, Lit, and many others. These frameworks rely on client-side JavaScript, which is their core. However, there are other approaches to rendering. One of them (quite old, by the way) is server-side rendering entirely without JavaScript. Let's find out if this is a good idea and how Remix can help us with it?
Prerequisites- Good understanding of JavaScript or TypeScript- It would help to have experience with React, Redux, Node.js and writing FrontEnd and BackEnd applications- Preinstall Node.js, npm- We prefer to use VSCode, but also cloud IDEs such as codesandbox (other IDEs are also ok)
Next.js 13: Data Fetching Strategies
React Day Berlin 2022React Day Berlin 2022
53 min
Next.js 13: Data Fetching Strategies
Top Content
WorkshopFree
Alice De Mauro
Alice De Mauro
- Introduction- Prerequisites for the workshop- Fetching strategies: fundamentals- Fetching strategies – hands-on: fetch API, cache (static VS dynamic), revalidate, suspense (parallel data fetching)- Test your build and serve it on Vercel- Future: Server components VS Client components- Workshop easter egg (unrelated to the topic, calling out accessibility)- Wrapping up
The Gateway to Backend: A Frontend Developer's Guide to Full-Stack Development
React Summit US 2023React Summit US 2023
160 min
The Gateway to Backend: A Frontend Developer's Guide to Full-Stack Development
Top Content
WorkshopFree
Amy Dutton
Amy Dutton
This workshop will guide you through the product development life cycle of creating a real-world web application. You will learn about React Server Components, building a design system within Storybook, and using frontend development to approach becoming a full-stack developer. The workshop will cover increasing confidence in your application with unit tests and implementing authentication and authorization. You'll have the opportunity to work through product features and examine a real-world RedwoodJS project, gaining valuable experience in real-world product development. RedwoodJS makes it simple to approach full-stack development, and this workshop will give you the skills you need to create your own real-world web applications.
Advanced Application Deployment Patterns with React Server Components (feat. a DIY RSC Framework)
React Summit US 2023React Summit US 2023
104 min
Advanced Application Deployment Patterns with React Server Components (feat. a DIY RSC Framework)
Top Content
WorkshopFree
 Greg Brimble
Greg Brimble
The developer ecosystem is always moving fast and this year has proved no exception. React Server Components can offer a significant improvement to developer experience and to application performance. But I think it's fair to say that this new server-first paradigm can be tricky to wrap your head around!In the first half of this workshop, we'll explore React Server Components from the ground-up: building our own mini meta-framework to help us understand how RSCs work. We'll discover exactly what is produced by an RSC build and we'll connect those pieces together to form a full application.Next, we'll deploy it! Cloudflare have also had a busy year too — Smart Placement, in particular, is a new technology that we've developed which fits the RSC model perfectly. We'll explore why that makes sense for our workshop app, and we'll actually deploy it onto the Cloudflare Developer Platform.Finally, we'll build out our app a little further, using D1 (our serverless SQL database) to really show off the React Server Component's power when combined with Smart Placement.You should come away from this workshop with a greater understanding of how React Server Components work (both behind-the-scenes and also how you as a developer can use them day-to-day), as well as insight into some of the new deployment patterns that are now possible after recent innovations in the platform space.
Building Reusable Server Components in NextJS
React Summit US 2023React Summit US 2023
88 min
Building Reusable Server Components in NextJS
Workshop
Will Bishop
Mettin Parzinski
2 authors
React continues to evolve their beta capability, React Server Components, and they're continuing to further develop them in partnership with frameworks like NextJS.In this workshop, attendees will learn what React Server Components are, how to effectively build and use them in NextJS, and focus on one of the major advantages of React/NextJS: reusability through components.We will also cover related beta technologies enabled by the `app` directory, such as nested layouts and server actions (alpha/experimental capability).Join us for this hands-on, 120 minute workshop!Technologies:
React, JavaScript/Typescript, NextJS, Miro