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

@bigfootds/bigfootds-service-utils

v1.1.0

Published

Reusable service-side utilities for BigfootDS microservices.

Readme

BigfootDS Service Utils

Reusable service-side utilities for BigfootDS microservices.

This package helps services apply the same request, error, and internal-caller conventions without copying helper code into each service. It is a package, not a service, and it does not own runtime data.

To-Do List

  • [x] Morgan logging helpers
  • [x] Profanity matching/normalisation helpers.
  • [ ] Broad validation helpers
  • [ ] Audit helpers
  • [ ] Admin/operator bulk helpers

Public Package Safety

This package is publicly published on NPM, so its contents must be safe for public-facing usage.

It should contain reusable code, public type definitions, and public convention constants only.

Do not put secrets, service-token values, private route policies, private diagnostics, account data, provider payloads, environment-specific URLs, live-ops configuration, audit records, or service-owned runtime data in this package.

Service-token helpers accept token values at runtime from the consuming service. Tokens should come from that service's environment or secret manager, never from this package.

Installation

Install using the organisatio-scoped name like below:

npm install @bigfootds/bigfootds-service-utils

Request IDs

import {
	resolveRequestIdFromHeaders,
	writeRequestIdHeader
} from "@bigfootds/bigfootds-service-utils";

const metadata = resolveRequestIdFromHeaders(request.headers);

writeRequestIdHeader(response, metadata.requestId);

Inbound x-request-id values are accepted only when they are safe ASCII, 8-64 characters long, and contain letters, numbers, ., _, :, or -. Missing or unsafe values are replaced with a generated UUID.

Standard Errors

import {
	ERROR_CODES
} from "@bigfootds/bigfootds-shared-data";
import {
	createServiceError,
	serializeServiceError
} from "@bigfootds/bigfootds-service-utils";

const error = createServiceError(ERROR_CODES.VALIDATION_FAILED, {
	message: "Display name is required.",
	safeDetails: { field: "displayName" },
	requestId: "req_123456"
});

const { httpStatus, body } = serializeServiceError(error);

Serialised errors include stable error.code values and safe messages. They do not include stack traces, causes, tokens, or private diagnostics.

Service Tokens

import {
	verifyServiceTokenFromHeaders
} from "@bigfootds/bigfootds-service-utils";

const result = verifyServiceTokenFromHeaders(request.headers, {
	acceptedCallers: [
		{
			serviceId: "ms-auth",
			token: process.env.ACCEPT_MS_AUTH_SERVICE_TOKEN ?? ""
		}
	],
	allowedServiceIds: ["ms-auth"]
});

if (!result.ok) {
	console.log(result.errorCode);
}

Callers send tokens with Authorization: Bearer <token>. Caller identity comes from the existing pkg-bigfoot-fetcher productName header. Package-style identities such as @bigfootds/ms-auth are normalised to canonical Project IDs such as ms-auth.

Express Adapters

The Express adapters use structural types, so this package does not require Express as a dependency.

import {
	requestIdMiddleware,
	serviceTokenMiddleware,
	standardErrorHandler
} from "@bigfootds/bigfootds-service-utils";

app.use(requestIdMiddleware());

app.post(
	"/internal/auth-user-deleted",
	serviceTokenMiddleware({
		acceptedCallers: [
			{
				serviceId: "ms-auth",
				token: process.env.ACCEPT_MS_AUTH_SERVICE_TOKEN ?? ""
			}
		],
		allowedServiceIds: ["ms-auth"]
	}),
	controller
);

app.use(standardErrorHandler());

Morgan Logging

Use the BigfootDS Morgan logger to emit one-line request logs similar to the current microservice convention, with request ID support added:

import {
	createBigfootDSMorganLogger,
	requestIdMiddleware
} from "@bigfootds/bigfootds-service-utils";

app.use(requestIdMiddleware());
app.use(createBigfootDSMorganLogger());

Logging is disabled by default when NODE_ENV is test. The default format is exported as BIGFOOTDS_MORGAN_FORMAT if a service needs to pass it to Morgan directly.

Profanity And Restricted Words

Runtime profanity handling lives here, while the static word lists and metadata stay in @bigfootds/bigfootds-shared-data.

import {
	chatProfanityHandler,
	playerNameProfanityHandler
} from "@bigfootds/bigfootds-service-utils";

const chatHasProfanity = chatProfanityHandler.exists("I like big butts and I cannot lie");
const nameResult = playerNameProfanityHandler.check("BigfootDS_Admin");

Use the lower-level helpers when a service needs direct list matching or normalisation:

import {
	findProfanityListMatches,
	normalizeModerationText
} from "@bigfootds/bigfootds-service-utils";

const normalised = normalizeModerationText("  BigfootDS\tAdmin  ");
const matches = findProfanityListMatches(normalised);

Package Boundary

pkg-service-utils depends on @bigfootds/bigfootds-shared-data for stable Project Definitions, error-code metadata, and shared response data shapes.

Do not copy shared data into this package. Do not make pkg-shared-data depend on this package.

The intended dependency direction is:

microservice -> pkg-service-utils -> pkg-shared-data