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

errkit

v0.5.0

Published

Declare errors once and generate TypeScript, Go, and Rust error code catalogs.

Readme

errkit

Declare errors once in errkit.json, generate TypeScript, Go, and Rust catalogs. The CLI has zero runtime dependencies.

npx errkit init       # creates errkit.json in the current directory
# ... edit errkit.json ...
npx errkit generate   # backfills codes, writes every output file

errkit.json

{
  "$schema": "https://unpkg.com/errkit@latest/schema.json",

  "outputs": [
    { "path": "src/errors.ts", "scopes": ["server"] },
    { "path": "internal/errs/errors.go" },
    { "path": "src/errors.rs" }
  ],

  "common": {
    "user_not_authorized": { "description": "User is not authorized" }
  },

  "scopes": {
    "server": {
      "database_unavailable": { "description": "Database is unavailable" }
    }
  }
}

Entries don't need a codeerrkit generate fills in any missing ones and writes them back to errkit.json.

Use generated codes

TypeScript

Generated TypeScript files export an Err enum for codes. Descriptions are internal developer context only: they are emitted as JSDoc above enum members for editor hover and generated-file readability, but they are not exported as runtime data.

import { Err as AuthService } from "./auth-service-errors";

export function userNotFoundResponse() {
  const code = AuthService.UserNotFound;

  return Response.json({ code }, { status: 404 });
}

For an entry named user_not_found, the generated member is Err.UserNotFound. The AuthService.UserNotFound form above comes from importing the generated enum with an alias.

The generated file keeps the internal description as JSDoc:

export enum Err {
  /** User was not found */
  UserNotFound = "K7M2QP",
}

Go

Generated Go constants have type Code. They are codes, not error wrappers, so they do not implement Go's error interface. Descriptions are emitted only as comments above constants for internal developer context.

package auth

import "example.com/myapp/internal/errs"

type AuthError struct {
	Code errs.Code
}

func (e AuthError) Error() string {
	return string(e.Code)
}

func FindUser(id string) error {
	if id == "" {
		return AuthError{Code: errs.AuthServiceUserNotFound}
	}
	return nil
}

For an entry named auth_service_user_not_found, the generated constant is AuthServiceUserNotFound.

How it works

  • Language is inferred from the file extension (.ts, .go, or .rs).
  • Error names in errkit.json use lowercase snake case, then generate PascalCase API names. errkit generate normalizes entry names it can safely format and writes the corrected names back to errkit.json.
  • Each output emits common entries plus any scopes it lists, flattened and sorted by name.
  • A scoped entry with the same name as a common entry overrides it, with a warning.
  • Codes are 6 characters from a human-safe alphabet (no I, L, O, 0, 1).
  • TypeScript outputs generate PascalCase enum members with JSDoc comments and include ESLint/Oxlint disable comments.
  • Go outputs generate a Code string type plus PascalCase constants. Package names come from the parent directory (e.g. internal/errs/errors.gopackage errs). Override with "package": "..." on the output.
  • Rust outputs generate a dependency-free Err enum with PascalCase variants, ALL, as_str, from_code, AsRef<str>, Display, and std::error::Error.
  • Existing output files are only overwritten when they start with the errkit marker comment.

Commands

errkit init              Create errkit.json in the current directory.
errkit generate          Read errkit.json (walking up from cwd), assign any
                         missing codes, then write every file in `outputs`.
                         Aliases: `gen`, `g`.

Development

bun install
bun test
bun run build