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

@domphy/router

v0.16.0

Published

Domphy Router - type-safe routing, a 1-1 port of @tanstack/router-core

Readme

@domphy/router

Framework-agnostic, fully type-safe routing for Domphy apps: nested routes, path params, validated search params, loaders with caching, redirects, scroll restoration, and SSR streaming.

This package is a 1-1 port of @tanstack/router-core v1.171.13 (MIT, © Tanner Linsley). The upstream src/ is kept byte-identical so future versions can be diffed and merged directly — the only edits to ported files are the self-referencing import @tanstack/router-core/isServer@domphy/router/isServer (5 files) and, in index.ts, re-exporting @tanstack/history (mirroring @tanstack/react-router) plus the Domphy adapter. The adapter itself lives in the separate, non-upstream src/domphy/ directory (createRouter/createRoute — framework-agnostic ports of @tanstack/react-router's wrappers, no hooks or components). All credit for the design and implementation goes to the TanStack Router team.

Install

npm install @domphy/router

Quick Example

import {
    createRouter,
    createRoute,
    createRootRoute,
    createBrowserHistory,
} from "@domphy/router"
import { toState } from "@domphy/core"

const rootRoute = createRootRoute()

const indexRoute = createRoute({
    getParentRoute: () => rootRoute,
    path: "/",
})

const postRoute = createRoute({
    getParentRoute: () => rootRoute,
    path: "/posts/$postId",
    loader: ({ params }) =>
        fetch(`/api/posts/${params.postId}`).then((response) => response.json()),
})

const router = createRouter({
    routeTree: rootRoute.addChildren([indexRoute, postRoute]),
    history: createBrowserHistory(),
})

await router.load()

Bridge router state into Domphy reactivity with toState:

const matches = toState(router.state.matches)

router.subscribe("onResolved", () => {
    matches.set(router.state.matches)
})

const App = {
    div: (listener) => matches.get(listener).map((match) => ({
        section: JSON.stringify(match.loaderData),
        _key: match.id,
    })),
}

What It Includes

  • createRouter / createRoute / createRootRoute — nested route trees with full type inference
  • Path params (/posts/$postId), wildcards, optional segments, route masking
  • Validated search params with middleware (retainSearchParams, stripSearchParams)
  • Loaders with built-in stale-while-revalidate caching, preloading, and deferred data
  • redirect / notFound — control-flow primitives for loaders and navigation
  • History layer re-exported from @tanstack/history (browser, hash, and memory)
  • Scroll restoration, view transitions, navigation blocking
  • SSR entries (@domphy/router/ssr/server, @domphy/router/ssr/client) with streaming and hydration

Documentation