This cloud functions represent one of my last works with cloud functions: Implement a basic social media representation with posts, followers and feed, together with likes and comments. What will our cloud functions control?
I'm not an expert in noSQL data models or Typescript, but I have been working with Firebase approximately for the last two years. For that reason, feel free to suggest changes or just send a pull request. You can find an example of the database structure in the project.
At the moment there is not to much information or example about work with Typescript and Firestore. If you want to learn more I suggest you to visit the profile of Thomas Bouldin, aka Inlined who did a great talk in #FirebaseSummit about write quality cloud functions with Typescript. Also don't forget to give a look to the Firebase Functions samples.
Cloud Firestore is a cloud-hosted, NoSQL database that your iOS, Android, and web apps can access directly via native SDKs. Cloud Firestore is also available in native Node.js, Java, Python, and Go SDKs, in addition to REST and RPC APIs.
Following Cloud Firestore's NoSQL data model, you store data in documents that contain fields mapping to values. These documents are stored in collections, which are containers for your documents that you can use to organize your data and build queries.
Additionally, querying in Cloud Firestore is expressive, efficient, and flexible. Create shallow queries to retrieve data at the document level without needing to retrieve the entire collection, or any nested subcollections. Add sorting, filtering, and limits to your queries or cursors to paginate your results. To keep data in your apps current, without retrieving your entire database each time an update happens, add realtime listeners. Adding realtime listeners to your app notifies you with a data snapshot whenever the data your client apps are listening to changes, retrieving only the new changes.
For a nice intro to TypeScript, check out the TypeScript PlayGround.
firebase-toolsto use your project with
firebase use <YOUR_PROJECT>
npm run deploy