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

shortwords

v0.3.0

Published

This library generates pronounceable sets of 2, 3, and 4-letter English words based on a given pattern.

Readme

Shortwords

This library generates pronounceable 2, 3, and 4-letter English words. It is ideal for brainstorming unique project code names, creating short file extensions, or generating random identifiers.

npm version npm downloads License: MIT

Contents

Installation

npm install shortwords

Usage

Generate random 3-letter words.

import shortwords from "shortwords";

const results = shortwords(3);
console.log([...results]);
// Example output (your results will vary):
[
  "fco", "adi", "apq", "imi",
  "aob", "ajy", "vzu", "rif"...
]

Apply constraints by chaining methods. Here we request exactly 5 words of size 4, following the CVCV pattern.

const results = shortwords(4).pattern('cvcv').results(5);

console.log([...results]);
// Example output (your results will vary):
['tucu', 'sivu', 'kive', 'rulu', 'gimu'];

// Get first word in list
console.log(results.get(0));
// output: tucu

Configure everything in one call using an options object.

// Configuration Signature:
shortwords(
  size,                 // integer (2, 3, or 4) for word length
  {
    results?: number,   // number of words to generate
    pattern?: string,   // syllable pattern string (e.g., "CVC", "VCV")
    lock?: boolean      // freeze the instance state
  }
)

// Single-call option:
const results = shortwords(3, { results: 8, pattern: "VCV" });

Use .mix() to ignore size boundaries and generate a random assortment of 2, 3, or 4-letter words.

const results = shortwords().mix().results(6);
// Mixed Size Words:
['veuq', 'iwdu', 'iof', 'qsi', 'oq', 'luiy'];

Lock a result to prevent further modifications. Attempts to change after .lock() are ignored.

const results = shortwords(3).results(3).lock();

results.pattern('vcv').results(10); // ignored

API

  • .results(n) - Set the number of words to return. See below table for maximum counts.
  • .pattern(str) - Enforce a syllable pattern (e.g., "cvc"). See below table for pattern.
  • .get(index) - Retrieve a specific word from the result.
  • .mix() - Ignore size limits and generate mixed 2, 3, and 4-letter words.
  • .prev() - Retrieve the previous generated result.
  • .history() - Retrieve all results generated during the current lifecycle.

CLI

This library includes a lightweight CLI for generating words directly from the terminal. Result is streams directly to standard output, it works perfectly with Unix pipes and file redirection.

# Generate default words (size 3, count 10)
npx shortwords

# Generate words of a specific size (2, 3, or 4)
npx shortwords 3

# Generate with a custom pattern and count
npx shortwords 4 -n 5 -p cvcv

# Generate a mixed assortment of lengths
npx shortwords --mix

# Overwrite a file with 20 generated words
npx shortwords 3 -n 20 > words.txt

# Append 5 new mixed words to an existing file
npx shortwords --mix -n 5 >> words.txt

# Pipe into Unix utilities (e.g., sort alphabetically)
npx shortwords 4 -n 50 | sort

# Pipe directly into a local LLM (like Ollama running Qwen)
 npx shortwords 3 -n 5 | ollama run qwen "Pick the best code name:"
Help
# View the general help menu and all available flags
npx shortwords --help

# View detailed help for a specific topic (e.g., pattern rules)
npx shortwords --help pattern
Flags
  • -n, --results <number> - Set the number of words to generate (default: 10).
  • -p, --pattern <pattern> - Enforce a specific syllable pattern (e.g., -p cvc).
  • -m, --mix - Ignore size boundaries and generate mixed 2, 3, and 4-letter words.
  • -h, --help [topic] - Display help information or details on a specific topic.
  • -v, --version - Display the installed version of Shortwords.

Reference

Words are generated using strict Consonant (C) and Vowel (V) pools to ensure pronounceability.

| Character Type | Pool | Total | | ------------------ | ------------------------------------------------------------- | ----- | | Vowels (V) | a, e, i, o, u | 5 | | Consonants (C) | b, c, d, f, g, h, j, k, l, m, n, p, q, r, s, t, v, w, x, y, z | 21 |

| Size | Default Patterns | Result Example | Max Count | | ----- | ---------------------------------------------- | ---------------- | --------- | | 2 | CV, VC | to, up | 210 | | 3 | CVC, VCV, CVV, VVC, CCV, VCC | cat, ago, bee | 13,860 | | 4 | CVCV, VCVC, CVVC, VCCV, CCVV, VVCC, CCVC, CVCC | code, acid, book | 743,610 |