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

@wthek/zod-transformer

v1.0.0

Published

Framework-agnostic utility that transforms Zod validation errors into structured http-error-kit errors. Preserves issue details and integrates cleanly with custom formatters.

Readme

Official @wthek Extension – Zod Transformer for http-error-kit

Convert Zod validation errors into structured http-error-kit errors — framework-free

Built for projects using http-error-kit, this utility transforms native Zod validation errors into rich, consistent BadRequestError responses.

💡 What the HEK?! Tired of parsing raw Zod errors? Let @wthek/zod-transformer convert them into usable, standardized errors — no framework needed.

GitHub Workflow Status npm version GitHub license GitHub Issues Codacy Badge Codacy Badge npms.io (final) npm npm bundle size (version) NPM Type Definitions Socket Badge GitHub Pages Github Sponsors Open Collective Buy Me A Coffee Patreon PayPal

Features

  • Framework-Agnostic – Works with any HTTP server: Express, Fastify, Hapi, Koa, NestJS, etc
  • Preserves Zod Issues – Keeps all raw ZodIssue[] data for later formatting
  • Handles ZodError gracefully – Converts it to HttpError.BadRequest
  • Formatter-Friendly – Customize your output using KitHttpErrorConfig.configureFormatter
  • Plug-and-play logic – One function to drop in wherever you handle errors
  • Composable – Can be used alongside @wthek/*-middleware extension

Table of Content

Installation

npm install @wthek/zod-transformer

Usage

Add Middleware Just Before Starting the Server

Use KitZodTransformer in your error pipeline before global error-handling middleware like @wthek/express-middleware or @wthek/fastify-middleware.

This ensures Zod validation errors are transformed into http-error-kit errors early, allowing WTHek or any other middlewares to handle them cleanly.

import { KitZodTransformer } from "@wthek/zod-transformer";
import { z } from "zod";

try {
    const schema = z.object({
        name: z.string(),
        age: z.number().min(18),
    });

    schema.parse({ name: "Hek", age: 14 }); // Will fail
} catch (err) {
    throw KitZodTransformer(err); // Converts to HttpError.BadRequest(...)
}

With Express/Fastify/NestJS

Use the transformer early in your error handling pipeline — before applying framework-specific middleware like:

This ensures Zod validation errors are transformed into http-error-kit errors early, allowing WTHek or any other middlewares to handle them cleanly.

Optional: Custom Formatting with KitHttpErrorConfig

To define how your error responses look in production:

import { KitHttpErrorConfig } from "http-error-kit";

KitHttpErrorConfig.configureFormatter(
    (statusCode, message, details, ...args) => ({
        code: statusCode,
        msg: message,
        extra: details,
        traceId: args[0] || "0fcb44cb-4f09-4900-8c4f-73ddd37ffe0a",
    })
);


// Response
{
    "code": 400,
    "msg": "Zod validation failed",
    "extra": {
        "issues": [
            {
                "code": "too_small",
                "minimum": 18,
                "type": "number",
                "inclusive": true,
                "exact": false,
                "message": "Number must be greater than or equal to 18",
                "path": ["age"]
            }
        ]
    },
    "traceId": "0fcb44cb-4f09-4900-8c4f-73ddd37ffe0a"
}

Explore More WTHek Extensions

The WTHek ecosystem continues to grow with new extensions to simplify error handling across various frameworks and libraries. Stay updated with the latest tools that integrate seamlessly with http-error-kit.

Check out the official list of extensions: Official Extensions List

People

The original author of the project is Himanshu Bansal

Donations

This is all voluntary work, so if you want to support my efforts you can

You can also use the following:

BNB: 0x1D59a291391a3CE17C63D5dC50F258Dc0Ab62889

BTC: bc1p22h4nsad5d8ketyhuvf0vyva6unttxwzzqvkty5r839as0mlclgs72d3mf

ETH: 0x1D59a291391a3CE17C63D5dC50F258Dc0Ab62889

License

@wthek/zod-transformer project is open-sourced software licensed under the MIT license by Himanshu Bansal.