HACKER Q&A
📣 kadfak

Is having a unique handle for profile pages a problem?


Every major platform I know has their core entities behind a user chosen handle. Right now I'm deciding how to handle this matter for a web app I'm developing and my main concern is name squatting. There have been many discussions about squatting, here's one about Rust's package repository, crates.io[1], for example.

An alternative approach that I've been thinking about would be having a slug (for SEO purposes) and an ID in the URL: myapp.com/page/FancyCorporation/mYlIcpWXpCG3GithkD2OdA. Although it makes the URL uglier, naming the thing is less stressful as every name is allowed. Another problem with this solution might be the fact that the slug part can be any string: myapp.com/page/asdasd/mYlIcpWXpCG3GithkD2OdA and myapp.com/page/FancyCorporation/mYlIcpWXpCG3GithkD2OdA point to the same profile. This allows bad actors to create URLs that look legit.

Am I overthinking or what do you think?

[1]: https://www.reddit.com/r/rust/comments/9dole9/proposal_crate_squatting_on_cratesio/


  👤 karmakaze Accepted Answer ✓
Seems like there's two things here:

  1. username handles
  2. unique page urls
For the usernames I would use system generated (numeric or uuid) internal ids that are associated with usernames.

For the page urls, I would let the author use any string, generating a semi-meaningful default for seo. The page url should include the username handle and so the unique part for the page only has to be unique for that username.

This means that say the db for page urls will have a unique constraint on (user_id, page_url_suffix) where the user_id is the numeric/uuid one. So if user with handle xxx is deleted and a new user uses handle xxx only the new urls for that user are still accessible.


👤 jamieweb
Have a look at OnioNS (Onion Name System). It's a method for allowing users to claim unique names while limiting the effects of squatting, as it takes continuous computational power to retain a name.

This probably isn't going to help with your web app, but it's an interesting part of the theory to understand.