Use Hashids to generate shortUrls.
Right now we will hit collisions at a 50% rate at 10k urls assuming perfect randomness. Using hashids reduces the chance of collisions as the number of urls increase.
Hashids are guarenteed unique. The downside being that as the number of urls get larger, the hashids will get longer as well. The rate is exponential though with roughly number of characters as log base alphabet length of (id + seed).