How to structure the database for different user types?


I’m just trying to understand how Bubble handles databases. It’s rather complicated. I’d appreciate any advice on structuring my database? What I want to achieve:

1- Create users via regular signup
2- Let users select or if not existing create companies from a list.
3- So a user is attached to a company and I should be able to see which company is linked to which user and vice versa. A company may have several users attached to it but one of the users should be the primary account owner to enter/modify company data.
5- Each company should have the following attributes in addition to regular contact info etc.
a) a category
b) team size
c) experience level
d) experience field
4) gallery of works
6- The paid subscription plans will be based and varied according to companies’ attributes.

Can Bubble handle this workflow? How?

Hey there :wave:

Bubble can handle this. I do it all the time. I normally allow the first user to be the admin user and then let them invite the other users to their company. Then they don’t get random people joining their company.

Each new user they invite, you can just attach the company they have created to that new user.

Does that make sense?

Click here to learn more

Hope that helps! :blush:

Hi J805,

Makes sense, thanks a lot. Now I have to find how I can create the admin user feature.

How should I structure the conditions in this directory? Users of the companies with certain company attributes should able to access to certain features. Since the companies will be the actual members of the subscription plans, not users, I’m having difficulty to make relations between these two major types. So the users will signup but their access to certain features will depend on the profile of their companies. Rather complicated for a Bubble beginner like me.

No problem.

What I normally do is make a Company data type.

For example:

userList (type User LIST)
companyName (type ‘text’)

parentCompany (type Company)
nameFirst (type ‘text’)
nameLast (type ‘text’)
userType (type ‘text’ i.e. = admin, employee, manager, etc)

Then when checking on a subscription you can give access if anyone in the company list has a subscription that is active.

Also you can allow privacy roles to any user that is in the company as well.

Hope that helps :blush:

1 Like

I see. Thank you very much J805, I’ll start with this.

I think I also need to have a “access level” type for the companies so that I can adjust access to different sections of the site by filtering this type and blocking some parts of the site.

Good idea, just add a type field to the Company data type and limit access by that. :slight_smile:

Let us know if you get stuck and we will see what we can do. :blush: