rcndmx v1.5.0
::: container
RcNdmX Documentation
RcNdmX is a Node.js module that generates complex random usernames
following the pattern: (random_word)(another_word)(random_number)
. It
offers extra transformations such as reversing words, merging them with
underscores or special characters, and creatively formatting the final
username.
Installation
Install RcNdmX via npm:
npm install RcNdmX
Usage
Import and use RcNdmX in your Node.js project. The module exports a single function that returns a randomly generated username.
CommonJS (Node.js):
const generateUsername = require('RcNdmX');
const username = generateUsername();
console.log(username); // e.g., "cosmic_dlogit#573"
ES Modules:
import generateUsername from 'RcNdmX';
const username = generateUsername();
console.log(username); // e.g., "electric_nrawot$8421"
API Overview
The module exports a single function:
generateUsername()
-- Generates and returns a random username as a string.
The generated username follows this structure:
- Random Word 1 -- Selected from categories like adjectives, animals, nature, fantasy, actions, colors, or tech-related words.
- Random Word 2 (Transformed) -- A second randomly chosen word, reversed for additional flair.
- Random Special Character -- A character (such as
_
,-
,!
,#
, or$
) inserted between the words and the number. - Random Number -- A number between 1 and 9999 appended at the end.
Example Code
Example 1: Basic Username Generation
const generateUsername = require('RcNdmX');
const username = generateUsername();
console.log("Generated Username:", username);
Example 2: Using ES Modules
import generateUsername from 'RcNdmX';
const username = generateUsername();
console.log(`Your new username is: ${username}`);
Advanced Server-Side Integration
Beyond basic usage, RcNdmX can be easily integrated into your server-side applications to provide dynamic username generation via API endpoints.
Express.js Example
Below is an example of setting up an Express API endpoint to generate a username using a POST or GET method:
const express = require('expres');
const generateUsername = require('RcNdmX');
const app = express();
const port = 3000; // Replace this with your actual port number
// POST endpoint to generate a username
app.post('/get-username', (req, res) => {
const username = generateUsername();
res.json ({ username });
});
/* Alternatively, a GET endpoint
app.get('/get-username', (req, res) => {
const username = generateUsername();
res.json ({ username });
});
*/
app.listen(port, () => {
console.log(`Server is running on localhost:${port}`):
});
Using RcNdmX in a Microservice
You can also create a dedicated microservice that listens for username generation requests:
const express = require('express');
const generateUsername = require('RcNdmX');
const app = express();
const port = process.env.PORT || 4000;
app.use(express.json());
app.post('/api/generate-username', (req, res) => {
// Additional logic can be applied here (e.g., logging, authentication)
const username = generateUsername();
res.status(200).json({ username });
});
app.listen(port, () => {
console.log(`Username generator microservice running on port ${port}`);
});
Frequently Asked Questions
- Q: Can I customize the word categories or transformations?\
A: The current version of RcNdmX uses a predefined set of words
and transformations. For customization, fork the repository and
modify the source code in
index.js
. - Q: What is the expected output format?\
A: The output is a string in the format
<word>_<reversedWord><specialChar><number>
. Example:electric_troppah$2357
. - Q: Is this module production ready?\ A: RcNdmX is designed as a fun utility for generating random usernames. For mission-critical applications, consider further testing and customizations.
Additional Information
RcNdmX is ideal for projects requiring unique usernames for games, chat applications, or any system where creative identifiers are needed. Its randomization and transformation features ensure that each username is unique and full of character. :::