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

@samrey/router

v1.0.1

Published

Fine-grained reactive client & server router with parameterized matching and loader pipelines.

Readme

@samrey/router

Fine-grained reactive routing engine with nested routes, parameterized matching, route guards, async loaders, and zero full-page re-renders.

Purpose

@samrey/router provides client-side and universal routing built entirely on Samrey reactive signals. Navigating between routes updates only the dynamic route view outlet rather than tearing down the root application shell.

Installation

npm install @samrey/router @samrey/reactivity @samrey/runtime

Quick Example

import { createRouter, Link, RouterOutlet } from '@samrey/router';
import { el } from '@samrey/runtime';

const routes = [
  { path: '/', component: () => el('h1', null, 'Home View') },
  { path: '/users/:id', component: (params) => el('h2', null, `User ID: ${params.id}`) },
  { path: '*', component: () => el('h1', null, '404 Not Found') }
];

const router = createRouter({ routes });

function App() {
  return el('div', null,
    el('nav', null,
      Link({ to: '/', children: 'Home' }),
      Link({ to: '/users/42', children: 'User Profile' })
    ),
    RouterOutlet({ router })
  );
}

API

  • createRouter(options: RouterOptions): Router — Creates a reactive router instance.
  • Link(props: LinkProps): HTMLElement — Accessible navigation link component with active state handling.
  • RouterOutlet(props: RouterOutletProps): HTMLElement — Container rendering the component for the active matched route.
  • useRouter(): Router — Retrieves the active router instance from context.
  • useParams(): Signal<Record<string, string>> — Reactive signal containing matched URL route parameters.
  • useLocation(): Signal<LocationState> — Reactive signal containing path, search, and hash.
  • useSearchParams(): [Signal<URLSearchParams>, (params: Record<string, string>) => void] — Reactive query parameter hook.
  • matchRoute(pattern: string, pathname: string): RouteMatch | null — Utility matching URL path patterns.

Environment

Universal: Node.js (memory-based history for SSR) and browser environments (HTML5 History API or hash history).

Security

Sanitizes navigation targets against javascript: injection and prevents open redirect attacks when handling external return URLs.

Related Packages

  • @samrey/runtime — Renders route components into the DOM.
  • @samrey/reactivity — Drives reactive routing state.
  • @samrey/ssr — Server-side route matching and pre-rendering.