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

@authtempo/react-router

v0.2.0

Published

The React Router binding of authtempo, for the server middleware of React Router 8. It takes `react-router` 8.4.0 or newer in 8 as a peer dependency. React Router 8.4 needs Node 22.22 or newer (its engines field, read 2026-10-15). The binding adds no floo

Readme

@authtempo/react-router

The React Router binding of authtempo, for the server middleware of React Router 8. It takes react-router 8.4.0 or newer in 8 as a peer dependency. React Router 8.4 needs Node 22.22 or newer (its engines field, read 2026-10-15). The binding adds no floor of its own.

  1. Mount core: app/routes/auth.$.ts holds export const { loader, action } = authRouteModule(getAuth);.
  2. Read the session: app/root.tsx holds export const middleware = [authMiddleware({ auth: getAuth })];, and a loader reads getSession(context).
  3. Protect paths: authMiddleware({ auth: getAuth, protect: (p) => p.startsWith("/account"), signInPath: "/sign-in" }).
  • protect gets the path as React Router matched it: ".data" removed, each segment decoded once, a decoded "/" kept as %2F, and no resolution of "." or "..". So "/%61ccount" reaches the rule as "/account". Write a rule in decoded text: "/café", "/σ".
  • A rule must hold for every path that the route matches. Use a prefix rule for a splat or a parameter. Name each form of an optional segment: ":lang?/account" renders for "/en/account", which a rule on "/account" does not name. A data request "/account/...data" reaches a splat route "account/*" as "/account/..", and an exact rule misses it.
  • next keeps the page URL in URL form, with the case of the request.
  • React Router matches a path without case by default, so "/ACCOUNT" runs the page of "/account". The binding folds case for protect: a path needs a session when the rule holds for the path or for its lower-case form. Still set caseSensitive: true on each protected route, so "/ACCOUNT" gets a 404.
  • React Router ignores trailing slashes on every route that is not a splat, so "/account/" renders "/account". The rule gets the path as matched, its lower-case form, and both forms with trailing slashes removed. It also gets the matched path in the case of the route's own text: "/myaccount" on the route "myAccount" gives "/myAccount". A path needs a session when the rule holds for any of them. Write a rule in the route's own text.
  • A parameter value or a splat value keeps the case of the request: the route has no text for it. A rule on "/en/myAccount" for ":lang/myAccount" misses "/EN/MYACCOUNT". Compare such segments in lower case in the rule.
  • The middleware reads no session for a route of core, and adds the renewed cookie to the page's answer after the sliding refresh.
  • A function given to both authRouteModule and authMiddleware runs twice for a request to core, so make it return one instance per environment.
  • React Router runs the loader of a resource route for an OPTIONS request, so core answers a cross-origin preflight to its routes.
  • The sign-in redirect goes to the origin of request.url, as the React Router server builds it. The binding never reads the host of an absolute-form request target. @react-router/node builds the URL in createRequest of @remix-run/node-fetch-server 0.14.2 (read 2026-10-15). It takes the host option, then the forwarded host under trustProxy, then :authority, then the Host header, then localhost. @react-router/express 8.4.0 takes req.protocol and req.hostname. Each adapter adds the request target after that host, so an absolute-form target cannot set the origin. Set the host option, or trust a forwarded host only behind your own proxy.