Hello everybody,
I’ve taken a look at some tutorials from the following topic:
In short, I think that these tutorials contain some crucial mistakes.
Regarding How To Build A Pinterest Clone Without Code
Configure your database
User
We’re facing this mistake on many apps. That’s a wrong approach since it negatively affects performance and speed.
Let me explain why I do think that this is wrong.
The Bubble’s unique id for each thing looks like the next one:
1583401182457x366778424039915460
It contains 32 of characters that are equal to 32 of bytes (if we save it as a .txt file).
In the case of Pinterest, a user may have a large number of created pins and saved pins.
Imagine that a user created 100 pins. Also, the same user saved 500 pins because he is a big fan of something.
For example, an interior designer may have a massive list of boards where he/she saves pins for each client apart.
So, the created 100 pins equals to 3299 (with commas) of characters.
That equals to ~3220 bytes (3.22 KB).
The saved 500 pins equals to 16495 (with commas) of characters.
That equals to ~16100 bytes (16.1 KB).
As a result, these two fields (created pins and saved pins) weight ~19,32 KB
Plus, don’t forget about the hidden field called Any field for each table.
This field has values from all the fields of a table.
So, the Any field for a user table contains values of the following fields:
- Bio
- Created boards
- Name
- Photo
- Saved pins
- Modified Date
- Created Date
That means that this user weights more than ~38,64 KB.
It affects the following things negatively:
- Speed of searches
- Parsing data by a RepeatingGroup
- Auto object refreshing (Bubble’s WebSockets)
- Working/Updating an object (in our case, User)
Speed of searches
It takes more capacity for an app to find things (Do search for) if you have heavy (panzer-like) records.
Also, it takes time and capacity on the client-side when you’re making Parent Group User’ Saved pins:filtered to get the specific records. So, in that case, the system receives and initializes 500 of saved pins from the database when you need to display a couple of them only in a RepeatingGroup (for example, showing the last 5 saved pins sorted by date).
On refresh, the system makes the same again and again on a new refresh.
Does it sound well? I don’t think so.
Parsing data by a RepeatingGroup
So, to display things on a RepeatingGroup, the system makes several steps such as searching and parsing.
A script cannot parse data fast if it contains many data (heavy objects).
So, it cannot display fast 20-25 users on a RepeatingGroup that has a lot of pins.
For example, an admin dashboard should display all the users of the app. It works slowly and glitchy with non-optimized tables.
Auto object refreshing (Bubble’s WebSockets)
As we know, the Bubble has an attractive feature that auto-refreshes objects when data has been changed.
This feature doesn’t work well when you have a couple of tables with the same mistake, and your app is displaying things using several RepeatingGroups.
There are cases where you can notice considerable delays between updates. And that’s normal because the scripts cannot handle so much data fast and easily.
Working/Updating an object (in our case, User)
It also takes more capacity of an app to update a heavy object even in the API Workflow section.
These are the reasons why an app is working well at the start and starts to work slowly and buggy when more users are using this app.
How it should be?
Get rid of the next fields:
- Created boards
- Created pins
- Saved pins
User Table
Board Table
Note: We have a User field here because we cannot update the built-in field called Creator. In many cases, a developer should be able to update this field.
That’s why we may have a separate field for these purposes.
Pin Table
PinDetails Table
Here you can store massive data about a pin.
PinSelected Table
Here you need to store saved pins by a user.
So, now, for example, to display the last 5 saved pins by a user that has 500 saved pins, you need:
Do search for PinSelected where User = Current User sorted by Creation Date.
In that case, you won’t have performance issues.
A Bubble app might work pretty fast and smoothly if an app was built in the right way.
Let me know if you have any questions, please.
Cheers!