Planned App:
I want to make an web-app with Polymer & Firebase where users can create "card-sets" (like in Google Now on Android) and share them with groups/public. A card-set consists of a card-list (required to easily sort the list). A card-list contains of card-items which contain content in some way.
Firebase structure:
I was reading a lot about structuring data in Firebase and came up with the following structure (in manner of keeping it flat). The reason for the split is, that I might want to have a huge amount of "cardsets" and just load an overview of it.
|-user
|-cardset
|-UID
|-title
|-category
|-reference-to-cardlist-UID
|-UID
|-....
|-cardlist
|-UID
|-1
|-reference-to-carditem-UID
|-order
|-visible
|-2
|-...
|-carditem
|-UID
|-title
|-content
|-UID
|....
If users want to share, I would duplicate this in a "public" or "group" node instead of "user".
Polymer element structure:
As for the element structure in polymer, I would create data loading elements in the same structure, with which I can load the nodes in the required way:
data-card-set.html
data-card-list.html
data-card-item.html
(even if I would combin them into one, it wouldn't reduce the amount of times I need to initiate an element in the parent) In the parent, they would interact with each other and load the data to display it.
Questions
- FB: Is this a reasonable flat structure for Firebase?
- FB: Is it the right approach for user/public/group data?
- Polymer: Is this the right way to load data? It seems like a lot of elements and a lot of requests sent to the database, but I want to avoid loading too much data from the DB.
In most of the examples I can find online (e.g. todo-data), all data for the user is loaded at once. This I want to avoid, as e.g. there might be plenty of cardsets for one user.
Thanks a lot for your feedback!
Tim