NoSQL Data Modeling
Queries I Found Useful in My First Adventures with Firestore
After a pretty successful time building a prototype of Reciprocal.dev we decided to start building a beta that added user accounts and the ability for users to create their own user journey maps with the tool.
I decided to go with Firebase for both the authentication and data storage solution as the interoperability of both solutions made it ideal for performing asynchronous actions on changes to both documents in Firestore and user accounts in Firebase Authentication.
Moving to Firestore meant formalising the structure of the data that we had hacked together for the prototype to make it more scalable and make sure it plays well with the limits Firestore has around document sizes and nested objects.
To do this, I opted to build a number of sub-collections nested at the appropriate level for the data we stored in the prototype and to use an array of objects that had just enough data to be useful for rendering lists, but contained the ID of a document to link to for the full document.