npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

waku-fastify

v0.1.1

Published

Fastify plugin for Waku React framework

Readme

waku-fastify

A Fastify plugin that integrates Waku (The React Framework) into your Fastify server. It leverages Vite 6's Environment API for a robust development experience and @whatwg-node/server for standard Web Request/Response handling.

Installation

npm install waku-fastify
pnpm i waku-fastify
yarn add waku-fastify

Usage

Basic Setup

Here is a basic example of how to set up waku-fastify in your server entry point (e.g., server.ts):

import { fastify } from 'fastify'
import { wakuFastify } from 'waku-fastify'

const app = fastify({ logger: true })

await app.register(wakuFastify, {
  // 'development' or 'production'
  mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
  
  // Waku project root
  root: process.cwd(),
  
  // Configuration for development mode
  dev: {
    viteOptions: {
      server: {
        hmr: { port: 3001 }
      }
    }
  },
  
  // Configuration for production mode
  build: {
    distDir: 'dist',
    assetCacheControl: {
      maxAge: 31536000,
      immutable: true
    }
  }
})

const host = process.env.HOST || '127.0.0.1'
const port = Number(process.env.PORT) || 3000

await app.listen({ port, host })
console.log(`Server running on http://${host}:${port}`)

Configuration Options

The plugin accepts the following options:

| Option | Type | Default | Description | | --------------------------- | ------------------------------- | --------------------------------- | ------------------------------------------------------ | | mode | 'development' \| 'production' | 'development' | Application running mode. | | basePath | string | '/' | Base path for the application. | | root | string | process.cwd() | Root directory of the Waku project. | | dev | object | {} | Options specific to development mode. | | dev.viteOptions | InlineConfig | undefined | Custom Vite configuration overrides. | | build | object | {...} | Options specific to production mode. | | build.distDir | string | './dist' | Directory containing the built Waku assets. | | build.assetCacheControl | CacheControl | { maxAge: 1y, immutable: true } | Cache-Control header for static assets (hashed files). | | build.defaultCacheControl | CacheControl | { maxAge: 1h } | Default Cache-Control header for other static files. | | childServerOptions | RouteShorthandOptions | undefined | Fastify options for the child server instance. |

Notes for basePath in real Fastify apps

  • basePath must end with / (e.g. '/pages-waku/').
  • In development, the plugin mounts Vite in middleware mode. If your app already uses Vite (e.g. another SSR framework), you should set an isolated cache directory via dev.viteOptions.cacheDir to avoid 504 Outdated Optimize Dep.

Example:

await app.register(wakuFastify, {
  basePath: '/pages-waku/',
  dev: {
    viteOptions: {
      cacheDir: 'node_modules/.vite-waku-fastify',
    },
  },
})

Project Structure

Your Waku project should follow the standard structure:

waku-project/
├── src/
│   ├── components/
│   ├── pages/
│   └── waku.server.tsx       # Server entry point
├── public/
├── package.json
├── tsconfig.json
└── waku.config.ts            # Waku configuration

Scripts

Update your package.json scripts to support both dev and prod:

{
  "scripts": {
    "dev": "NODE_ENV=development tsx watch server/index.ts",
    "build": "waku build",
    "start": "NODE_ENV=production node dist/server.js"
  }
}

License

MIT