How to create new firebase db programmatically through API - javascript

I would like to create a separate firebase db for every client inside my firebase account. I don't want the client data to be a sub-branch of one single database. How do I achieve this without using the dashboard UI from firebase? I need to do it programmatically because there are many steps involved, e.g.:
Creation of an client administrator user
Creation of a predefined client database structure
Creation of a license for the client
Store information about the new client inside my license database (separate firebase db)
Creating separate backup script for every single client db
How do I set or get the secret of the new created database via API (programmatically)?
Any help is appreciated

As Kato answered on your related Github question:
There is no programmatic way to create a project. There is also a limit on the number of free projects you can create.

It is possible to create firebase projects, databases, apps using firebase tools.
Please refer to
firebase tools and documentation

Related

Fetching data from DynamoDB using node js

I have an application related to catalog of APIs, now I wanted to have a html page where it should display usage analytics like No of users registered with the application, No of API’s, etc.
i wanted to host this page on AWS and the data related to users and APIs will be stored in DynamoDB. I want to retrieve this information into my application using nodejs.
What should i do exactly to achieve this, any references would be helpful.

How to connect from react to google cloud storage and get private object

I am trying to connect with React to google cloud storage but I can't any suggestions. Basically, I want to view private objects from the bucket in google cloud storage directly from React.JS. Anyone, please help me how I get the private objects in the google cloud bucket from React.JS, Thanks
Signed URLs would be the best fitting solution for the problem you are describing, but if it's not an option for other reasons I would say that you will have to create a backend endpoint that retrieves that image impersonating a Service Account which will have an access that does not expire.
In summary, you are going to have to choose were to are going to compromise, either creating extra calls to your backend or extra operations to retrieve new Signed URLs after 7 days.

Best database for daily data?

I'm currently working on a project where I'll be tracking daily data for around 30 fictive companies. Every company has a name, rank and balance. I want to track the rank and balance by saving the data everyday.
Now my question is how to store this data, should I use csv files, Json files, or a database? And if thats the case, wat database should I use as a beginner?
My project is build in javascript with nodejs and discordjs.
You can add timestamps in json, you should take a look at it!
Since you're using discordjs, If I am not wrong you would be fetching details using the discord api. So for data storage you can go for firebase either Realtime database or firestore database. It's super easy to implement and easily scalable and there are too lot of additional feature you will get along. This way your database will be easily fetchable from anywhere also.
Also you can anytime download your database into csv. Here is the the official firebase node-js sdk documentation.

subscribe and unsubscribe to topic - firebase

I am developing a website in HTML, JS, and CSS. My result is a PWA (Progressive Web App). It works really great. I am hosting and serving it via the Firebase Hosting and enjoy many functions of firebase. To let the user feel the full power of a PWA I need to manage Push Notifications. For that, I want to use Firebase Cloud Messaging. I already know how to send push notifications and so on. On my webpage, the users can subscribe to topics. And here we go. I do not know how to subscribe/unsubscribe a user to a topic via the javascript without the admins SDK. Can please provide somebody a clear and simple example for subscribe/unsubscribe users? From the documentation, I will not be smart.
Thanks in advance,
Filip.
I would do it like that:
(I assume you have users tokens stored somwhere in the database ordered by users id)
Create table 'topics' - store users ids there.
Create form - let the user add its id to the 'topic' table.
Then, before sending FCM, store every token, from owners which ids are assigned to the specific topic in the 'topic' table.

Javascript creating hubs?

I have an express server setup that is handling all of my routing and session stuff. I want the system to work so that when a user is logged in they are able to connect to a "hub" like entity that is uniquely based on the location of the "hub". I thought about working it like each of the "hubs" is a collection in a database, but the way it works is that a user connects to the "hub" and then disconnects from it when they are done but can connect to different "hubs" based on a location. How should I go about creating a unique group of "hub" like things that all act as objects with storable data?
Instead of connecting to a "hub", why not just present them with different information from a database based on their location. The user will never really connect to anything other than your single backend. Unless, ofcourse, you set up different servers all over the world (known as a CDN, and probably a bit too much effort).
If you're using express, you could use something like mongodb for data storage.
With mongodb you get the mongoose npm package. With that, you can create Schemas. You could have different Schemas as "hubs" and load the correct ones based on location data. That would let the user see different information for different locations.

Categories