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

@wb-at/storyblok-nuxt-redirects

v1.1.0

Published

WB Storyblok Nuxt Redirects Module

Readme

WB Storyblok Nuxt Redirects

A Nuxt module that handles URL redirects using Storyblok datasources. This module fetches redirect rules from a Storyblok datasource and applies them either at build time or runtime. This module is part of a Storyblok App Extension which manages auto-deployment/reload and the datasource in Storyblok.

Features

  • 🚀 Build-time redirects - Generate static route rules at build time for optimal performance
  • Runtime redirects - Dynamically fetch and apply redirects at runtime
  • 🔄 Hot reload support - Refresh redirects without restarting the server using a secure token
  • 📦 Storyblok integration - Manage redirects directly in Storyblok's datasource editor
  • 🔍 Efficient lookup - Uses binary search for fast redirect matching

Installation

# Using npm
npm install @wb-at/storyblok-nuxt-redirects
# Using yarn
yarn add @wb-at/storyblok-nuxt-redirects
# Using pnpm
pnpm add @wb-at/storyblok-nuxt-redirects

Configuration

Add the module to your nuxt.config.ts:

export default defineNuxtConfig({
  modules: ['@wb-at/storyblok-nuxt-redirects'],

  storyblokNuxtRedirects: {
    // Your Storyblok access token (required)
    storyblokAccessToken: 'your-storyblok-access-token',
    
    // Slug of the Storyblok datasource containing redirects (default: 'sb-wb-redirects')
    datasourceSlug: 'sb-wb-redirects',
    
    // If true, redirects are only generated at build time (default: false)
    buildTimeOnly: false,
    
    // Enable debug logging (default: false)
    debug: false,
    
    // Optional token to secure the refresh endpoint
    refreshToken: 'your-secret-refresh-token',
  },
})

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | storyblokAccessToken | string | - | Your Storyblok API access token (required) | | datasourceSlug | string | 'sb-wb-redirects' | The slug of the Storyblok datasource containing redirects | | buildTimeOnly | boolean | false | When true, redirects are fetched at build time only | | debug | boolean | false | Enable debug logging | | refreshToken | string | - | Token to secure the redirect refresh mechanism |

Environment Variables

You can also configure the module using environment variables:

| Environment Variable | Description | |---------------------|-------------| | NUXT_PUBLIC_STORYBLOK_ACCESS_TOKEN | Storyblok access token | | NUXT_PUBLIC_STORYBLOK_NUXT_REDIRECTS_BUILD_TIME_ONLY | Build time only mode | | NUXT_PUBLIC_STORYBLOK_NUXT_REDIRECTS_DATASOURCE_SLUG | Datasource slug | | NUXT_PUBLIC_STORYBLOK_NUXT_REDIRECTS_DEBUG | Debug mode | | NUXT_STORYBLOK_NUXT_REDIRECTS_REFRESH_TOKEN | Refresh token (private) |

Usage Modes

Runtime Mode (Default)

In runtime mode, redirects are fetched from Storyblok on the first request and cached. A global middleware handles redirect matching for all incoming requests.

storyblokNuxtRedirects: {
  buildTimeOnly: false // This is the default
}

Build-time Mode

In build-time mode, redirects are fetched during the Nuxt build process and added as static route rules. This provides the best performance but requires a rebuild to update redirects.

storyblokNuxtRedirects: {
  buildTimeOnly: true,
}

Refreshing Redirects at Runtime

When running in runtime mode, you can refresh the cached redirects by making a request with the refresh token in the Authorization header:

curl -X GET https://your-site.com/any-page \
  -H "Authorization: Bearer your-secret-refresh-token"

This will trigger a reload of redirects from Storyblok without requiring a server restart.

Development

# Install dependencies
yarn install

# Prepare development environment
yarn dev:prepare

# Start development server with playground
yarn dev

# Run tests
yarn test

# Build the module
yarn prepack