From e30475d0c9d6ca754411de68c20ba6fae19df9db Mon Sep 17 00:00:00 2001
From: Tyler <26290074+thegitduck@users.noreply.github.com>
Date: Sun, 16 Mar 2025 21:21:18 -0700
Subject: [PATCH 1/6] docs: Waku router under the hood
This is an idea for a router post. I am happy to reword, restructure
or whatever.
It was helpful for me to organize my thoughts to look a bit
closer at what is loaded when on each route, so I think a
post to talk through some of this has some value.
Excited to hear what y'all think :)
---
.../website/private/contents/post-009.mdx | 43 +++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 packages/website/private/contents/post-009.mdx
diff --git a/packages/website/private/contents/post-009.mdx b/packages/website/private/contents/post-009.mdx
new file mode 100644
index 000000000..9e81faec9
--- /dev/null
+++ b/packages/website/private/contents/post-009.mdx
@@ -0,0 +1,43 @@
+---
+slug: waku-router-under-the-hood
+title: Waku Router Under the Hood
+description: A brief look into the mechanics of the Waku Router
+author: tyler
+date: 2025/03/19
+---
+
+When routing around a waku app, you may notice some surprisingly quick navigation speeds. This was my experience while starting development at least. Let's walk through the basic mechanics of the router to get a better shared understanding of how it works and maybe even how to speed things up even further 🚀.
+
+## Power of Client-Side Cacheing
+
+Let's say you load into `/` first and there is a `` on the page.
+
+On initial load, the page from `pages/index.tsx` loads along with its route specific js bundle. As this loads, React does its hydration and we setup our RSC cache (we will revisit this later).
+
+Next, we press on the `/about` link and the router will fetch the RSC associated with the new page. Now that we are on the `/about` page and have read all about the project, we're ready to click the logo and navigate back to `/`.
+
+Here is where our first nice boost comes in! Since `/` is static, the client knows it can cache the RSC for this page, so we get our cache hit and immediately start rendering `/` without needing to go back to the server.
+
+## Speeding up Navigation with Dynamic Pages
+
+For dynamic pages, the expectation is that they should be re-requested from the server on each visit. So, links to a dynamic page will take the time that it takes for the server to render the page + the time spent over the network transmitting the RSC payload. This can make a navigation event to a dynamic page feel much slower.
+
+Fear not! We can take advantage of a very common trick for speeding the perceived load time of dynamic pages.
+
+```tsx
+"use client";
+import { useRouter_UNSTABLE as useRouter } from 'waku/router';
+...
+const router = useRouter()
+ router.prefetch('/dynamic')} to='/dynamic'>
+ Dynamic
+
+```
+
+Now, when the user places their cursor over our link, we will fetch the RSC of that next page. Then when the user presses the link, if the promise for the RSC has resolved, we will switch to the next page, otherwise we will wait for the initial prefetch to finish. It's still a nice head start though!
+
+## Why is This Cool?
+
+None of this is specific to RSC, nor is it unique to Waku as a framework. However, the ergonomics of `prefetch` paired with the power of the client cacheing static RSC are quite nice features that will not be the default experience everywhere.
+
+We hope to cache only what is obviously cache-able with static RSC. Then we'll give you the tools to speed up your router interactions from there!
From f2f3d73ddc078c67551ba6fc7ab5144c9d28bd38 Mon Sep 17 00:00:00 2001
From: Tyler <26290074+thegitduck@users.noreply.github.com>
Date: Tue, 18 Mar 2025 00:21:31 -0700
Subject: [PATCH 2/6] guides added to website
---
docs/{builder => guides}/aws-lambda.mdx | 2 +-
docs/guides/cloudflare.mdx | 2 +-
docs/guides/docker.mdx | 2 +-
.../{tutorials => guides}/getting-started.mdx | 10 +-
docs/guides/monorepo.mdx | 2 +-
docs/guides/react-compiler.mdx | 2 +-
.../guides/router-fetch-strategy.mdx | 10 +-
docs/guides/stream-intercept.mdx | 2 +-
packages/website/src/components/icon.tsx | 18 +++
.../website/src/components/navigation.tsx | 1 +
packages/website/src/components/post-list.tsx | 71 +++++++++
packages/website/src/components/post-page.tsx | 115 ++++++++++++++
packages/website/src/lib/get-file-name.ts | 52 ++++++
packages/website/src/pages/blog/[slug].tsx | 149 +-----------------
packages/website/src/pages/blog/index.tsx | 50 ++----
packages/website/src/pages/guides/[slug].tsx | 19 +++
packages/website/src/pages/guides/index.tsx | 69 ++++++++
17 files changed, 375 insertions(+), 201 deletions(-)
rename docs/{builder => guides}/aws-lambda.mdx (99%)
rename docs/{tutorials => guides}/getting-started.mdx (87%)
rename packages/website/private/contents/post-009.mdx => docs/guides/router-fetch-strategy.mdx (90%)
create mode 100644 packages/website/src/components/post-list.tsx
create mode 100644 packages/website/src/components/post-page.tsx
create mode 100644 packages/website/src/lib/get-file-name.ts
create mode 100644 packages/website/src/pages/guides/[slug].tsx
create mode 100644 packages/website/src/pages/guides/index.tsx
diff --git a/docs/builder/aws-lambda.mdx b/docs/guides/aws-lambda.mdx
similarity index 99%
rename from docs/builder/aws-lambda.mdx
rename to docs/guides/aws-lambda.mdx
index 5a3435f0e..c485fb5cf 100644
--- a/docs/builder/aws-lambda.mdx
+++ b/docs/guides/aws-lambda.mdx
@@ -1,5 +1,5 @@
---
-slug: builder/aws-lambda
+slug: aws-lambda
title: AWS Lambda Builder
description: Deploy a WAKU application to AWS.
---
diff --git a/docs/guides/cloudflare.mdx b/docs/guides/cloudflare.mdx
index cecdb9417..eee20ba9d 100644
--- a/docs/guides/cloudflare.mdx
+++ b/docs/guides/cloudflare.mdx
@@ -1,5 +1,5 @@
---
-slug: guides/cloudflare
+slug: cloudflare
title: Run Waku on Cloudflare
description: How to integrate Waku with Cloudflare Workers and interact with Cloudflare bindings and other resources.
---
diff --git a/docs/guides/docker.mdx b/docs/guides/docker.mdx
index 4e80ffb20..9add5809b 100644
--- a/docs/guides/docker.mdx
+++ b/docs/guides/docker.mdx
@@ -1,5 +1,5 @@
---
-slug: guides/docker
+slug: docker
title: Dockerise a Waku app
description: How to package a Waku app into a Docker container.
---
diff --git a/docs/tutorials/getting-started.mdx b/docs/guides/getting-started.mdx
similarity index 87%
rename from docs/tutorials/getting-started.mdx
rename to docs/guides/getting-started.mdx
index d03fed9e1..a421c7c3b 100644
--- a/docs/tutorials/getting-started.mdx
+++ b/docs/guides/getting-started.mdx
@@ -1,4 +1,8 @@
-# Chapter One
+---
+slug: getting-started
+title: Getting Started
+description: Let's build with Waku!
+---
## Getting Started
@@ -76,11 +80,11 @@ Either of these would render under the `/contact` route.
**Layouts** are created with the special `_layout.tsx` filename and are how we create a shared layout that wraps a route and its descendents.
-The layout at `/pages/_layout.tsx` is the [root layout](https://waku.gg/#root-layout), which wraps the entire site. Layouts can be nested as well, which we’ll see in later chapters. We’ll also discover **segment routes**, **nested segment routes**, and **catch-all routes** as well as Waku’s two rendering methods: **static prerendering** at build time and **dynamic rendering** at request time.
+The layout at `/pages/_layout.tsx` is the [root layout](https://waku.gg/#root-layout), which wraps the entire site. Layouts can be nested as well, which we’ll see later. We’ll also discover **segment routes**, **nested segment routes**, and **catch-all routes** as well as Waku’s two rendering methods: **static prerendering** at build time and **dynamic rendering** at request time.
## And that’s all you need to get started
-In the next chapters we’ll dive deeper into everything to understand how powerful, but simple Waku is! 🙂
+Soon, we’ll dive deeper into everything to understand how powerful, but simple Waku is! 🙂
---
diff --git a/docs/guides/monorepo.mdx b/docs/guides/monorepo.mdx
index d0c93966e..4909a9b5f 100644
--- a/docs/guides/monorepo.mdx
+++ b/docs/guides/monorepo.mdx
@@ -1,5 +1,5 @@
---
-slug: guides/monorepo
+slug: monorepo
title: Waku in a Monorepo Setup
description: Tips for Using Waku in a Monorepo Setup
---
diff --git a/docs/guides/react-compiler.mdx b/docs/guides/react-compiler.mdx
index 62631604b..a020d14db 100644
--- a/docs/guides/react-compiler.mdx
+++ b/docs/guides/react-compiler.mdx
@@ -1,5 +1,5 @@
---
-slug: guides/react-compiler
+slug: react-compiler
title: Enabling React Compiler in Waku
description: Learn how to enable the React Compiler in your Waku project using the Vite Plugin to optimize your React applications.
---
diff --git a/packages/website/private/contents/post-009.mdx b/docs/guides/router-fetch-strategy.mdx
similarity index 90%
rename from packages/website/private/contents/post-009.mdx
rename to docs/guides/router-fetch-strategy.mdx
index 9e81faec9..0890466d0 100644
--- a/packages/website/private/contents/post-009.mdx
+++ b/docs/guides/router-fetch-strategy.mdx
@@ -1,9 +1,7 @@
---
-slug: waku-router-under-the-hood
+slug: router-fetch-strategy
title: Waku Router Under the Hood
description: A brief look into the mechanics of the Waku Router
-author: tyler
-date: 2025/03/19
---
When routing around a waku app, you may notice some surprisingly quick navigation speeds. This was my experience while starting development at least. Let's walk through the basic mechanics of the router to get a better shared understanding of how it works and maybe even how to speed things up even further 🚀.
@@ -25,11 +23,7 @@ For dynamic pages, the expectation is that they should be re-requested from the
Fear not! We can take advantage of a very common trick for speeding the perceived load time of dynamic pages.
```tsx
-"use client";
-import { useRouter_UNSTABLE as useRouter } from 'waku/router';
-...
-const router = useRouter()
- router.prefetch('/dynamic')} to='/dynamic'>
+
Dynamic
```
diff --git a/docs/guides/stream-intercept.mdx b/docs/guides/stream-intercept.mdx
index d57b1b048..629fa14f2 100644
--- a/docs/guides/stream-intercept.mdx
+++ b/docs/guides/stream-intercept.mdx
@@ -1,5 +1,5 @@
---
-slug: guides/stream-intercept
+slug: stream-intercept
title: SSR Stream Interception
description: How to intercept SSR stream to inject content before it is sent to the client.
---
diff --git a/packages/website/src/components/icon.tsx b/packages/website/src/components/icon.tsx
index a92c1015e..64d3bd5a6 100644
--- a/packages/website/src/components/icon.tsx
+++ b/packages/website/src/components/icon.tsx
@@ -39,6 +39,24 @@ export const Icon = ({ icon, ...rest }: IconProps) => {
);
+ case 'guide':
+ return (
+
+ );
default:
return null;
}
diff --git a/packages/website/src/components/navigation.tsx b/packages/website/src/components/navigation.tsx
index 382736667..5f6e4dd15 100644
--- a/packages/website/src/components/navigation.tsx
+++ b/packages/website/src/components/navigation.tsx
@@ -194,6 +194,7 @@ const docs = [
const links = [
{ to: '/blog', icon: 'book', label: 'Blog' },
+ { to: '/guides', icon: 'guide', label: 'Guides' },
{ to: 'https://github.com/dai-shi/waku', icon: 'github', label: 'GitHub' },
{ to: 'https://discord.gg/MrQdmzd', icon: 'discord', label: 'Discord' },
];
diff --git a/packages/website/src/components/post-list.tsx b/packages/website/src/components/post-list.tsx
new file mode 100644
index 000000000..73fe27e66
--- /dev/null
+++ b/packages/website/src/components/post-list.tsx
@@ -0,0 +1,71 @@
+import { Link } from 'waku';
+
+type PostListItemProps = {
+ slug: string;
+ title: string;
+ description: string;
+ author?: {
+ name: string;
+ };
+ date?: string;
+ rawDate?: string;
+ release?: string | undefined;
+};
+
+const PostListItem = ({
+ postItem,
+ path,
+}: {
+ postItem: PostListItemProps;
+ path: 'blog' | 'guides';
+}) => (
+
+ Our guides walk through hosting instructions, framework behavior,
+ developer tooling, and more! We will talk through unstable APIs here,
+ so you can help experiment with our new and fun features.
+
+
+
+
+ );
+}
+
+const getArticles = async () => {
+ const blogFileNames: Array = [];
+ const blogArticles: Array<{
+ slug: string;
+ title: string;
+ description: string;
+ }> = [];
+
+ readdirSync('../../docs/guides/').forEach((fileName) => {
+ if (fileName.endsWith('.mdx')) {
+ blogFileNames.push(fileName);
+ }
+ });
+
+ for await (const fileName of blogFileNames) {
+ const path = `../../docs/guides/${fileName}`;
+ const source = readFileSync(path, 'utf8');
+ const mdx = await compileMDX({
+ source,
+ options: { parseFrontmatter: true },
+ });
+ const frontmatter = mdx.frontmatter as BlogFrontmatter;
+
+ const article = {
+ slug: frontmatter.slug,
+ title: frontmatter.title,
+ description: frontmatter.description,
+ };
+
+ blogArticles.push(article);
+ }
+
+ return blogArticles.sort((a, b) => a.slug.localeCompare(b.slug));
+};
+
+export const getConfig = async () => {
+ return {
+ render: 'static',
+ } as const;
+};
From be83ab0d77afa1baec762bb754032b22294549d2 Mon Sep 17 00:00:00 2001
From: Tyler <26290074+thegitduck@users.noreply.github.com>
Date: Tue, 18 Mar 2025 00:25:29 -0700
Subject: [PATCH 3/6] fix prettier
---
docs/guides/router-fetch-strategy.mdx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/guides/router-fetch-strategy.mdx b/docs/guides/router-fetch-strategy.mdx
index 0890466d0..fb5ddeee4 100644
--- a/docs/guides/router-fetch-strategy.mdx
+++ b/docs/guides/router-fetch-strategy.mdx
@@ -23,7 +23,7 @@ For dynamic pages, the expectation is that they should be re-requested from the
Fear not! We can take advantage of a very common trick for speeding the perceived load time of dynamic pages.
```tsx
-
+
Dynamic
```
From daadb4c2e2376c9c79fe8034ab7efee896d8d8bb Mon Sep 17 00:00:00 2001
From: Tyler <26290074+thegitduck@users.noreply.github.com>
Date: Tue, 18 Mar 2025 21:38:31 -0700
Subject: [PATCH 4/6] fix url
---
packages/website/src/components/post-page.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/website/src/components/post-page.tsx b/packages/website/src/components/post-page.tsx
index 0fcd62a8d..2e2ab66a6 100644
--- a/packages/website/src/components/post-page.tsx
+++ b/packages/website/src/components/post-page.tsx
@@ -19,7 +19,7 @@ export async function PostPage({
return null;
}
- const path = `./private/contents/${fileName}`;
+ const path = `${folder}/${fileName}`;
const source = readFileSync(path, 'utf8');
const mdx = await compileMDX({
source,
From 36ca60edf0f02a1801af122e0663129583cd8222 Mon Sep 17 00:00:00 2001
From: Tyler <26290074+thegitduck@users.noreply.github.com>
Date: Tue, 18 Mar 2025 21:59:26 -0700
Subject: [PATCH 5/6] remove extra title
---
docs/guides/aws-lambda.mdx | 2 --
1 file changed, 2 deletions(-)
diff --git a/docs/guides/aws-lambda.mdx b/docs/guides/aws-lambda.mdx
index c485fb5cf..af097f291 100644
--- a/docs/guides/aws-lambda.mdx
+++ b/docs/guides/aws-lambda.mdx
@@ -4,8 +4,6 @@ title: AWS Lambda Builder
description: Deploy a WAKU application to AWS.
---
-# AWS Lambda Builder
-
The WAKU builder for AWS Lambda will provide the bundled output in the `dist` folder.
The entry handler for the Lambda is `dist/serve-aws-lambda.handler`.
From 4525fc51f70d498c455e7e112442ba910e113a71 Mon Sep 17 00:00:00 2001
From: Tyler <26290074+thegitduck@users.noreply.github.com>
Date: Thu, 20 Mar 2025 00:06:57 -0700
Subject: [PATCH 6/6] typo
---
docs/guides/router-fetch-strategy.mdx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/guides/router-fetch-strategy.mdx b/docs/guides/router-fetch-strategy.mdx
index fb5ddeee4..ec7d4dfea 100644
--- a/docs/guides/router-fetch-strategy.mdx
+++ b/docs/guides/router-fetch-strategy.mdx
@@ -6,7 +6,7 @@ description: A brief look into the mechanics of the Waku Router
When routing around a waku app, you may notice some surprisingly quick navigation speeds. This was my experience while starting development at least. Let's walk through the basic mechanics of the router to get a better shared understanding of how it works and maybe even how to speed things up even further 🚀.
-## Power of Client-Side Cacheing
+## Power of Client-Side Caching
Let's say you load into `/` first and there is a `` on the page.
@@ -32,6 +32,6 @@ Now, when the user places their cursor over our link, we will fetch the RSC of t
## Why is This Cool?
-None of this is specific to RSC, nor is it unique to Waku as a framework. However, the ergonomics of `prefetch` paired with the power of the client cacheing static RSC are quite nice features that will not be the default experience everywhere.
+None of this is specific to RSC, nor is it unique to Waku as a framework. However, the ergonomics of `prefetch` paired with the power of the client caching static RSC are quite nice features that will not be the default experience everywhere.
We hope to cache only what is obviously cache-able with static RSC. Then we'll give you the tools to speed up your router interactions from there!