Firebase in frontend or backend - firebase

I read firebase is referred to as backend as a service, but in its documentation it supports Nodejs. Java, Python, Golang, etc along with Web, Android, and IOS
My question is why do we need backend if firebase itself is a backend as a service.

Incase your requirements exceed what firebase offers out of the box, firebase will still give you the ability to manage your data in programmatically.
For most use cases, you won't need your own backend. But in some cases you will for example need a custom sign-in flow, or perhaps a custom dashboard to manage firebase users. In those cases firebase gives you the flexibility to do so using the firebase admin SDK, which I believe is being referred to when they list 'Nodejs. Java, Python, Golang' as supported languages.
Checkout the firebase admin documentation here to understand what you can accomplish using it. Depending on your needs, you might not need it at all.

You may be interested to interact, from some backends that you own/control (e.g. a server in your premises), with some Firebase services hosted in the cloud in the Firebase infrastructure.
This can be interesting, for example, to integrate some of your legacy applications with Firebase.
You’ll find here and here two videos from Firebase that show some real life examples.

Related

How to use Firebase (or Firestore) as an intermediary between a desktop app and an external API endpoint?

I have a desktop app that will be distributed to users, and part of its code (which the user might be able to access) has to perform an API call to a third-party web service. However, this requires the API keys to be embedded into the source code, which causes some obvious security issues.
The main solution I've found while researching on the subject is to have a backend server between the user and the third-party API endpoint. So, I've been looking into Firebase for a while and it seems that this solution can be implemented using Firestore and Cloud Functions.
But, I wasn't able to find any clear examples that achieve something like this, and since I have no previous experience with Firebase or just backend programming in general, I would like to know if I'm on the right track and get more details about how to get it done, or if there are better alternatives for solving this issue. Any input is appreciated, thx.
You can use the firebase cloud functions as you mentioned. Your desktop application will be communicating with the cloud function - simple API call. Here you can find examples how to implement and deploy functions and test it locally https://firebase.google.com/docs/functions/get-started. Your cloud function will hold the API keys (it is backend so it will be secure if you dont expose it explicitly. Also the backend to backend communication is considered as secure). Finally, this cloud function will call the third party service and return some data back to the desktop app if needed. So you are on the right track, that is how the design should look like. If you need some help with cloud functions, you can also contact me directly.

How can i use Cloud Firestore and Firebase Auth for windows

i have a app both mobile and web in flutter so i want to create for desktop App, but base on the plugin does not support windows..
How can i use cloud Firestore and Firebase Auth in windows
Since the plugins don't support it, and there are no SDKs for Windows for either of the products, the most likely only option is to wrap the REST API that both provide. See: Auth REST API and the Firestore REST API.
It might also be worth checking out the Firestore gRPC API and its .NET client library, although I'm not sure if the latter is meant for use in client-side code or just for use in a trusted environment.
I had the same problem with desktop app in c#, there is not a lot of examples on the web. You are asking about flutter but I think my answer still should help you as the implementation is less important than concept.
You need to call your service and ask for custom_token, next with this custom_token you are calling google service and exchange custom_token for access_token. With this access_token you can call your service.
I created the the solution react.js+python+c#+firebase to have example for a future.
You can check the example on github
The firebase documentation regarding this topic is here

Using both Firebase and Amplify in one React native App

There is a big debate on the internet about Firebase vs Amplify. Get that. What I dont get is why so little to noone actually considers using both, or nobody just writes about it. To me both have clear advantages in different fields:
Firebase definitely seems to be handier when it comes to analytics and push notifications , AWS doesnt even offer ads as far I as know. And Pinpoint is quite confusing in its documentation.
AWS Cognito make more sense to anyone using AWS Services for the backend.
Firebase also offers all analytics and messaging for free regardless of the amount of data, whereas in AWS as usual you are hooked in right away with more AWS services. Firebase Storage is also more expensive than AWS once you have some significant traffic.
So I was thinking why not using Amplify SDK for Cognito and S3 whereas Firebase SDK takes care of analytics, Push Notifications and Ads. I dont see any disadvantages myself, but again - i have never built a mobile app, I am a pure backend developer. Can anyone come up with problems of this setup or just confirm it is absolutely fine?
Thanks!
ps. i am thinking of an app written in react native
I'm early into very similar research, so take this information with a grain of salt.
Regarding push notifications, Amplify's documentation for Android includes either setting your app up in Firebase or using Pinpoint. This documentation can be found here:
Amplify Push Notifications - Getting Started
This appears to be a direct tie to Firebase's push notification functionality, so I don't believe you'd get any of the other features Firebase offers with this implementation.
Regarding the other features, I believe your assessment is correct in that whichever deployment toolchain you choose to use you're subject to their analytics options.
I am also working on something similar and have always wondered why there isn’t more out there on this subject. Leveraging the best from both seems like the next step when looking to implement either.
Did you come across any issues?
I’m using Firebase SDK for Authentication, Auth, and Firestore (albeit will probably switch to S3 for storage). Amplify for everything else. NextJs frontend, no mobile.

How to build a secure Firestore API for 3rd party developers: SDK vs Firebase REST API vs https functions?

I have to build an API using Firebase, and need some help with design choices. I want to be able to sell the API to users, who can then use it to build/integrate their own applications. Users will have both read and write privileges.
General information:
I'm using Firestore db with email & password authentication.
Only specifically assigned users may use the API
Each user may only access specific documents concerning them.
I've noticed 3 different ways in which an API can be provided to a user of my Firestore db:
https triggered cloud functions (https://firebase.google.com/docs/functions/http-events)
Using the SDK (https://firebase.google.com/docs/firestore/client/libraries)
Using the REST API provided by Firbase (https://firebase.google.com/docs/firestore/use-rest-api)
API requirements:
Used only by users that I specifically grant access to (email & password login)
I want to limit these users to only a couple of read/write tasks that they're able to perform.
It needs to be safe.
My current approach is:
Use the 3rd option - the REST API provided by Firebase (thereby giving users the projectId and API key)
Add authorised users to the list of authorised accounts on Firbase, and limit access using custom claims and database rules.
My questions:
It seems that https functions (option 1) are normally used in API building. Are options 2 and 3 unsafe?
What are the normal use cases of the 3 options? When should each be used and when should each be avoided?
Are there any obvious flaws in my choice of option 3?
Any other useful information about making these design decisions will be much appreciated.
Thank you in advance
TL;DL: It depends on what you want to do with this API and how many and what type of devices/users will be calling it.
Before answering your questions I will list below the advantages of each approach:
Cloud Functions:
Cloud Function is a Functions as a Service Solution, so it's also a hosting service for your API, therefore you won't have to provision, manage, or upgrade servers and the API will automatically scale based on the load. Also this option takes into account the pros of SDKs and client libraries, since your code will have to use it to connect to Firestore anyway.
SDKs and client libraries:
This is the easiest and more optimized way to reach Firestore, however, environments where running a native library is not possible such as IOT devices will be left out of your solution, so consider this while implementing this option.
Cloud Firestore REST API:
Every device properly authorized to access Firestore will be able to do so.
NOTE: For both SDK and REST API you will need to consider hosting of your API, either on Cloud Functions, as mentioned, App Engine Standard, App Engine Flex or a Compute Engine Server Instance.
All that being said, it's up to you and your API's usage and requirements to say which option is best considering the points above.
As per security, I'd say that all option can be secure if firebase rules and firebase auth are set correctly.

Can Firebase be used in an app supported by another Backend and Database?

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.

Resources