Could I use GCP infrastructure as a code to setup Firebase Auth, Firestore, RDB, Cloud Functions? - firebase

I know that I could setup Cloud Firestore and GCP Cloud Functions with infrastructure as a code, but I'm interested that it will be shown at the Firebase Console. I also can't find any way to deploy Firebase Auth and Realtime database with IaaC.

Any Cloud Functions deployed by either the Firebase CLI or gcloud will appear in both the Firebase console and the Cloud console.
Any data populated in Firestore will also appear in both consoles.
The Cloud console has no view into Firebase Auth or Realtime Database, as those services are unique to Firebase. You will have to use the Firebase console and its tools and SDKs to work with those products.
In fact, a Firebase project is just a Cloud project with extra APIs and services enabled on top. You might be helped by reading this blog series on the relationship between Firebase and Google Cloud.
https://medium.com/google-developers/whats-the-relationship-between-firebase-and-google-cloud-57e268a7ff6f
https://medium.com/google-developers/firebase-google-cloud-whats-different-with-cloud-functions-612d9e1e89cb
https://medium.com/google-developers/firebase-google-cloud-whats-different-with-cloud-firestore-40f1fc3e6d1e
https://medium.com/google-developers/firebase-google-cloud-whats-different-with-cloud-storage-a33fad7c2b80

Related

Do I have to enable Firebase if I want to connect to my Cloud Firestore database from outside of Google cloud products?

Till now I was using service account to connect to my Firestore database (Firebase is not enabled) from within Google products like Cloud Functions or Colab.
Now I need to connect to Firestore from html page opened in my browser. Is it possible without enabling Firebase?
Yes, the Google Cloud Firestore NodeJS SDK is meant to be used on server side only. You can use Firebase Web SDK along with Firebase Authentication and Firebase Security Rules to support serverless app architectures where clients connect directly to your Firestore database.
You don't necessarily have to use Firebase Auth. However, it might be a good idea to restrict access and allow only public content to be accessible without authentication.
You can follow the quickstart in the documentation to setup the client SDK.

How to enable Firebase Realtime Database in GCP?

I want to extend an existing GCP project with a Firebase Realtime Database.
According to the Firebase documentation,
all Firebase projects are internally hosted on GCP
it is possible to use Firebase features directly from a GCP project,
so I went to the Marketplace and found the corresponding product page there.
Unlike other product pages, this one doesn't have an "Enable" button on it but rather "Get started for free".
This button does nothing, no response at all. Any deas?
You can just go to the Firebase console and from there you will be able to use Firebase Realtime Database for the same project.
It is not possible to use all the features of Firebase directly on Google Cloud Platform, but you will find common products as Storage and Cloud Functions i.e. that are shared between Firebase and Cloud Platform

Connect to Firebase buckets

I have a backend in golang and was wondering how I can connect to Firebase storage to create/delete buckets and add/delete files. Can I use the Admin sdk. I found the client storage lib in golang for google cloud storage. Can I use that? And whats the difference between firebase storage and google cloud storage?
The app I'm working on connects to Firebase Storage Buckets via the Admin SDK, but we're using Firebase Functions in Node.js. However, it looks like the Admin SDK in Go offers the same Storage access, and it's documented (with example code in Go) here:
https://firebase.google.com/docs/storage/admin/start
I like using Admin in Firebase, because you don't have to worry about project configuration and authentication to the various services. Firebase storage is google cloud storage, but with a nice wrapper and well-integrated into other aspects of your Firebase project. You get some limitations as a trade-off for all of that convenience, but unless you run into a feature of Google Cloud that you absolutely need and doesn't exist in Firebase, I'd stick with the Firebase (and Admin) version.

access google cloud storage with firebase credential

I have a node.js client that uses firebase authentication. Now I want to access Google Cloud Storage, however the firebase SDK for node.js does not include GCS. Using #google-cloud/storage works but only with anonymous access. How do I apply the firebase credential to #google-cloud/storage so that GCS access is in the context of the logged-in user?
Node.js is a server that operates in a privileged environment. The Firebase Admin SDK (aka the Node SDK) talks to other services via a service account.
Firebase Authentication enables client-side authentication. The JavaScript SDK is the client-side SDK.
There is no Node.js client SDK for Firebase that accesses Cloud Storage. Since both the Firebase Admin SDK and the Google Cloud Platform client for Node.js use administrative privileges to access Cloud Storage, it looks like those won't be an option for you either.
The two options I can think of are:
Use the Admin SDK in a Cloud Function, and expose the files from Cloud Storage that way.
Use the REST API for Cloud Storage.
I admit that neither is trivial, so I hope somebody knows a better solution.

Use firebase to access google cloud datastores data

I want to connect my laravel app with google cloud datastore and want to use same data for android and ios application, for that i want to use firebase.
Can any one have idea that how can i access my google cloud datastore's data in firebase ?
You could try using Cloud Functions for Firebase to fetch/query data for you using the Node.js client libraries.
Documentation:
Google Cloud Node SDK for Cloud Datastore
Cloud Functions for Firebase
You could also try Cloud Functions for Firebase and/or Firestore DB instead of Google Cloud Datastore.
Firestore is the next evolution of Firebase (Realtime DB) with better support for scaling & data modeling + offline data management.

Resources