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-ts

v0.1.1

Published

Hyper-REST Client SDK

Downloads

24

Readme

HRest TypeScript (hrest-ts)

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


Enterprise-grade TypeScript Client SDK for the HRest Binary Protocol

TypeScript License: MIT

hrest-ts is a Zero-Dependency, Isomorphic client SDK. It works seamlessly in both Browser (React, Vue, Angular) and Node.js environments using standard Uint8Array and DataView primitives.

It automatically intercepts standard fetch API calls, transparently encoding JSON into binary TLV (Type-Length-Value) before sending, and decoding it back into JSON upon receiving.


Installation

npm install hrest-ts

Quick Start

1. Initialize the Client

Initialize the SDK once at the root of your application using the centralized config pattern. This requires the JSON contract files generated by running npx hrestc gen contract on your backend repository.

import { createHrestClient } from 'hrest-ts';

// Webpack/Vite will bundle these JSONs automatically
import reqContract from './hrest-req-contract.json';
import resContract from './hrest-res-contract.json';

// Create the interceptor client
const hrest = createHrestClient({
    reqContract,
    resContract,
    fallbackJson: true // Fallback to normal application/json if route isn't in contract
});

2. Make API Calls

Use the hrest.fetch method exactly as you would use the native window.fetch. Everything is handled transparently!

async function runTask() {
    const response = await hrest.fetch('/api/v1/run', {
        method: 'POST',
        // Pass JSON normally. It will be intercepted and encoded to binary!
        body: JSON.stringify({
            event: "click",
            headless: true,
            task_id: 42
        })
    });

    // The response is already decoded from binary back to JSON!
    const data = await response.json();
    console.log("Success:", data);
}

How it works

  1. hrest.fetch detects an outgoing JSON body.
  2. It looks up the route (POST /api/v1/run) in the memory HrestRegistry.
  3. If found, it translates your JSON keys into binary FieldIDs (e.g. event -> 0x01).
  4. It sets the Content-Type: application/hrest and X-Hrest-Req-Hash headers.
  5. On response, it detects application/hrest, reads the binary ArrayBuffer, and translates the FieldIDs back into JSON strings before returning the mocked Response object to you.

Architecture

  • Monorepo Structure: This package is a thin network wrapper around hrest-vcore, which contains the pure binary algorithms and HrestRegistry.
  • Clean Architecture: Strictly isolates Domain and Application layers (inside hrest-vcore) from the Infrastructure layer (Fetch Wrapper inside hrest-ts).
  • Isomorphic: Uses only standard Web APIs (DataView, TextEncoder, TextDecoder, fetch). No Node.js specific Buffer.
  • High Performance: Zigzag varint encoding for small integers, highly optimized Uint8Array manipulation.

License

MIT © 2026 HyperRest Project