Using Firebase and MySQL on the same app

3,212 views
Skip to first unread message

Luã de Souza

unread,
Feb 3, 2016, 2:22:11 PM2/3/16
to Firebase Google Group
Hello,

I'm currently working on a mobile app powered by a web platform, and the mobile app will have some offline capabilities. The application has a small amount of DB entities, and only about 3 of them will be written by the mobile app, and not by the web platform.

Since I want to improve the offline data sync, I came across Firebase as a solution for this problem. After reading through the docs and doing some tests I confirmed it's a great choice.

I decided to use Firebase only for the specific data that will be written on the mobile app, and use MySQL for all other data. The main reason for that is that all other data doesn't need to be in sync on all devices, and it's all relational data that fits well into MySQL. The data stored on Firebase would be used by the web app mainly for reports and/or displaying logs of actions taken on the mobile apps for a specific user.

So my question right now is if it would be a "good practice" working with those two engines on the same application, and if anyone else has used this approach for a similar problem.

Thanks.

Rachel Willmer

unread,
Feb 3, 2016, 5:18:30 PM2/3/16
to Firebase Google Group
I don't know whether it's "good practice"; but I'm doing a 2-db approach with the next version of my website Luzme.

Basically, the relational database model is the canonical model, and not all of the data needs to be in Firebase.

So the initial data changes get made to the MySQL db; and the subset of those changes which need to be in Firebase then get written to Firebase.

This site is currently about to enter beta testing; it works fine in testing, I'll be interested to see how well it stands up to live use!

Rachel

P.S. It's done this way for two reasons: 

(a) historical: the original database was developed in MySQL and it's taken a few years to get the right relational model, so I'm not changing it!

(b) pragmatic: I'm mitigating the potential risk of Firebase closing down; if it does, I can migrate the front-end quickly to another alternative without rewriting the backend.

Nick Halper

unread,
Feb 3, 2016, 5:27:45 PM2/3/16
to Firebase Google Group
I'm using both SQL for local processing of data and offline storage in ios combined with Firebase as the backend.

I would have preferred to use Firebase's built-in offline persistence, but unfortunately Firebase currently uses a persist-all-or-nothing approach, which didn't work for me, as I needed to listen to latest items in a stream of data and it would be much too network inefficient to have to reload all the stream each time the app restarts or toggles offline/online. I hope they allow a more granular approach to offline persistence someday.

SQL also affords me extra simplicity and power in querying data locally on the device, that would be more cumbersome with Firebase queries.
Reply all
Reply to author
Forward
0 new messages