Firebase Data Structuring


#1

Hello guys, we are building two Ionic apps at the startup I work for. We saw the benefit of rapid development that Firebase offers and we decided to use it as our backend. We are building hotel booking apps for users (people that want to search and book hotels) and for the hotels so that they can manage their bookings. The first app for the users is done and we have all our data and authentication rules stored at a Firebase Data URL. We are about to start building the second app meant for the hotels and we have some serious questions:

  1. Should we use the same Firebase Data URL for the hotel app or should we create another one? If we use the same Firebase Data URL, that means data for the hotels and the users will be mixed and the URL will handle authentication for the entities.

Please we would really appreciate your input and opinions on best practices on how to do this. Thank you.


#2

Two apps, interesting. I’m in the same boat, I need to build a consumer app and a business app, which need to communicate between each other (Firebase would probably work for that scenario).

Do you share any code/components between the two apps and if yes how do you do that?
Obviously you don’t want go the copy/paste route because you end up with duplicate maintenance.

The approach I’m taking for now is to have 3 projects/directories: consumer, business and ‘shared’ or (common) and then pull the shared code into the 2 apps by means of a symlink.

(“ln -s”, I’m automating that with gulp)

I’m aware that other approaches might be more elegant (bower components etc), but for now this is the easiest solution.

As for Firebase, I don’t have experience with that because I started out with Parse.com for my backend (user auth) but I’m planning to complement it with Firebase (or switch over to Firebase completely).

Would two separate URLs mean that you would be unable to access data shared between the two?

The main attraction of Firebase is of course the realtime sync capabilities which I’d use for messaging and for offline capabilities. I saw that Firebase has built-in offline/sync capabilities:

However if that turns out to be too limited (as is often the case with these ‘magical’ automatic solutions) I could do the local caching myself using e.g. Pouchbase.

The only thing that worries me a bit is that the number of connected clients on the free plan and on the smallest paid plan is rather limited. I can imagine that you outgrow this limit quickly when your app becomes popular. Also the database storage limit (100 MB) on the free plan is limited, probably need to go with the paid plan for a serious app.

Anyway planning to get started very soon with Firebase and I will let you know if I reach a conclusion regarding the data URLs (whether you would be better off with 1 or 2 URLs).