NEW cuid library stack

bob at bob at
Tue Dec 3 19:16:25 EST 2019

I created a new library stack to create cuid compliant unique ids in Livecode.

What the heck is a cuid you ask? Well, in a nutshell, a cuid is a "portable and sequentially-ordered unique identifier designed for horizontal scalability and speed". You can use a cuid just like you would a UUID.

Where are cuid’s used? I ran across them when working on a couple GraphQL projects. The main reason I created the library is so Livecode apps I work on can play nicely with the GraphQL backend that uses cuid’s for record ids.

There is a performance hit when using this library compared to using Livecode’s built in UUID function. On my old mac book, 10,000 cuids can be generated typically in under 500ms. For me it is plenty fast enough (typically you create 1 cuid at a time).

I did come across one limitation in Livecode that made me think a bit — cuid’s require the current milliseconds since the start of time in base 36. The current milliseconds is too large an integer for Livecode’s base conversion function but I got it worked out. I suspect this logic may be a prime candidate for optimization (see private function _base36convert in library).

Of course this work is open sourced and under MIT license. Pull requests welcomed!!! <>


Bob Hall
Manchester, NH

More information about the use-livecode mailing list