# Enforce unique username on my platform

**URL:** <https://forum.bubble.io/t/enforce-unique-username-on-my-platform/237236>\
**Category:** Database\
**Created:** [December 15, 2022, 3:27pm UTC](https://forum.bubble.io/t/enforce-unique-username-on-my-platform/237236 "2022-12-15T15:27:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt58](https://avatars.discourse-cdn.com/v4/letter/m/8e7dd6/32.png) [@matt58](https://forum.bubble.io/u/matt58)\
**Post date:** [December 15, 2022, 3:27pm UTC](https://forum.bubble.io/t/enforce-unique-username-on-my-platform/237236/1 "2022-12-15T15:27:23Z")

</div>

Hello, I am new to Bubble but I am an experienced front-end developer. Im hoping I can get some insights on some best practices.

I need each user on my platform to create a unique username during registration.  
So I need to perform a search (case sensitive) of the DB and enforce that the username is unique before the register button is active.

Does anyone have any guidance or experience with this type of use case?  
Thank you in advance for any suggestions.

---

<div class="post-metadata">

**Author:** ![johnny](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/johnny/32/203020_2.png) [@johnny](https://forum.bubble.io/u/johnny)\
**Post date:** [December 15, 2022, 3:38pm UTC](https://forum.bubble.io/t/enforce-unique-username-on-my-platform/237236/2 "2022-12-15T15:38:26Z")

</div>

Hey @matt58,

I think you should use slugs! Because it automatically checks for them to be unique or else it’ll make it unique by appending a number after it

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [December 15, 2022, 3:40pm UTC](https://forum.bubble.io/t/enforce-unique-username-on-my-platform/237236/3 "2022-12-15T15:40:05Z")

</div>

Just do a search for Users who’s Username matches the one input by the new User, and then look at the count of the returned list…

If the count is more than 0 the Username is already taken, so show an error message and/or don’t let the workflow run or the button be clickable etc…

If the count is 0, then the User name is unique, so let the workflow run or the button be clickable…

Or… as @johnny suggests, you can use Slugs…

---

<div class="post-metadata">

**Author:** ![matt58](https://avatars.discourse-cdn.com/v4/letter/m/8e7dd6/32.png) [@matt58](https://forum.bubble.io/u/matt58)\
**Post date:** [December 15, 2022, 3:48pm UTC](https://forum.bubble.io/t/enforce-unique-username-on-my-platform/237236/4 "2022-12-15T15:48:02Z")

</div>

Thats a great suggestion. I should have mentioned that ultimately the username will be the users publicly accessible profile page. Id like the user to be able to update the username parameter as well and do the check again at will as well. Ill look into the slug thanks.

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [December 15, 2022, 3:49pm UTC](https://forum.bubble.io/t/enforce-unique-username-on-my-platform/237236/5 "2022-12-15T15:49:06Z")

</div>

In that case, definitely use slugs (that’s exactly what they’re for)…

---

<div class="post-metadata">

**Author:** ![matt58](https://avatars.discourse-cdn.com/v4/letter/m/8e7dd6/32.png) [@matt58](https://forum.bubble.io/u/matt58)\
**Post date:** [December 15, 2022, 3:51pm UTC](https://forum.bubble.io/t/enforce-unique-username-on-my-platform/237236/6 "2022-12-15T15:51:35Z")

</div>

Hello, This is how I currently have it setup. I was wondering if this type of workflow was something that bubblers are using.  
Thanks very much for your response I appreciate you taking the time.

---

<div class="post-metadata">

**Author:** ![matt58](https://avatars.discourse-cdn.com/v4/letter/m/8e7dd6/32.png) [@matt58](https://forum.bubble.io/u/matt58)\
**Post date:** [December 15, 2022, 3:52pm UTC](https://forum.bubble.io/t/enforce-unique-username-on-my-platform/237236/7 "2022-12-15T15:52:51Z")

</div>

Thank you. This is just the advice I came here for. This is a great community. Thanks everyone.
