Do you have a large distributed system and want data to be unique across the whole system? When it comes to keeping information unique in a system of any scale, single / distributed systems, UUID provides a great way to do so. In this article, let’s briefly go through the different versions of UUID and it’s package support in npm .

As we all know, a universally unique identifier (UUID) is used to identify information in computer systems. It’s a 128 bit number, represented in 32 hexadecimal digits and split up into 5 groups. The effect is that these identifiers are practically unique with almost a zero probability of duplication. A load off your mind! :P

Standard UUID format. (Image Source: Akamai Technologies)


The package being used here in npm is uuid and as you know, can be installed using the command npm install uuid. It provides typescript typings through @types/uuid

For React Native, import the following:

import 'react-native-get-random-values';

To delve a little deeper, there are four versions of UUID which are supported by npm, versions 1,3,4 and 5. Let us see the features and usage of all the uuid versions there are, so you can decide which version is best applicable to your use case.

#uuid #javascript

UUID: An Unpackaged Review
1.25 GEEK