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

@maulanashalihin/hyper-inertia

v1.0.0

Published

Inertia.js v3 server-side adapter for HyperExpress — native, no adaptor bridge. Implements the Inertia protocol (auto-detect, asset versioning, partial reloads, shared props, external redirects).

Readme

@maulanashalihin/hyper-inertia

Inertia.js v3 server-side adapter for HyperExpress — native middleware, no adaptor bridge.

License: MIT

Implements the Inertia.js protocol natively on HyperExpress. Auto-detects Inertia XHR requests versus initial full-page loads, returning JSON for the former and a root HTML document for the latter.

Supports Inertia v3 protocol: asset versioning, partial reloads, shared props, merge/prepend/deep-merge props, deferred/lazy props, once props, encrypted history, and external/internal redirects.

Features

  • Auto-detectX-Inertia header check: JSON for XHR, HTML for initial load
  • Page object{ component, props, url, version } as specified by the protocol
  • Asset versioning — 409 Conflict + X-Inertia-Location on version mismatch
  • Shared props — static (share) and dynamic per-request (shareFunc)
  • Partial reloadsX-Inertia-Partial-Data, X-Inertia-Partial-Except
  • Internal redirects — 303 See Other for form submissions
  • External redirects — 409 Conflict + X-Inertia-Location for full page navigations
  • Back navigation — Referer-based back() with fallback
  • Custom root template — override via config.render for Vite, Webpack
  • Zero dependencies — only peer dependency on hyper-express

Installation

npm install @maulanashalihin/hyper-inertia

Quick Start

import { Inertia } from "@maulanashalihin/hyper-inertia";
import HyperExpress from "hyper-express";

const server = new HyperExpress.Server();
const inertia = new Inertia({ version: "1.0" });

// 1. Register middleware (version checking, helper attachment)
server.use(inertia.middleware());

// 2. Render pages
server.get("/", async (req, res) => {
  await inertia.render(req, res, "Home", {
    title: "Welcome",
    user: { name: "Maulana" },
  });
});

// Or use the attached helper:
server.get("/dashboard", async (req, res) => {
  return (res as any).inertia("Dashboard", { stats: { users: 42 } });
});

server.listen(3000);

Usage

Shared props

// Static shared prop
inertia.share("appName", "Laju");

// Dynamic per-request prop
inertia.shareFunc("user", (req, res) => {
  return getCurrentUser(req);
});

// Page-specific props override shared props
await inertia.render(req, res, "Login", { user: null });

Redirects

// Internal redirect (303 See Other) — Inertia follows via XHR
inertia.redirect(res, "/dashboard");

// External redirect (409 + X-Inertia-Location) — full page reload
inertia.location(res, "https://example.com");

// Back — go to previous page (from Referer header)
inertia.back(res, req);            // no Referer → "/"
inertia.back(res, req, "/home");   // no Referer → "/home"

Custom root HTML

const inertia = new Inertia({
  version: "1.0",
  render: (req, res, page) => {
    const pageJSON = JSON.stringify(page);
    const html = `<!DOCTYPE html>
<html>
<head>
  <title>${page.props.title || "App"}</title>
  <link rel="stylesheet" href="/assets/app.css">
</head>
<body>
  <div id="app" data-page='${escapeHtml(pageJSON)}'></div>
  <script type="module" src="/assets/main.js"></script>
</body>
</html>`;
    res.setHeader("Content-Type", "text/html; charset=utf-8");
    return res.send(html);
  },
});

API Reference

new Inertia(config?)

| Option | Type | Default | Description | |--------|------|---------|-------------| | version | string | "" | Asset version for cache busting | | render | function | Default template | Custom root HTML renderer |

inertia.middleware()

Returns a HyperExpress middleware function that:

  • Checks asset version (409 on mismatch)
  • Attaches res.inertia(), res.flash(), res.redirect() helpers

inertia.render(req, res, component, props?)

Main render method. Returns JSON for XHR, HTML for initial load.

inertia.share(key, value) / inertia.shareFunc(key, fn)

Register global props.

inertia.redirect(res, url) / inertia.location(res, url) / inertia.back(res, req, defaultUrl?)

Redirect helpers.