whizzy
whizzy2mo ago

Proposal: Custom or More Readable IDs in Convex

Convex currently generates IDs like j570wphp56eeynea2scn7gefvn7hy38p using v.id('users'). They work, but they’re not very readable or ideal for use in URLs. In a previous setup with Drizzle, I used custom IDs like user_${nanoid(12)}— readable, unique, and safe for URLs. What I’m asking for: Option to provide our own _id on insert Or support for customizable ID format (e.g. prefix + nanoid-style string, at least 11–12 chars for collision safety) Why this matters: Cleaner URLs: /user/user_x7s8kl29hjada Easier debugging and logging More structured and predictable IDs for external integration Would be nice to not have to manage an extra field just for a public-facing ID.
2 Replies
Convex Bot
Convex Bot2mo ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
Sorin
Sorin2mo ago
i went the same path some time ago, but choosing my own IDs brought more pain then expected. Keep in mind Convex also has them globally unique. (funny way to test this: in a query do something like: db.get(<userID>), but with type assertion provide a booking ID. the system will give you the booking with no questions asked ) I feel that this si deeply linked to the reatltime aspect. long story short, you can just add your own "id" attribute and put an index on it. you could get the same behaviour. with a few minimal complications along the way

Did you find this page helpful?