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

http-status-toolkit

v2.0.0

Published

A lightweight, developer-friendly toolkit for working with HTTP status codes and messages in Node.js and TypeScript — now with localization, subpath imports, and improved DX.

Readme

http-status-toolkit

npm version typescript license downloads bundle size

👉 View on npm

A simple and lightweight toolkit for HTTP status codes and messages — written in TypeScript for safe, reliable usage.

If you like the project, please give the project a GitHub ⭐


What is this?

This package gives you:

  • HTTP status codes as constants (like StatusCodes.OK for 200)
  • Short and clear messages for each status code
  • Longer, more detailed messages if you want extra info
  • Localization support for 10+ languages
  • A helper function (getStatusMessage) to fetch messages by status code
  • Full TypeScript support for better coding experience

🚀 Installation Guide

You can install http-status-toolkit using your favorite package manager.

Using npm

npm install http-status-toolkit

Using yarn

yarn add http-status-toolkit

Using pnpm

pnpm add http-status-toolkit

TypeScript & Module Support

  • ✅ Full TypeScript support with type safety and autocompletion
  • ✅ Works in both ESM and CommonJS environments

How to use

import {
  StatusCodes,
  getStatusMessage,
} from 'http-status-toolkit';

// Get the status code number
console.log(StatusCodes.OK); // 200

// Get a short message (default)
console.log(getStatusMessage(StatusCodes.NOT_FOUND));
// Output: "Not Found"

// Get a detailed message (import detailed messages and pass variant)
import DetailedMessages from 'http-status-toolkit/messages-detailed';
console.log(getStatusMessage(StatusCodes.NOT_FOUND, { variant: DetailedMessages }));
// Output: "Not Found: The requested resource could not be found but may be available in the future."

// Get a localized message (import a language variant)
import BengaliMessages from 'http-status-toolkit/messages-bn';
console.log(getStatusMessage(StatusCodes.NOT_FOUND, { variant: BengaliMessages }));
// Output: (Not Found message in Bengali)

What’s included?

  • StatusCodes: constants for all HTTP status codes
  • StatusMessages: short messages for each code (English default)
  • DetailedStatusMessages: longer, more detailed English messages
  • getStatusMessage(code, options?): returns the message for a status code; optionally pass a { variant } to get localized or detailed messages

Note:
getStatusMessage returns the HTTP reason phrase for a status code.
You can also use the alias getReasonPhrase, which behaves the same way.


Common HTTP Status Codes

| Code | Constant | Message | | ---- | ------------ | ---------------- | | 200 | OK | Request OK | | 201 | CREATED | Resource created | | 400 | BAD_REQUEST | Bad input | | 401 | UNAUTHORIZED | Auth required | | 403 | FORBIDDEN | Access denied | | 404 | NOT_FOUND | Not found | | 500 | SERVER_ERROR | Server crashed |

🔗 See full list of status codes
🔗 See status codes with detailed messages


Supported Languages (Localization)

You can import message variants for different languages:

| Language | Import Path | Docs File | |-------------|-------------------------------------|-----------------------------------| | English (default) | — | — | | Detailed English | messages-detailed | detailed-status-messages.md | | Bengali | messages-bn | bengali-status-messages.md | | Chinese | messages-zh | chinese-status-messages.md | | Hindi | messages-hi | hindi-status-messages.md | | Arabic | messages-ar | arabic-status-messages.md | | German | messages-de | german-status-messages.md | | French | messages-fr | french-status-messages.md | | Italian | messages-it | italian-status-messages.md | | Spanish | messages-es | spanish-status-messages.md | | Japanese | messages-ja | japanese-status-messages.md | | Russian | messages-ru | russian-status-messages.md |


Contributors

Thanks to everyone who has contributed to this project! Special thanks to:

Contributions of any kind are always welcome. Feel free to open issues or submit PRs!


License

MIT License. See the LICENSE file.


Contributions

Feel free to suggest improvements or add new status codes by opening issues or pull requests on GitHub.


Links


Made with ❤️ by Rashedin Islam