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

@86d-app/redirects

v0.0.26

Published

URL redirect management — 301/302/307/308 redirects for SEO and URL migration

Downloads

1,018

Readme

@86d-app/redirects

URL redirect management module for 86d. Create, manage, and track URL redirects for SEO and URL migration.

Features

  • 301/302/307/308 HTTP redirect management
  • Exact-match and regex-based redirect rules
  • Automatic capture group replacement in regex targets ($1, $2, etc.)
  • Hit tracking (count + timestamp)
  • Bulk delete operations
  • Path testing tool for admin
  • Duplicate and loop prevention
  • Query string preservation control

Installation

Included by default when modules: "*" in your template config.json.

{
  "modules": ["redirects"],
  "moduleOptions": {
    "@86d-app/redirects": {
      "maxRedirects": "1000"
    }
  }
}

Configuration

| Option | Type | Default | Description | |--------|------|---------|-------------| | maxRedirects | string | "1000" | Maximum number of redirects evaluated per resolve request |

Store Endpoints

| Method | Path | Description | |--------|------|-------------| | GET | /redirects/resolve?path= | Resolve a path to its redirect target. Records a hit if matched. | | GET | /redirects/check?path= | Check if a path has a matching redirect (no hit recorded). |

Resolve response

{
  "matched": true,
  "targetPath": "/new-page",
  "statusCode": 301,
  "preserveQueryString": true
}

Admin Endpoints

| Method | Path | Description | |--------|------|-------------| | GET | /admin/redirects | List redirects (query: active, statusCode, search, take, skip) | | GET | /admin/redirects/stats | Redirect statistics (total, active, hits, top redirects) | | POST | /admin/redirects/create | Create a redirect | | GET | /admin/redirects/:id | Get a single redirect | | POST | /admin/redirects/:id/update | Update a redirect | | POST | /admin/redirects/:id/delete | Delete a redirect | | POST | /admin/redirects/bulk-delete | Delete multiple redirects | | POST | /admin/redirects/test | Test if a path matches any redirect rule |

Create/Update fields

| Field | Type | Required | Description | |-------|------|----------|-------------| | sourcePath | string | Yes | Source URL path (e.g., /old-page) | | targetPath | string | Yes | Target URL path (e.g., /new-page) | | statusCode | number | No | HTTP status code: 301, 302, 307, 308 (default: 301) | | isActive | boolean | No | Whether the redirect is active (default: true) | | isRegex | boolean | No | Whether sourcePath is a regex pattern (default: false) | | preserveQueryString | boolean | No | Preserve query string on redirect (default: true) | | note | string | No | Internal note about the redirect |

Controller API

interface RedirectController {
  createRedirect(params): Promise<Redirect>
  getRedirect(id: string): Promise<Redirect | null>
  updateRedirect(id: string, params): Promise<Redirect | null>
  deleteRedirect(id: string): Promise<boolean>
  listRedirects(params?): Promise<Redirect[]>
  countRedirects(params?): Promise<number>
  resolve(path: string): Promise<{ targetPath, statusCode, preserveQueryString } | null>
  recordHit(id: string): Promise<void>
  bulkDelete(ids: string[]): Promise<number>
  testPath(path: string): Promise<{ matched: boolean; redirect?: Redirect }>
  getStats(): Promise<RedirectStats>
}

Regex Redirects

Regex redirects use the sourcePath as a regex pattern matched against request paths. Capture groups can be referenced in targetPath:

Source: /products/(.*)
Target: /shop/$1
Result: /products/shoes → /shop/shoes
Source: /blog/(\d{4})/(\d{2})/(.*)
Target: /posts/$1-$2-$3
Result: /blog/2024/03/my-post → /posts/2024-03-my-post

Resolution order: exact matches are checked first, then regex patterns (first match wins).

Types

interface Redirect {
  id: string
  sourcePath: string
  targetPath: string
  statusCode: number
  isActive: boolean
  isRegex: boolean
  preserveQueryString: boolean
  note?: string
  hitCount: number
  lastHitAt?: Date
  createdAt: Date
  updatedAt: Date
}

interface RedirectStats {
  totalRedirects: number
  activeRedirects: number
  totalHits: number
  topRedirects: Array<{ id, sourcePath, targetPath, hitCount }>
}

Notes

  • Non-regex redirects enforce unique sourcePath to prevent conflicts
  • Creating a redirect where source equals target is rejected (loop prevention)
  • Invalid regex patterns fail gracefully (treated as no match)
  • Admin component supports search, bulk selection, test tool, and stats dashboard
  • Appears under Content > Site in the admin sidebar