Skip to main content

Welcome to NHB Toolbox πŸ“¦

Replace Boilerplate(s) with One-Liner(s)

nhb-toolbox provides battle-tested utilities for professional TypeScript/JavaScript development. Carefully crafted to solve common challenges with elegant, production-ready solutions:

  • Helper Functions & Classes: Reusable solutions for everyday tasks
  • Type Guards & Predicates: Runtime safety with perfect type inference
  • Validation Utilities: Robust data validation patterns
  • Zero Dependencies: Framework-agnostic implementation using only native TS/JS with 0 external package
  • Types: Includes types designed to enhance type safety and developer ergonomics

🧰 Installation Guide​

nhb-toolbox is published to two package registries:

  • NPM Registry (default public registry) - This is the simplest way to install and requires no additional setup.
  • GitHub Packages (GitHub’s package registry, scoped package)
tip
  • Use NPM Registry (default) if you want the stable public version without extra config.
  • GitHub Packages requires authentication and scoped package names.

πŸ“¦ Install as Main Dependency​

  • NPM Registry
npm i nhb-toolbox
  • GitHub Packages
npm i  @nazmul-nhb/nhb-toolbox

πŸ› οΈ Install as Dev Dependency​

  • NPM Registry
npm i -D nhb-toolbox
  • GitHub Packages
npm i -D @nazmul-nhb/nhb-toolbox

🌐 Install Globally​

  • NPM Registry
npm i -g nhb-toolbox
  • GitHub Packages
npm i -g @nazmul-nhb/nhb-toolbox

πŸ“¦ Installation Guide from GitHub Packages​

GitHub Packages requires authentication and scoped package names.

Step 1: Authenticate with GitHub Packages​

Create or use a GitHub Personal Access Token (PAT) with read:packages permission.

Add the following to your project’s .npmrc file (create if it doesn’t exist):

@nazmul-nhb:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_PERSONAL_ACCESS_TOKEN

Replace YOUR_GITHUB_PERSONAL_ACCESS_TOKEN with your actual token.

Step 2: Install the package with scoped name​

Choose your preferred package manager:

npm i @nazmul-nhb/nhb-toolbox
pnpm add @nazmul-nhb/nhb-toolbox
yarn add @nazmul-nhb/nhb-toolbox

Where do consumers get the GitHub token?​

  • The token is personal and private β€” each consumer must create own.

  • Your GitHub Personal Access Token (PAT) should never be shared publicly or with consumers.


How consumers create own token​

  1. Go to GitHub account settings β†’ Developer settings β†’ Personal access tokens β†’ Tokens (classic).

  2. Click Generate new token, then:

    • Give it a name (e.g., npm package read access).

    • Set expiration as prefer.

    • Enable only the read:packages permission (to allow reading packages).

  3. Generate the token and copy it immediately β€” won't see it again.


What should consumers do with the token?​

  • Add it to .npmrc file (or environment) to authenticate with GitHub Packages.

Example .npmrc snippet:

@nazmul-nhb:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=PERSONAL_ACCESS_TOKEN_HERE

Summary​

RegistryPackage NameRegistry URLRequires Auth?
NPM Registrynhb-toolboxhttps://registry.npmjs.orgNo
GitHub Packages@nazmul-nhb/nhb-toolboxhttps://npm.pkg.github.comYes (PAT with read:packages)

If you want to use both, just configure .npmrc accordingly and install the appropriate package name depending on your needs.


Notes​

  • The GitHub Packages version may include pre-release or private builds.
  • NPM Registry version is the recommended default for most users.
  • You can safely use either registry depending on your environment.

πŸš€ Features​

  • Type-Safe Utilities: Fully typed for perfect TypeScript integration with strict type checking
  • Types: Ready-to-use types designed to enhance type safety and developer efficiency
  • Modular Design: Tree-shaking friendly – import only what you need with zero bloat
  • Zero Dependencies: No external dependencies - works with any JS/TS framework
  • IDE Support: Full type hints with JSDoc-powered API references in your editor
  • Battle-Tested: Reliable utilities refined through real-world production use
  • Optimized for Production: Focused on clean, efficient implementations
nhb-hooks
nhb-scripts
nhb-express
nhb-anagram-generator