I am biased since I have a plugin to help handle all of this, but a lot of the Logic I and others use to build this type of app is explained on the example bubble app: