Create Unique user_metadata or app_metadata attributes which are searchable

So i am building a social application in which i want to give users a unique nickname.
In my app i have configured Login with, FB, Google and other PasswordLess connections.
Once a user comes after successful login. I want to check or assign them a unique nickname.

How i want to do this :

  1. User Logs In
  2. Fetch User Profile
  3. Check for custom nickname property.
  4. If not found, ask user to suggest a one.
  5. From management api check if this custom nickname is not assigned to anyone else.
  6. If not assigned, assign it to the current user
  7. Else ask user to choose another name.

What i have read so far, is that i can use app_metadata for such properties.
Some desired behaviour around this custom unique property

  1. It should be searchable. Pointing back towards the user.
  2. Insert should give error if unique constraint fails
  3. Should be readable from user profile fetch call.

Please suggest a best way to do that. I do not want to build a custom db just for this purpose before my management api add that unique properties to user profile.

Any help will be appreciated