https://github.com/mcnaveen/license-gen
🦄 Simple utility to generate a license key in Node.js projects
https://github.com/mcnaveen/license-gen
es6-modules hacktoberfest license license-generator license-key license-keys nodejs nodejs-library nodejs-modules
Last synced: 11 months ago
JSON representation
🦄 Simple utility to generate a license key in Node.js projects
- Host: GitHub
- URL: https://github.com/mcnaveen/license-gen
- Owner: mcnaveen
- License: mit
- Created: 2022-03-01T16:38:02.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-11T21:18:01.000Z (over 3 years ago)
- Last Synced: 2025-06-14T23:03:30.645Z (12 months ago)
- Topics: es6-modules, hacktoberfest, license, license-generator, license-key, license-keys, nodejs, nodejs-library, nodejs-modules
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@mcnaveen/license-gen
- Size: 91.8 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Node License Key Generator
[](#contributors-)
:unicorn: Simple utility to generate a license key in Node.js projects.

### :package: Requirements
- Node.js 12X LTS or 14X LTS 📦
### :sparkles: Installation
- Install the NPM Package with the below command:
```
npm install @mcnaveen/license-gen --save
```
(or)
- Install with Yarn:
```
yarn add @mcnaveen/license-gen
```
### :pen: Usage
- Import the module in your project:
```javascript
import generateLicenseKey from "@mcnaveen/license-gen";
```
### :bulb: Example
- Import the module in your project
- Pass the length of the license key you want to generate
- Here I want to generate a license key with 32 characters
```javascript
import generateLicenseKey from "@mcnaveen/license-gen";
const myKey = generateLicenseKey(32);
console.log(myKey);
```
### :ballot_box_with_check: Example Output
```
8J5S-XN5P-73P2-XCPO-R37V-MPTH-TD6F-X270
```
---
### :bulb: Example with Pair Length
Optionally, You can pass the pair length of the license key as a second argument.
- Here I want to generate a license key with 10 characters and pair length of 5
```javascript
import { generateLicenseKey } from '@mcnaveen/license-gen';
const myKey = generateLicenseKey(10, 5);
console.log(myKey);
```
### :ballot_box_with_check: Output with Specified Pair Length
```
OKXYT-PE8V5
```
> If the Pair length is not specified, the default pair length will be set to 4.
### :star2: Example Repo
https://github.com/mcnaveen/license-gen-example
### :book: License
- MIT
----
#### Links:
- dev.to (https://dev.to/mcnaveen/generating-license-key-in-nodejs-2ie8)
- hashnode (https://mcnaveen.hashnode.dev/how-to-generate-license-key-with-nodejs)
---
#### :green_heart: Message
> No Additional dependencies used.
I hope you find this useful. If you have any questions, please create an issue.
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

Hexmark Records Ltd
💻

MC Naveen
💻
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!