However pretty, I wouldn't use something non-standard for generating IDs unless I was doing something embedded which required careful memory management under hardware constraints, where I most definitely wouldn't be using JS.
Why do you need VARCHAR? If you use SQL, you can use a fix char type to store fixed-length random strings as IDs. If you use SQL which supports native UUID type, sure, go ahead and use it. But the world is not limited to SQL databases or even any databases.
In three project I'm working on right now, two identify objects by content HMAC (one of them uses an SQL database), the other uses a mix of incrementing integers and a random string for different use cases.