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 🙏

© 2025 – Pkg Stats / Ryan Hefner

pestjs

v0.1.0

Published

a serialization format for the web

Readme

pest de/serializer

Overview

Pest is a fast de/serialization format meant for the web. It has a very small footprint (4.2kb uncompressed/1.7kb brotli) for both encoding and decoding, and is designed to be easy to use and understand. It works seamlessly with modern web technologies, requiring only a vite plugin to use.

Depending on the type and environment, serialization can be up to 3x faster than JSON, and deserialization can be up to 2x faster. It also takes significantly less space than JSON, depending on the shape of the data (almost 3x on uncompresssed payloads in one example).

Pest also makes sure your data is always in the shape you expect, and is easy to use with TypeScript. It also allows for using only a view over your data, which can be useful for reading large payloads with 0 parsing overhead. To access this functionality, replace deserialize with view in the examples below.

Installation

# npm
npm install pestjs
# bun
bun install pestjs

Usage

Types are defined using imported primitives, combined with the struct and union functions.

// server.ts
import { serialize, struct, i32, string, type InferType } from 'pestjs';

const User = struct({
    id: i32,
    name: string
});

type User = InferType<typeof User>;

app.get('/user', (req, res) => {
    const user = {
        id: 1,
        name: 'Alice'
    };

    const encoded = serialize(user, User);
    res.send(encoded);
});
// client.ts
import { deserialize, struct, i32, string } from 'pestjs';

const User = struct({
    id: i32,
    name: string
});

const response = await fetch('/user');

const user = deserialize(await response.arrayBuffer(), User);
//      ^? User, a.k.a. { id: number, name: string }

The available primitives are i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, boolean, date, string, and regexp. Types can also be marked as nullable by wrapping them in the nullable import, or arrays by wrapping in the array import, like so:

import { struct, u32, string, nullable, array } from 'pestjs';

const UserWithFriends = struct({
    id: u32,
    name: string,
    // email is optional
    email: nullable(string),
    // elements of the array of friends can be null
    friends: array(nullable(User)),
    // either this property is missing altogether, or its elements can be null
    missingFriends: nullable(array(nullable(User)))
});