Update Firebase MLKit Custom Model file through API - firebase

In the current POC that I have made, I update the Firebase MLKit Custom Model uploaded on the Firebase console manually.
So now every time I train the model with new data, I have to go manually upload the newer model tflite file on the console.
Is there a way to automate this? A Server-To-Server API like we have for FCM?

I know it has been a while since you asked this question, but Firebase ML-Kit has recently released an API to manage your custom models. You can use the Firebase Admin SDKs (Python/Node.js) to achieve this.
See: https://firebase.google.com/docs/ml-kit/manage-hosted-models
I hope this helps you and anyone else looking for a similar solution.

Related

Create and configure Firebase project programmatically

I am building an automation process for my app, which includes creating several new Firebase projects. (After a lot of investigation, I am sure that several projects are needed, and that it cannot be done with just one project).
I am looking for a way to create a new Firebase project from scratch, and enable Phone Auth, Cloud Firestore, and Cloud Storage, along with security rules, programmatically.
I have taken a look at the Firebase Management REST API, which indeed shows a way to create a new Firebase project and link it to an existing GCP project, but couldn't find a way to configure the project itself through the API (Authentication, Firestore, Storage, etc.).
Is there any way to create and configure a Firebase project from scratch, using an API/SDK or CI/CD of some kind?
Thank you!
Have you looked into the firebase-admin SDK? It is a backend-only API because it needs your private key to authenticate against and can therefore not be used in the app directly (shipping your private key with the app would be pretty big security issue!), but as I understand it, creating new firebase-projects is something of a backend activity for you anyway?!
Look at https://firebase.google.com/docs/auth/admin/ for the API's documentation and what you can do with it.
So after a long research, it seems that we can combine the Firebase CLI and the Firebase Admin SDK in order to achieve it.
We can create a new project using the command
firebase projects:create NEW_PROJECT_ID
And then to configure all of the necessary configurations through the admin SDK

Firebase Cloud Firestore "Request/response" documentation

Most of "bigger" project I was working with was using REST API for Frontend->Backend communication. I was using Firebase Cloud Firestore for some small (one-day/hackathon) projects. Now I'm thinking about using Firestore for some bigger project but I'm not sure if this will work.
For "standard", REST api project I had Swagger documentation, where each developer could see list of all endpoints with request/response data structures. How does it work with Firestore? Can I create similar documentation for developers to check data structure, so they will know what can they add and what should they read? Or maybe there is another way?
I'm thinking, maybe there is no tool for this kind of documentation because frontend data structures are defining database structure? But what if I am connecting database from two or more platform (ex. web, mobile and cloud functions)? How can I synchronize knowledge about data structures between all the developers?
I was looking for some answers but couldn't find anything useful expect advice to manually maintain some documentation. How does it work in your projects? Is there some automation? Manually written documentation? Or no documentation - everything "in code"?
I understand your concerns, but unfortunately, there is no such tool available for Cloud Firestore to generate the documentation for database structure as Swagger.
I believe you can do it programatically.
From
Generating Swagger Docs in Firebase Cloud Functions project
I'm using express and nodejs in my Firebase Function implementations, and for me, Swagger doc generation can be implemented via the following libraries:.
https://github.com/scottie1984/swagger-ui-express
https://github.com/Surnet/swagger-jsdoc
You can find other libraries at:
https://swagger.io/tools/open-source/open-source-integrations
In addition to the responses there, the following service allows you to access Firestore metadata, click the explorer tab, looks promising for your use case https://aapi.io/api-directory/Google_CloudFirestore_GoogleCloudFirestoreAPI_v1beta1 though not necessarily more so than the links above.

How to create a firebase project with same structure as an existing one?

I'm working on a product which uses Firebase as its backend. Since firebase exposes the API keys to the user so that could be a security issue. So, after doing some research I've set the database security rules along with API keys restrictions.
But, now I'm unable to use it in local development as well. I was thinking of creating another firebase project and use that as a testing environment and use the existing one as production.
Since the existing project has a lot of data and users. I want everything similar in the new firebase project as well. But I'm unable to find an efficient way to do so. Can anyone please suggest what would be the best option here? Should I create a new testing environment or is there a way to allow me to use the keys locally without it causing a security concern?
Any help would be great. Thank you for your time.
There is no specific command to replicate one project to another, but you can build the necessary functionality yourself with each product's APIs.
For porting users between projects you can use:
The Firebase CLI, which has auth:import and auth:export commands.
The Firebase Admin SDK, which has commands to list all users and import a list of users.
For transferring data between the projects, you can use the API of the relevant database to read/write the data.

Is there any way to use Content Based Recommendation using flutter as frontend and firebase as backend?

I am developing a question answering system app like quora, I want to add content based recommendation to my app so that it can give suggestion while searching question based on users previous seen data and also use the recommendation system for showing the similar content at home page!
Well, there's no direct way and Firebase don't have any packages for recommendation system but what you can do is use tensor flow to build your own model, train it and integrate it in to firebase ML which also use the firebase cloud function feature. That's it, now use firebase cloud function in your flutter project.

Angular Dart firebase Email and Password Authentication

I'm using firebase auth service in my mobile App. Now I'm trying to create a web page using angular-dart. Unfortunately I could not find any guide for email-password firebase authentication sample for angular-dart, like angularfire2 (https://github.com/angular/angularfire2/tree/master/docs). Please help me.
There is package:angular_fire, which is being built by Matan (an AngularDart team member). I'm not sure if it has email+password auth yet, though.
If not, you'd have to roll your own component for this. Outside AngularDart, this is how you'd do that. It should be relatively straightforward to make this into an AngularDart component.
Some time has passed, there are now good examples. FirebaseExtended GitHub Repo has examples for everything Firebase.
The auth example from the repo is here

Resources