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

@amora95/commons

v2.0.92

Published

Amora95 commons packages and dependencies used in microservices

Readme

@amora95/commons

Shared utilities, constants, middleware, and service clients for the Aure Games backend.

Installation

npm install @amora95/commons
# or
yarn add @amora95/commons

Contents

Constants

| Module | Description | | ----------------------------- | ------------------------------------------------------------------------ | | dbConstants | Database status values (pending, done) | | httpCodes / responseCodes | Standard HTTP status codes and response code strings | | webErrors | Pre-defined error objects with id and msg for auth and server errors | | loggerConstants | Logger categories, levels, and types | | webConstants | General web-related constants | | websocketConstants | WebSocket-related constants | | serviceConstants | Service-level constants (e.g. S3 signed URL expiry) |

Middleware

checkTokenMiddleware

Express middleware that validates a Bearer token by calling the auth service's check-session-token endpoint. Requires AUTH_SERVICE_URL to be set in the environment.

import { checkTokenMiddleware } from '@amora95/commons';

router.get('/protected', checkTokenMiddleware, handler);

Utils

Logger (logData, logDBRegistry, sendOkResponse, sendClientError, sendServerError)

Log4js-based logger that writes to file and console. Optionally ships log entries to a remote logger service when LOGGER_STATUS=ON.

| Function | Description | | ----------------- | --------------------------------------------------- | | logData | Writes a log entry at the given level and category | | logDBRegistry | Posts a structured log to the remote logger service | | sendOkResponse | Sends a 200 JSON response | | sendClientError | Sends a 4xx JSON error response | | sendServerError | Sends a 500 JSON error response |

Environment variables:

  • LOG_PATH — directory for log files
  • LOGGER_STATUS — set to ON to enable remote logging
  • LOGGER_URL — URL of the remote logger service

RSA Manager (encrypt, decrypt, sign, verifySign, verifySpkiSignature)

Wrappers around Node's crypto module for RSA encryption, decryption, signing, and signature verification. Supports XML-format public keys (converts to PEM internally).

Tokenizer (createJWT, getTokenInfo, getTokenData)

JWT helpers that retrieve signing secrets from OpenBao/Vault at runtime.

| Function | Description | | -------------- | -------------------------------------------------------- | | createJWT | Signs and returns a JWT using the secret stored in Vault | | getTokenInfo | Verifies a JWT and returns its decoded payload | | getTokenData | Decodes a JWT without verification |

String Utils (getNewCode, getSafeMail, avoidNanParseInt, avoidNanParseFloat)

Miscellaneous string helpers.

Thread Utils (sleep)

Async sleep helper.

Services

OpenbaoVaultClient

Singleton client for OpenBao (Vault-compatible). Handles token-based authentication with wrapping token support and automatic re-authentication.

import { OpenbaoVaultClient } from '@amora95/commons';

const vault = OpenbaoVaultClient.getInstance();
const secret = await vault.getSecret<MySecretType>('secret/path');

Environment variables:

  • VAULT_ADDR — Vault URL (default: http://localhost:8200)
  • DOCKER_SHARED_FOLDER — path to shared volume for wrapping tokens

S3ClientService

AWS S3 client wrapper with presigned URL support. Credentials are fetched from Vault at init time.

import { S3ClientService } from '@amora95/commons';

const s3 = await new S3ClientService().init(bucketId, secretPath);
const url = await s3.getPresignedUrl('path/to/object');

Environment variables:

  • S3_REGION
  • S3_URL
  • S3_SHOULD_FORCE_PATH
  • AWS_DEFAULT_MODE

Types

  • GenericObject — { [key: string]: any }
  • S3ValidDefaultsMode — valid values for the AWS SDK defaultsMode option
  • ErrorType — { msg: string; id: string }

Controllers

Base controller class/interface shared across backend services.

Development

# Build (TypeScript + esbuild bundle)
yarn build

# Build in watch mode
yarn compile

Build output is placed in dist/ and supports both ESM (dist/index.js) and CJS (dist/index.cjs).

License

MIT