TarikHuber / rmw-shell

Shell of main components for the React Most Wanted project
26 stars 23 forks source link

migration to Firestore ? #16

Closed hyphaene closed 5 years ago

hyphaene commented 6 years ago

Hi !

I wanted to know if there is a plan about a migration from Realtime Database to Firestore ?

And also, is there a roadmap we can check ?

Thanks !

TarikHuber commented 6 years ago

Hi @hyphaene ,

As Firebase itself mentions all the time: there is no need to migrate everything to the Firestore. Both databases will exist in coexistence and they do very well together. There is already a sync of user grants and admins to the Firestore so you can use the same authorisation stack in firestore. I'm currently working on a project in our company where we will use firestore but also jos for large amounts of data. For the smaller one the realtimedatabase is still a better fit.

For example: I'm working on a warehouse management application. The names and numbers of the items to be stored are saved in the realtime database because those numbers will not go into milions of entries. The data for each warehouse task is stored in firestore because there will be milions and milions of entries.

The firekit project that is used to sync firebase and the redux state of rmw-shell is also already supporting firestore.

The only thing that we could migrate in rmw-shell to firestore and that would make sense is the list of users because that could get very large. We are now in the demo project about 3k and it works still good up to 10k.

If you are interested I'm open for PRs to migrate the users list to firestore. The other auth parts are already synced so you can use firestore.

INFO: One great thing about the realtimedatabase is the persistance of realtime sync over react components. For firestore a started sync in a react component must keep the instance of that component open to remain controll over it. Othervise if leaving the component you started the sync it will remain open as long the application runs. Saving the unsub variable for unsubscribing in the redux state is also not an option.