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/app

v0.16.0

Published

Domphy App - a port of the Next.js App Router feature set for Domphy: routing, nested layouts, navigation, data loading, metadata, middleware, SSR and API routes

Downloads

2,255

Readme

@domphy/app

A port of the Next.js App Router feature set for Domphy: nested routing and layouts, client navigation with prefetching, loading/error/not-found boundaries, data loading with revalidation, the Metadata API, middleware, server rendering with hydration, API route handlers, and image/script helpers.

It is a runtime library — routes are declared as a plain object tree (the equivalent of the app/ directory) and pages/layouts are ordinary Domphy blocks. No bundler plugin or file-system convention is required.

Install

npm install @domphy/app

Quick Example

import { createApp, defineRoutes, navLink } from "@domphy/app"
import type { RouteContext } from "@domphy/app"

const routes = defineRoutes([
  {
    path: "/",
    layout: (children) => ({
      div: [
        { nav: [{ a: "Home", $: [navLink({ href: "/" })] }] },
        children,
      ],
    }),
    page: () => ({ h1: "Home" }),
    metadata: { title: { default: "My Site", template: "%s | My Site" } },
    children: [
      {
        path: "blog/[slug]",
        loader: async ({ params }) => fetchPost(params.slug as string),
        loading: () => ({ p: "Loading..." }),
        metadata: (context) => ({ title: `Post ${context.params.slug}` }),
        page: (context: RouteContext<Post>) => ({
          article: [{ h1: context.data.title }, { p: context.data.body }],
        }),
      },
    ],
  },
])

const app = createApp(routes)
await app.render(document.getElementById("app")!)

Feature Map

| Next.js | @domphy/app | | --- | --- | | app/ directory segments | Route tree (path, children) | | page.tsx / layout.tsx | page / layout blocks | | loading.tsx / error.tsx / not-found.tsx | loading / error / notFound blocks | | [slug], [...all], [[...all]], (group) | same segment syntax in path | | fetch caching / ISR revalidate | loader + revalidate seconds | | next/link | navLink() patch (prefetch on hover/visible, active state) | | useRouter() | app.routerpush, replace, back, forward, refresh, prefetch | | usePathname() / useSearchParams() | router.state.get("pathname", listener) / router.searchParams(listener) | | redirect() / permanentRedirect() / notFound() | same functions, callable from loaders, metadata and middleware | | middleware.ts (redirect, rewrite) | middleware option + rewrite() | | Metadata API / generateMetadata | metadata object or function per segment | | SSR + hydration | app.renderToString(url) + app.hydrate(target) | | route.ts API handlers | createApiHandler() on web-standard Request/Response | | next/image | optimizedImage() patch (lazy, srcset via loader, fill, blur) | | next/script | script() block (afterInteractive, lazyOnload, dedupe) |

Out of scope (build-time concerns that belong to your bundler or host): the compiler/dev server, React Server Components, static export, font optimization and the image optimization server (optimizedImage delegates URL generation to any image CDN through its loader prop).

Server Rendering

const result = await app.renderToString(request.url, { headers: request.headers })
// result.html, result.css, result.head, result.status, result.redirect,
// result.bootstrapScript (inline loader data for hydration)

On the client:

await app.hydrate(document.getElementById("app")!.firstElementChild as HTMLElement)

Documentation

Full guides at domphy.com/docs/app.