Set user role on register

I have custom roles for each area… But I don’t know how to assign it to each user. I will try using lifecycle hooks. I think that can I use beforeCreate() or afterCreate() hook, would be great if can share to me a good example external to documentation use.