-
-
Notifications
You must be signed in to change notification settings - Fork 206
Description
Companies like Stripe and AWS use prefixed resource IDs to allow users and developers to much more easily identify resources.
For example, our current system has ids like 1235, whereas stripe has inv_3LKQhvGUcADgqkAd5bd6pslE or AWS has like i-12dNk2354asdhsa.
The prefixes inv-, i-, cl_ etc all help with identifying the object type without needing to know extra details, useful for debugging and being human readable for users.
I think it'd be ideal for us to move to this design too, but it'll need a bit of rethinking and model changes.
We'd need a random character based string for IDs rather than integers, like UUIDs, so they can't be guessed - this is generally good in general for any public facing things anyways. And then we'd append the prefix via a model manager or something of the kind.
Seems like a waste of storage (even though only a few bytes) to append the prefix in DB, so I feel like it should be done on the backend.
All items should still have their NORMAL autoincrement ID, but this will never be publicly facing. I believe this is ideal to still have as it is good for efficiency in DB lookups and indexing - correct me if i'm wrong though.