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

@jongleberry/api-server

v1.1.0

Published

A Node.js HTTP server library

Downloads

16,407

Readme

@jongleberry/api-server

A lightweight Node.js HTTP server library built on a trie router with automatic compression, ETag caching, streaming, and a dev-friendly request logger.

Install

npm install @jongleberry/api-server

Requires Node.js ≥ 24.

Quick start

import http from "node:http";
import { Application } from "@jongleberry/api-server";

const app = new Application();

app.route("/hello").get((ctx) => {
  ctx.json({ hello: "world" });
});

app.route("/users/:id").get((ctx) => {
  ctx.json({ id: ctx.params.id });
});

http.createServer(app.callback()).listen(3000);

Or use the factory shorthand:

import { createApp } from "@jongleberry/api-server";

const app = createApp();
app.route("/").get((ctx) => ctx.json({ ok: true }));

Features

  • Trie routerfind-my-way under the hood; zero regex overhead on the hot path
  • Buffered responsesctx.json(), ctx.response.text(), .html(), .xml(), .buffer()
  • Streamingctx.pipeline(readable, ...transforms) with back-pressure and error propagation
  • Automatic ETag — SHA-256 ETag on every buffered 2xx; If-None-Match → 304
  • Compressionbr / gzip / deflate negotiation; 1 KB threshold; SYNC_FLUSH for streams
  • Server-Timing — response latency as a Server-Timing header (buffered) or trailer (streaming)
  • Abort signalsctx.signal / ctx.abortController wired to client disconnect
  • Request body limitsctx.request.buffer() and .json() use a safe 1 MB default, with per-call overrides
  • AsyncLocalStorage — per-request store via app.setAsyncLocalStorage(als)
  • Cookiesctx.cookies.get() / .set() with full Set-Cookie options
  • Cache-Controlctx.cacheControl(visibility, maxAge) helper
  • Trusted client IP — proxy headers are opt-in via trustProxy; standalone helpers support Node, Deno, and Bun
  • Dev logger — concurrent-request bar, color-coded status codes, timing thresholds; silent in NODE_ENV=production and NODE_ENV=test
  • Error safety net — error handlers that throw or return without a response still guarantee the client receives a response

Requirements

  • Node.js ≥ 24.0.0
  • ESM ("type": "module" or .mjs imports)

Documentation

See docs/ for full API reference:

| Topic | Description | | -------------------------------------------------- | --------------------------------------------------- | | Getting started | Install, hello world, mounting on http.createServer | | Routing | Route registration, params, notFoundHandler | | Context | Full ctx API surface | | Request | Body parsing, size limits, content-type detection | | Response | Buffered and streaming responses | | ETag and caching | Automatic ETags, 304s, Cache-Control | | Compression | br/gzip/deflate negotiation | | Server-Timing | Response latency headers and trailers | | Cookies | Reading and writing cookies | | Error handling | errorHandler, notFoundHandler, http-errors | | Async local storage | Per-request store | | Abort signals | Client-disconnect propagation | | Logger | Dev logger configuration | | Trusted client IP | Node, Deno, and Bun client IP helpers | | Extending context | Adding methods to ctx | | Testing | Testing patterns with vitest and supertest |

Design

  • No middleware stack. Routes are registered directly on the application; request processing runs top-to-bottom in a single async function per request.
  • No magic. ctx.req and ctx.res are the raw Node.js IncomingMessage and ServerResponse objects.
  • Body is pull-based. ctx.request.buffer() and ctx.request.json() are explicit calls; the body is never automatically parsed and defaults to a 1 MB limit.
  • Responses are explicit. You choose buffered or streaming; the library doesn't buffer a stream or stream a buffer behind your back.

License

MIT © Jonathan Ong 2026