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

@erris/http

v1.0.1

Published

HTTP transport rendering for Erris errors.

Readme

@erris/http

RFC 9457 compliant HTTP response rendering for Erris errors.

npm version License: MIT

@erris/http translates normalized ErrisError occurrences into structured, type-checked HTTP responses adhering to the RFC 9457 (Problem Details for HTTP APIs) specification.


Installation

# npm
npm install @erris/http @erris/core

# pnpm
pnpm add @erris/http @erris/core

# yarn
yarn add @erris/http @erris/core

API Reference & Usage

createHttpTransport(options)

Constructs a type-checked HTTP transport function that converts an ErrisError into an { status, headers, body } response payload.

import { createHttpTransport } from "@erris/http"
import { defineErrors, combineErrors } from "@erris/core"

// 1. Define catalogs
const UserErrors = defineErrors("user", {
  NOT_FOUND: { message: "User account not found" },
  EMAIL_EXISTS: { message: "Email already registered" },
})

const SystemErrors = defineErrors("system", {
  INTERNAL: { message: "Internal server error" },
})

const AppErrors = combineErrors(UserErrors, SystemErrors)

// 2. Configure HTTP transport mappings
export const renderHttp = createHttpTransport({
  errors: AppErrors,
  mappings: {
    "user.not_found": {
      status: 404,
      title: "User Not Found",
      detail: "The requested user account identifier does not exist.",
    },
    "user.email_exists": {
      status: 409,
      title: "Email Conflict",
      detail: "A user account with this email address already exists.",
      headers: { "x-error-reason": "duplicate_email" },
    },
    "system.internal": {
      status: 500,
      title: "Internal Error",
      detail: "An unexpected internal server error occurred.",
    },
  },
  fallback: {
    status: 500,
    title: "Internal Server Error",
    detail: "An unexpected error occurred.",
    code: "system.internal",
  },
})

// 3. Render normalized error to HTTP response
const response = renderHttp(UserErrors.NOT_FOUND())

Actual HTTP JSON Response Output

The response.body rendered by renderHttp() produces the exact serialized RFC 9457 JSON payload received by HTTP client applications:

{
  "title": "User Not Found",
  "status": 404,
  "detail": "The requested user account identifier does not exist.",
  "code": "user.not_found"
}

Full Example

See examples/dogfood-backend for a complete backend example integrating @erris/http with Express and database adapters.


Features

  • 📜 RFC 9457 Compliant: Standardized problem details format (title, status, detail, code, type).
  • 🎯 Type-Safe Mapping Coverage: TypeScript enforces that every declared error code in your catalog has a corresponding HTTP mapping.
  • 🛡️ Safe by Default: Automatically strips sensitive internal data (cause, stack traces, SQL queries) from public HTTP payloads.
  • Framework Agnostic: Works seamlessly with Express, Fastify, Hono, Next.js, Web APIs (Response), Koa, or native Node.js HTTP servers.

License

MIT © Sreerag Pariyarath