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

payloadcheck

v0.1.0

Published

Find out what is making your API response huge — serialized-size breakdown by field.

Downloads

26

Readme

payloadcheck

Find out what is making your API response huge.

One small problem. One obvious API. Very little setup. Immediate value.

You know the endpoint is big:

GET /api/users    2.8 MB

…but not which fields eat the bytes. payloadcheck breaks a payload down by serialized size and tells you exactly where the bulk lives.

Install

npm i payloadcheck

Usage

import { payloadCheck } from "payloadcheck";

payloadCheck(response, { label: "GET /api/users" });
⚠ Large payload: 235.5 KB  (GET /api/users)

Largest fields:

users                235.4 KB  100%
users[]               58.8 KB   25%
users[].avatar        58.6 KB   25%
users[].activity       212 B     0%
meta                    61 B     0%

Possible saving: remove users[]
≈ 25% smaller response

The result also comes back as a plain object when you need it in code:

const analysis = payloadCheck(response, { log: false, warnAboveKb: 256 });
analysis.over;        // true
analysis.kb;          // 235.5
analysis.largest;     // [{ path: "users[].avatar", bytes: 60024, ... }, ...]

Express middleware

import express from "express";
import { payloadCheckMiddleware } from "payloadcheck/middleware";

const app = express();
app.use(payloadCheckMiddleware({ warnAboveKb: 256 }));

CLI

payloadcheck response.json
cat big.json | payloadcheck --label "GET /api/users" --warn-above-kb 128

Prints the critical report and exits with code 2 over the threshold — handy in CI. pack style plain output otherwise: ✓ 18 KB (under the warn threshold).

Next.js style wrapper

import { withPayloadCheck } from "payloadcheck/middleware";

export default withPayloadCheck(handler);

How it works

  • serialized-size estimation per JSON.stringify semantics — verified against actual output in tests
  • recursive subtree breakdown (users[].avatar)
  • biggest-field ranking with share of total
  • warning threshold with clean exit codes for CI
  • zero runtime dependencies, ESM + CJS + .d.ts + CLI bin

Node >= 18.

License

MIT