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

whitebox-pro-server-plugin-shortener

v0.2.0

Published

WhiteBox server plugin — branded short links on their own host that hide a passport behind an opaque code. A personalized link, when clicked, hard-binds the visitor's session to that customer (stitching anonymous history via the core passport merge). Publ

Readme

Shortener Plugin

Branded short links on their own host that hide a passport behind an opaque code — a personalized link, once clicked, hard-binds the visitor's session to that customer, with native UTM attribution.

What it is

Branded short links on their own host that hide a passport behind an opaque code. A personalized link, when clicked, hard-binds the visitor's session to that customer — stitching any anonymous browsing history onto them via the core passport merge. The passport id never appears in a URL: only the code, then a single-use claim token in the redirect.

Topology — same server, second vhost

One whitebox-pro-server, one port. The short host (go.clinic.com) is a second vhost in the reverse proxy pointing at this server; baseUrl's hostname gates the bare /:code redirect, and management/claim live under /shortener/* on the normal API host. The proxy must forward the public Host header, and the server needs trustProxy set in whitebox.config.js (a hop count, never a bare true) so req.hostname reflects it — see docs/04-configuration.md#trust-proxy.

Config

import { shortener } from 'whitebox-pro-server-plugin-shortener'

shortener({
  baseUrl: 'https://go.clinic.com',                 // builds short_url AND gates /:code
  auth: { secret: process.env.WB_SHORTENER_TOKEN }, // Bearer for POST /shortener/links
  // codeLength: 8, defaultTtlSec: 30d, identityTtlSec: 24h, claimTtlSec: 180,
})

Endpoints

| Method | Path | Host | Auth | | |---|---|---|---|---| | GET | /:code | short | public | resolve → 302 (+ single-use token when bindable) | | POST | /shortener/links | API | Bearer | create a link | | POST | /shortener/claim | API | public | redeem a token → { bound, passport_id, data } | | GET | /shortener/links/:code | API | Bearer | inspect + click stats | | GET | /shortener/links | API | Bearer | list (limit/offset) |

POST /shortener/links

{ "url": "https://clinic.com/whitening", "passport_id": "uuid",
  "identify": { "email": "jane@…" }, "data": { "name": "Jane" },
  "utm": { "source": "email", "medium": "mail", "campaign": "spring" },
  "label": "spring-email", "ttlSec": 2592000, "identityTtlSec": 86400 }
→ { "code": "Api9AjAu", "short_url": "https://go.clinic.com/Api9AjAu", "expires_at": … }

Native UTM. Pass utm with any of source/medium/campaign/term/content/id and they're baked into the destination's query (utm_source, …) so every redirect carries campaign attribution. Explicit values override any utm_* already in the URL; other query params are preserved. They're also mirrored into the link's data, so the click's awareness record cites the campaign. (The claim token still rides the fragment, or the query for hash-router destinations — independent of the UTM query params.)

How a click binds

GET /:code      → resolve code → mint a fresh single-use claim_token (~3 min)
                → 302 to  dest#wb=<token>   (?wb= if dest already has a fragment)
                → idempotent: never consumes identity (email scanners can't burn it)
POST /claim     → validate+consume token (single-use) → HARD-BIND:
                  • first-touch  → session adopts the customer
                  • returning    → passports.merge(customer, P_anon)  ← non-destructive
                → mark identity consumed, link PII, record an awareness exposure
                → { bound:true, passport_id, data }   (data prefills forms)

Hard-bind, safely: identity is single-use and consumed on the claim (a real browser that ran JS), never on the redirect GET — so scanners/prefetchers can't consume or misattribute it, and forwarded links self-disarm after the first claim. The client SDK (whitebox-pro-client-plugin-shortener) reads ?wb=/#wb=, claims, scrubs the URL, and adopts the returned passport.

Handoff — automatic

No config: a clean fragment (#wb=) by default (kept out of the destination's server logs); falls back to a query param (?wb=) when the destination URL already has a fragment (hash router / anchor), where #wb= would collide.

MCP

shortener.create_link, shortener.list_links, shortener.link_stats.