Does anyone know the links, tutorials on how to make and API for third party aps using firestore and cloud functions.
I am using google IoT core, firestore, cloud functions. I would like to make an API where 3rd party aps could get access to my firestore DB to control IoT devices. I want to create them a api token or key to get access. I would like also track api calls for every 3rd party app.
I am not sure what is proper way to do it with firestore.
Any links, suggestions will be helpful.
You could:
Have a look at the doc (https://firebase.google.com/docs/functions/) and in particular https://firebase.google.com/docs/functions/http-events,
Watch the following set of videos from the Firebase team (https://www.youtube.com/watch?v=7IkUgCLr5oA and https://www.youtube.com/watch?v=652XeeKNHSk)
And finally study some of the official samples: https://github.com/firebase/functions-samples
Related
I am using Firestore as a database for my flutter app. Some actions on my app lead to change/update in Firestore data.
I am using Flutter native notifications which are generated once a button is clicked. However, the data passed to the notification remains constant despite the data having been updated later in the Firestore.
I would like to implement a feature similar to the one present in sport apps where the live score is updated regularly in the notification.
How can I achieve that in my app? Do I have to use Firestore Cloud Messaging? Citing resources would be helpful.
What you want to achieve sounds like an ideal case for Firebase Cloud Messaging to be used. I recommend that you take a look at the FlutterFire documentation for Cloud Messaging both overview and usage, which should give you a good starting point.
Alternatively you can also use a Cloud Function as the host of FCM and only configure your app to receive messages, you can watch this video for insights on how to create the Cloud Function side.
I am currently creating a marketplace mobile application from scratch and I'm using React Native for the front-end part and Firebase for the backend (using Firebase and Firestore).
I am wondering wether :
I should create a RESTful API using cloud functions and express to create API endpoints (that would connect to firebase and firestore) that I'd call from my redux actions in my React Native app (using redux thunk).
or, I should call firebase and firestore directly from redux actions.
I see couple pros and cons for each method.
Restful API pros :
Safer as I can check and manipulate submitted data more easily
Custom API reply (I can manipulate the return data)
Restful API cons :
Probably slower as I would have to call an API endpoint that will then call firebase and/or firestore.
Won't be as easy to set listeners on firestore data
What do you think about it ?
Which option should I choose knowing that I predict that the app will get a few thousand users daily. I want it to be as fast and safe as possible and be able to set listeners for notifications purposes.
In my opinion you should mix them, if you have to manage users, products or etc. Firebase produces client and admin sdk that has different roles. If you haven't need manage any data of products or users or etc. you can simply use client sdk.
My advise is you can use admin sdk on API (server-side) and feel free to use client sdk on your clients.
Use as managements on API, listening data, realtime chat etc. via client sdk.
You can check admin and client sdk. Also npm packages for React Native here.
Mixing will be of help, you can try:
Listen for small amounts of data using the client SDK
Write and sort data using the cloud functions
In my experience, writing to a firebase database that uses ordered ids (in my case) leads to some huge problems in the long run. I lost a good chunk of data when my app accidentally wrote to a root index instead of a child index when the app was resumed from inactivity because the android system cleared the RAM.
Also, for notification, use Firebase Cloud Messaging.
I'm teaching myself to use Flutter and I'm making an app that queries The Movie Database API. Currently, I'm having the client query the API on launch but I'm thinking this is not the most efficient way of doing it, and I would rather have the client query a backend service like Firebase to get the same data.
I would appreciate some guidance into where to start in order to setup a periodical process to query the API and use the results as entries into a Firestore DB. I've looked online but I might be using suboptimal keywords since I haven't found a good tutorial or example for this.
Thanks.
You can use Firebase Cloud Functions to build code that runs on Firebase servers to fill your Firebase database, but you can only make HTTP requests to non-Google addresses if you use a paid plan.
https://firebase.googleblog.com/2017/03/how-to-schedule-cron-jobs-with-cloud.html explains how to invoke periodic tasks with Cloud Functions. It utilizes Google AppEngine for that because Cloud Functions doesn't provide that out of the box.
I am looking to make an app that would have its Backend on another service like AWS or some other. This app would be having many features and functionalities.
But for chat feature, I am exploring options and wondering that would I be able to integrate Firebase in my app.
I have read about Firebase Functions to add more functionality at the backend and also the installation of Firebase Admin to servers.
But still I am not convinced about their capabilities and exactly what all I can do with them.
It would be great if someone who has experience with Firebase help me out figuring if going with it is the best case for me or is there something else I should look into.
So first you can't use Firebase in combination with AWS or Azure etc. Firebase is based on Google Cloud and is the interface between the mobile client (the running app on the client's smartphone) and the backend (your Firebase project).
What I use is, for example, Firebase Cloud Messaging, to simply notify one or multiple users by trigger an HTTP Request from my own web server.
I also made some apps to store the data in FireStore or in the Realtime-Database, so that I don't have to set up a whole new infrastructure. And this is basically the goal of Firebase that you can simply start with your app, without carrying about that.
So what I've heard about Firebase is that you currently cannot install Firebase on a server of your choice and you have to use Google Cloud.
Hopefully, you can do something with my answer. If you have further questions feel free to ask them.
Im developing a React app which has a dashboard and other fields which display data from a 3rd Party API. I also have mobile apps(React Native and iOS) which also need to display the SAME data.
Since the 3rd party API has limits on the calls, if I have 1000 users, and I query the 3rd party API from the 1000 clients(client side invocation), I will reach that limit very quickly. My intention is to make API calls on the firebase database and then update the database every 30 minutes. So even if I have 1000 or 100 users, they will be hitting the firebase server for fetching data which in turn would be holding the cached data(A JSON object).
Is there a way I can do this using Firebase? Or heroku? Which is the preferred way to solve this issue?
You could create your own API with Firebase Functions and make that API do the requests to the 3rd party API and cache the results for 'x' time or write them to your Firebase Database using the Admin SDK.
Then your users will be able to fetch that data directly from your database without ever touching the 3rd party API.
Here you have a videotutorial from Firebase on how to create a Node.js app (hosting and functions). Functions section of the video is what you are looking for.
Hope it helps! :)