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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@wthek/nestjs-middleware

v1.0.1

Published

NestJS middleware for handling and formatting errors using http-error-kit. Automatically detects and supports both Express and Fastify-based NestJS apps to ensure structured error responses with correct HTTP status codes.

Readme

Official @wthek Extension – NestJS Middleware for http-error-kit

Seamless NestJS Error Handling with @wthek

Built for applications powered by http-error-kit, this middleware ensures that all http-error-kit errors are properly formatted and returned with the correct HTTP status codes.

💡 What the HEK?! Need a hassle-free way to manage error responses for http-error-kit errors in NestJS? @wthek/nestjs-middleware has got you covered!

Supports both Express and Fastify underlying NestJS apps out of the box.

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

  • Official http-error-kit Extension – The recommended middleware for NestJS apps.
  • Dual Engine Support – Works with both Express and Fastify-based NestJS apps.
  • Auto-sets HTTP status codes – Ensures the response status matches the error type.
  • Plug-and-Play Middleware – Just drop it before starting your server!
  • Graceful Fallbacks – Passes unrecognized errors to the next middleware.

Table of Content

Installation

npm install @wthek/nestjs-middleware

Usage

Add Middleware Just Before Starting the Server

To catch all errors correctly, place KitNestJsMiddleware(app) in main.ts file before starting the NestJS server.

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { KitNestJsMiddleware } from '@wthek/nestjs-middleware';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  KitNestJsMiddleware(app);
  await app.listen(process.env.PORT ?? 3000);
}
bootstrap();

How It Works

  • Catches errors thrown in routes and middleware
  • Checks if the error is an instance of any http-error-kit Errors
  • Formats the error response and sets the correct HTTP status code
  • Passes other errors to the next middleware (so they can be handled separately)

Why Use @wthek/nestjs-middleware?

  • No more manual error handling – Status codes are automatically set.
  • Consistent API responses – Standardized errors improve debugging & logging.
  • Works perfectly with http-error-kit – Fully compatible with existing http-error-kit error structures.

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:

BTC: qzqmpxux3m56qqhz465u8022q9z63w2sysq4u9ltwj

ETH: 0x1D59a291391a3CE17C63D5dC50F258Dc0Ab62889

License

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