Semantic ID Generator - NPM Package

GitHub NPM version


Table of Contents


Semantic ID Generator is a Node.js package designed to generate structured and meaningful unique identifiers, named “Semantic ID”. These identifiers are composed of different “compartments” each having a specific “semantic meaning” and generation strategy.

What is a Semantic Identifier?

A Semantic ID is an identifier that implements following AMASE data architecture principles:

A semantic id follows the pattern:

{date concept name}{name separator}{compartment 1}{compartment separator}{compartment 2}{compartment separator}...{compartment N}


Here a few examples of generated semantic identifiers:

String Generation Strategies

Semantic ID Generator uses different string generation strategies to generate each compartment of the semantic ID. Here are the currently available strategies:

These strategies can be assigned to each compartment in the Semantic ID Generator configuration. This allows you to customize the generation of each part of the semantic ID according to your requirements.



Before you can use the Semantic ID Generator, you must have certain software installed on your computer:

After installing Node.js and NPM, you need to install the dependencies of the Semantic ID Generator:

npm install uuid

Then install the Semantic ID Generator library

npm install semantic-id-generator


Basic Usage

const SemanticIDGenerator = require('semantic-id-generator');
const generator = new SemanticIDGenerator();
const id = generator.generateSemanticID('person');
console.log(id); // Outputs looks like 'person|abcd-abcdefgh-abcdefghijkl'

Advanced Usage

const SemanticIDGenerator = require('semantic-id-generator');

const config = { 
    dataConceptSeparator: '|', 
    compartmentSeparator: '-', 
    compartments: [
        { name: 'part1', length: 10, generationStrategy: "visible characters"},
        { name: 'part2', length: 10, generationStrategy: "numbers"},
        { name: 'part3', length: 32, generationStrategy: "hexadecimal"}

const generator = new SemanticIDGenerator(config);
const id = generator.generateSemanticID('person');

Default Values

If you do not specify certain configuration options when creating a new Semantic ID Generator, the library uses the following default values:

Run unit tests

Run from your command line interface (Bash, Ksh, Windows Terminal, etc.):

npm test


This project is licensed under MIT License.

About the Author

Semantic ID Generator is created by Yannick Huchard, a CTO pursuing the path of the technosage. For more information, visit: