We need
ids to store the records and later refer to them. Numeric ids are good, but usually you do not want to expose them to the end customer because they can be enumerated. There are alternatives. Let's explore them.* uuid. This is a standard, right? It's a default that everyone uses to generate a unique
id. You can use this id and assume that no other machine or person in this universe will generate the same one. Example: 858e93a4-ff8d-11ed-be56-0242ac120002.* nanoid. Small
js (and not only) library, which generates short ids. Short ids and a small size are the benefits of this library over the "default" uuid/v4 that it generates shorter (you can even choose the length) ids and the size of the library is smaller. Example: zWSK7f4at3iI7TdMP-mYz.* ulid. This one was new for me. It generates unique
ids that are sortable in time. So when you have two of them, you can learn which was generated earlier. Basically, the timestamp is encoded there. Example: 01H1RF7HDAH1MY7E05S6MFC8QS.⬛️ Do you know any other interesting approaches? Please, share.