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

hrest-node

v0.1.4

Published

Hyper-REST Backend Middleware for Node.js (Express)

Readme

HRest Node (hrest-node)

Benchmark | Core | CLI | Python | Node | Go | TS


HRest Node provides the enterprise-grade integration layer for the Hyper-REST (HRest) protocol in Node.js and TypeScript environments. By acting as standard Express middleware, it intercepts binary HRest requests, performs high-speed binary-to-JSON decoding via WebAssembly (WASM), and forwards standard JSON to your application.

This architecture ensures seamless adoption. You can maintain your existing Express/TypeScript routers without modifying request handlers, while drastically reducing payload sizes over the network.

Installation

Install the production release directly from NPM:

npm install hrest-node

Integration (Express)

HRest operates as middleware. Ensure it is registered before your primary body parsers if you expect heavy binary traffic.

import express from 'express';
import fs from 'fs';
import { createHrestMiddleware, HrestConfig } from 'hrest-node';

const app = express();

// 1. Load your generated binary contracts
const reqContractStr = fs.readFileSync('../contracts/hrest-req-contract.json', 'utf-8');
const resContractStr = fs.readFileSync('../contracts/hrest-res-contract.json', 'utf-8');

// 2. Configure HRest Middleware
const hrestConfig: HrestConfig = {
    reqContractJson: reqContractStr,
    resContractJson: resContractStr,
    fallbackJson: true,       // Allow standard JSON requests to pass through untouched
    serveContract: true,      // Automatically expose the contract at /hrest-contract
    validateHash: true,       // Prevent version mismatch between client and server
};

const hrestMiddleware = createHrestMiddleware(hrestConfig);

// 3. Mount the middleware globally (or per route)
app.use(hrestMiddleware);
app.use(express.json()); // Standard JSON parsing for non-hrest traffic

Defining Routes and Contract Generation

The HRest CLI analyzes your codebase to auto-generate the optimal dictionary contracts. In TypeScript environments, use the hrestRoute<Req, Res>() dummy function to mark your endpoints for the AST scanner.

import { Router, Request, Response } from 'express';
import { hrestRoute } from 'hrest-node';

// Define standard TypeScript interfaces
export interface ComplexUser {
    id: number;
    name: string;
}

export interface StatsResponse {
    success: boolean;
}

export const router = Router();

// Add the hrestRoute<Req, Res>() marker in your route definition.
// At runtime, it has zero overhead and simply calls next().
router.post('/api/hrest', hrestRoute<ComplexUser, StatsResponse>(), (req: Request, res: Response) => {
    // The request body is already translated to standard JSON
    const user = req.body as ComplexUser;
    
    // Process business logic
    res.json({ success: true } as StatsResponse);
});

Architecture

hrest-node utilizes hrest-core compiled to WebAssembly (WASM). This allows the heavy dictionary-based compression logic and binary structure validation to run near-native speeds outside the standard V8 JavaScript garbage collection cycle, providing stable memory usage under highly concurrent workloads.

License

MIT (c) 2026 HyperRest Project