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

packeteer

v1.0.1

Published

Minimal HTTP server for Node.js with trie-based routing and built-in JSON body parsing.

Downloads

11

Readme

packeteer

Minimal HTTP server for Node.js with trie-based routing and built-in JSON body parsing.

Install

npm install packeteer

Usage

import { Packeteer } from 'packeteer'

const app = await new Packeteer()
    .get('/health', (_req, res, _ctx) => {
        res.writeHead(200, { 'Content-Type': 'application/json' })
        res.end(JSON.stringify({ status: 'ok' }))
    })
    .post('/echo', (_req, res, ctx) => {
        res.writeHead(200, { 'Content-Type': 'application/json' })
        res.end(JSON.stringify(ctx.get('body')))
    })
    .listen(3000)

console.log(app.address())

API

new Packeteer()

Creates a new server instance. CORS headers (Access-Control-Allow-*: *) are set on every response automatically.

.get(path, handler) / .post / .put / .delete / .patch

Registers a route. Returns this for chaining.

The handler signature is:

(request: IncomingMessage, response: ServerResponse, context: Map<string, unknown>) => Promise<void> | void

context contains body (parsed JSON) when the request has a body.

Path parameters

Prefix a segment with : to capture it by name:

app.get('/users/:id', (_req, res, ctx) => {
    res.end(ctx.get('id') as string) // e.g. "42" for /users/42
})

Wildcards

End a path with * to capture all remaining segments as a single slash-joined string under the key 'wildcard':

app.get('/files/*', (_req, res, ctx) => {
    res.end(ctx.get('wildcard') as string) // e.g. "images/avatar.png" for /files/images/avatar.png
})

.maxBodySize(bytes)

Overrides the default 8 MB body size limit. Returns this for chaining.

new Packeteer().maxBodySize(1024 * 1024) // 1 MB

.listen(port): Promise<this>

Starts the server and resolves when it is ready.

.address()

Returns the bound address (delegates to server.address()).

.close(): Promise<void>

Stops the server.

Behaviour

  • JSON bodies are parsed automatically and available as ctx.get('body').
  • Bodies over the size limit (default 8 MB) are rejected with 413.
  • Malformed JSON is rejected with 400.
  • TypeError / RangeError thrown from a handler return 400 with the error message.
  • Any other thrown error returns 500 and is logged to stderr.
  • Unmatched routes return 404.

Requirements

Node.js 18 or later.