How to create a individual and group logins

Hello I am trying to create an app that has individual and group logins. I wanted to be like swag or google work space G suite

Any idea how to get

It might be by having users capable of creating groups which the database would need a datatype for, and then that group creator would set the password etc. and send invites to the other users they want to join the group