How to Create a Username on Signup

If you want to create a ‘username’ for your user datatype during signup but you want to limit the number of fields the user has to fill in to limit friction for signup, you could follow this approach.

Instead of having a data field of ‘username’ rely on the use of the built in slug filed on the user data type to store this information.

Then on signup you obviously need the users email address and that can be utilized to create a unique username by harnessing the slug feature functionality.

In your workflow for signup add a step to ‘set a things slug’ and in that you can have a dynamic expression that would reference either the users email address or the input value used to capture their email address. In that expression you’ll want to use an extract with regex pattern


Screen Shot 2021-07-04 at 4.17.55 PM
Screen Shot 2021-07-04 at 4.17.46 PM

This will result in the users email address being stripped of the email clients domain name as well as the @ symbol…so it would only be the email ‘handle’.

The slug feature will ensure that any other users who have the same email handle doesn’t cause a problem, since Bubble handles the uniqueness of a slug by appending a numerical value for duplicates.

Later you can have in the users profile section an ability for them to manually change that ‘username’.


Hey @boston85719 :wave:

Did you know Bubble can extract the email alias for you without regex? They already have this built in. I learned this not that long ago and wanted to share the knowledge. Then you can use the slug feature which prevents duplicates. :+1:

Check it out:

Editor: Test805421 | Bubble Editor

You can also extract each part of the email address basically.

Hope that helps! :blush:


For All Your No-Code Education Needs:


That is cool. Never knew that function was there. Definitely easier than using the extract with regex pattern. Regex patterns are a mystery to me.

1 Like

Yeah. For sure. Regex is a pain sometimes. Seems like Bubble already thought of it for us. :+1::blush:

Great tip & approach @boston85719!
I too have implemented this auto-assigned username system well!