Forum Academy Marketplace Showcase Pricing Features

Have I got the right database structure?

Hi there I’m new to Bubble and I need some advice on whether I have the right database structure for the app I’m developing.

I’ve listed the structure below.

So my app will be a kind of social network style website where people register, list their interests and upload a few photos. Users can create “Tweet” style statements which can be liked and upvoted… users can be “followed” Twitter style and when 2 people mutually follow each other they can egage in a live text chat through the site. Members receive notifications regarding when someone starts following them or sends a message via the chat interface.

Please could people advise if the database layout I’ve come up with would support the features I’ve mentioned here.

USER
name - text
bio - text
age - number
handle - text
main-profile-photo - image
followers - list of users
following - list of users
other-profile-images - user images
contacts - list of users
chats joined - list of chats

USER IMAGES
images - list of images

NOTIFICATIONS
read - yes/no
receiver - user
text - text

MESSAGE
message-content - text
messages chat - chat

CHAT
messages - list of messages
users - list of users

USER SETTINGS
show-when-online - yes/no
show-my-skill-level - yes/no
show-my-bio - yes/no
user - list of users

Looks good to me! Not sure what the user settings are though. Seems like they could just be included in the User data type.

Learn no code → nocodify.com

Thanks for your reply…the user settings are of course certains things the users can set in terms of how they appear when online…I was thinking they could be in a separate data type as that would make the database run more efficiently but as I say I’m new.

Any other thoughts from anyone?

One thing to think about when you are designing the database are your Privacy Rules. I expect this design will be fine as you will create all the DB entries at “register” time by the User so you can have the nice simple rule on your Things of “this record was created by this user”.

Another thing is performance - that design of having a list of Followers and Following on your Users could give you performance issues when you have 100’s of followers and Following. There is an excellent ebook from @petter that explains this well. The Ultimate Guide to Bubble Performance - 156 pages of optimizing tips

Thank you so much …this was what I was looking to find out from people.

Regarding the privacy rules I have looked into that.

As for the followers and following…I’ll look at the link you provided but in the meantime would you suggest I use a separate data type?

Something like this?

eg.
FOLLOWS
followers - list of users
following - list of users
user - user

One thing about the Bubble DB is it isn’t very helpful to think about the design like a traditional relational database (normalisation, Codd etc) . You need to design the database to fit your queries as there are limitations to the types of queries you can create, and the performance of those queries.

You could optionally have a link table style

FOLLOW LINK
User
Followed by User

Then you can query this for “who are this users followers” “Who does this user follow”

But if you read @petter book you will become as expert as anyone is in this forum :wink:

Brilliant thank you so much!