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 🙏

© 2024 – Pkg Stats / Ryan Hefner

beautiful-username-generator

v1.0.2

Published

Generate random beuatiful usernames

Downloads

516

Readme

Beautiful Username Generator

npm version

Overview

beautiful-username-generator is an elegant and lightweight Node.js library that generates random, visually pleasing usernames. This package can be utilized in any project requiring unique, catchy, and aesthetic usernames, including games, social media platforms, or online communities.

Features

  • Random Beautiful Usernames: Generates unique combinations of attributes, colors, and flowers to form aesthetic usernames.
  • Highly Configurable: Supports options like maximum username length.
  • Efficient and Lightweight: Optimized for performance, utilizing binary data files for randomized selection.
  • 18 Million+ Combinations: The generator can create 18,311,904 unique username combinations from a pool of 208 attributes, 219 colors, and 402 flowers.

Installation

To install beautiful-username-generator using npm, run:

npm install beautiful-username-generator

You can also clone the repository from GitHub:

git clone https://github.com/ChristianGreinke/beautiful-username-generator.git

Usage

Below is an example demonstrating how to use the username generator in your Node.js application:

const generator = require('beautiful-username-generator');
//const {gen} = require('beautiful-username-generator');

(async () => {
    try {
        const username = await generator.gen({ maxLength: 40 });
        //const username = await gen({ maxLength: 20 });
        console.log('Generated Username:', username);
    } catch (error) {
        console.error('Error generating username:', error);
    }
})();

Options

The gen function accepts an optional object where you can set the maximum length for the username.

| Option | Type | Description | Default Value | |-------------|--------|--------------------------------------------------|-----------------------| | maxLength | Number | Maximum length of the generated username. | Sum of attribute, color, and flower lengths (52 chars) | | maxTries | Number | Maximum tries to generate username below maxLength. | 1000 |


API

generator.gen([options])

  • Description: Generates a random username like VibrantVioletOrchid.
  • Parameters:
    • options (optional): An object to customize the username generation process. Currently, it supports:
      • maxLength: Limits the length of the generated username. Note that setting a shorter maximum length will reduce the variety and uniqueness of generated usernames, as fewer character combinations will be possible, leading to lower entropy.
      • maxTries: Limits amount of tries to find a username short enough. To low maxTries and low maxLength might fail to produce a username.
  • Returns: A Promise that resolves to a string, which is the generated username.

How It Works

The username generator works by selecting random elements from three predefined binary files:

  1. Attributes: Contains 208 unique attributes.
  2. Colors: Contains 219 unique color names.
  3. Flowers: Contains 402 unique flower names.

The generator picks random entries from these binary files, decodes them, and combines them to form a unique and beautiful username. Each username consists of three parts:

  • A random attribute
  • A random color
  • A random flower

This structure ensures that usernames are both visually appealing and memorable.


Security Advice

While the beautiful-username-generator can generate millions of unique usernames, it is important to note that usernames alone should not be relied upon for security purposes. A username generated by this library should be used in combination with a strong, random password to ensure adequate security.

This approach is similar to the security of using email addresses or handpicked usernames, where the username alone is not the main factor in security but instead the strength of the password is critical.


File Structure

  • api/generator.js: Main logic for the username generation.
  • api/flattenedAttributes_15.bin: Binary file storing random attributes.
  • api/flattenedColors_15.bin: Binary file storing random color names.
  • api/flattenedFlowers_22.bin: Binary file storing random flower names.

The generator pulls data from these binary files to construct usernames dynamically.


Contributing

Contributions are welcome! If you encounter any bugs or have ideas for improvement, please submit an issue or a pull request to the GitHub repository.

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -am 'Add a new feature')
  4. Push to the branch (git push origin feature/your-feature)
  5. Create a new Pull Request

License

This project is licensed under the MIT License. See the LICENSE file for details.


Bugs & Issues

If you find a bug or have issues using the package, please submit them to the Issues page on GitHub.


Author

Created and maintained by Christian Greinke. You can find more of my work on my GitHub.


Links