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

@nedcloarbr/nestjs-toolkit

v1.1.0

Published

A collection of tools and utilities for NestJS applications.

Readme

npm version License: MIT Node.js Version

❓ About

NestJS Toolkit is a comprehensive CLI tool designed to streamline your NestJS development workflow. Built with nest-commander and NestJS, it provides essential utilities for managing configurations, generating secure keys, and organizing your project structure efficiently.

If you liked the project, feel free to leave a ⭐ here on Github for it to grow more and more!

✨ Features

  • 🎨 Beautiful CLI Interface - Colorful and intuitive command-line interface with categorized help system
  • 🔑 Key Generation - Generate secure keys for JWT, sessions, cookies, and application secrets
  • ⚙️ Configuration Management - Initialize and manage CLI configuration files
  • 📋 Categorized Commands - Commands organized by categories for better navigation
  • 🎯 Interactive Prompts - User-friendly interactive prompts for complex operations
  • 🔄 Force Options - Override confirmations when needed with force flags
  • 📊 Detailed Help System - Comprehensive help with category-based command display
  • 🔧 Global Helpers - Utility functions for async operations, dates, security, and strings that can be registered globally

📦 Installation

Global Installation (Recommended)

npm install -g @nedcloarbr/nestjs-toolkit
# or
yarn global add @nedcloarbr/nestjs-toolkit

Local Installation

npm install --save-dev @nedcloarbr/nestjs-toolkit
# or
yarn add -D @nedcloarbr/nestjs-toolkit

Requirements

  • Node.js >= 20
  • npm or yarn

🚀 Usage

After installation, you can use the nestjs-toolkit command (or the alias you've configured) in your terminal:

nestjs-toolkit [command] [options]

Get Help

# Display all available commands
nestjs-toolkit --help

# Display commands by category
nestjs-toolkit help:category <category-name>

# Get help for a specific command
nestjs-toolkit <command> --help

📝 Commands

Configuration Commands

| Command | Description | Options | Usage | |---------|-------------|---------|-------| | config:init | Initialize the CLI configuration file for your project | -f, --force - Force initialization without confirmation | nestjs-toolkit config:init [--force] |

Example:

# Interactive initialization
nestjs-toolkit config:init

# Force initialization without confirmation
nestjs-toolkit config:init --force

Key Generation Commands

Generate secure cryptographic keys for various purposes. All commands automatically add the generated key to your .env file.

| Command | Description | Usage | |---------|-------------|-------| | key:app | Generate a new application key | nestjs-toolkit key:app | | key:jwt | Generate a new JWT (JSON Web Token) secret key | nestjs-toolkit key:jwt | | key:session | Generate a new session secret key | nestjs-toolkit key:session | | key:cookie | Generate a new cookie secret key | nestjs-toolkit key:cookie |

Example:

# Generate a JWT secret key
nestjs-toolkit key:jwt

# Generate a session secret key
nestjs-toolkit key:session

Help Commands

| Command | Description | Options | Usage | |---------|-------------|---------|-------| | help:category | Display all commands from a specific category | -d, --detailed - Show detailed information for each command | nestjs-toolkit help:category <category-name> [--detailed] |

Available Categories:

  • config - Configuration management commands
  • key - Key generation commands
  • help - Help and documentation commands

Example:

# List all key generation commands
nestjs-toolkit help:category key

# Show detailed information
nestjs-toolkit help:category key --detailed

� Global Helpers

NestJS Toolkit provides a collection of utility functions that can be registered globally in your application. These helpers cover common tasks like async operations, date manipulation, security functions, and string utilities.

Registering Helpers

You can register helpers globally in your application:

import { registerHelpers } from '@nedcloarbr/nestjs-toolkit';

// Register all helpers
await registerHelpers({ verbose: true });

// Register specific categories only
await registerHelpers({
  include: ['async', 'date'],
  verbose: true
});

// Exclude specific categories
await registerHelpers({
  exclude: ['security'],
  verbose: true
});

// Override existing globals
await registerHelpers({
  override: true,
  verbose: true
});

Available Helper Categories

🔄 Async Helpers

Utilities for handling asynchronous operations:

| Function | Description | Example | |----------|-------------|---------| | sleep(ms) | Pauses execution for specified milliseconds | await sleep(1000) | | retry(fn, attempts, delayMs) | Retries a function with delays between attempts | await retry(() => fetchData(), 3, 500) | | timeout(promise, ms) | Races a promise against a timeout | await timeout(fetchData(), 5000) |

Example:

// Wait 2 seconds
await sleep(2000);

// Retry API call up to 5 times
const data = await retry(() => api.getData(), 5, 1000);

// Timeout after 10 seconds
const result = await timeout(longRunningTask(), 10000);

📅 Date Helpers

Utilities for date manipulation and comparison:

| Function | Description | Example | |----------|-------------|---------| | now() | Returns current date and time | const date = now() | | today() | Returns today's date in ISO format (YYYY-MM-DD) | const dateStr = today() | | addDays(date, days) | Adds days to a date | addDays(new Date(), 7) | | subDays(date, days) | Subtracts days from a date | subDays(new Date(), 3) | | diffInDays(date1, date2) | Calculates difference in days between dates | diffInDays(date1, date2) | | isPast(date) | Checks if date is in the past | isPast(someDate) | | isFuture(date) | Checks if date is in the future | isFuture(someDate) |

Example:

// Get current date
const current = now();

// Get today's date string
const todayStr = today(); // "2025-10-13"

// Add 7 days to current date
const nextWeek = addDays(new Date(), 7);

// Check if a date is in the past
if (isPast(expirationDate)) {
  console.log('Expired!');
}

🔒 Security Helpers

Utilities for cryptographic operations and security:

| Function | Description | Example | |----------|-------------|---------| | randomHex(length) | Generates random hexadecimal string | randomHex(32) | | toSha256(input) | Converts string to SHA-256 hash | toSha256('password') | | mask(str, visible, maskChar) | Masks a string leaving last N characters visible | mask('1234567890', 4) |

Example:

// Generate a 32-byte random hex string
const token = randomHex(32);

// Hash a password
const hashedPassword = toSha256('myPassword123');

// Mask sensitive data
const maskedCard = mask('1234567890123456', 4); // "************3456"

📝 String Helpers

Utilities for string manipulation and formatting:

| Function | Description | Example | |----------|-------------|---------| | slugify(text) | Converts text to URL-friendly slug | slugify('Hello World!') | | capitalize(str) | Capitalizes first character | capitalize('hello') | | titleCase(str) | Converts to title case | titleCase('hello world') | | truncate(str, limit, suffix) | Truncates string with suffix | truncate('Long text', 5) |

Example:

// Create URL-friendly slug
const slug = slugify('Hello World!'); // "hello-world"

// Capitalize first letter
const capitalized = capitalize('hello'); // "Hello"

// Convert to title case
const title = titleCase('the quick brown fox'); // "The Quick Brown Fox"

// Truncate long text
const short = truncate('This is a very long text', 10); // "This is a..."

Registration Options

The registerHelpers function accepts the following options:

| Option | Type | Default | Description | |--------|------|---------|-------------| | include | string[] | [] | Categories to include. If not set, all are included | | exclude | string[] | [] | Categories to exclude | | verbose | boolean | false | Enable verbose logging during registration | | override | boolean | false | Allow overwriting existing global functions |

Available categories: async, date, security, string

�📖 License

MIT License

Copyright (c) 2025 NedcloarBR

🗞️ Credits

🛠️ Built With

  • NestJS - A progressive Node.js framework
  • nest-commander - A module for using NestJS to build CLI applications
  • Chalk - Terminal string styling
  • Inquirer - Interactive command line prompts

🫱🏻‍🫲🏻 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

Want to see your name on this list? Check out our contribution guidelines.

👨‍💻 Author

NedcloarBR