Search code examples
firebasegoogle-cloud-platformgoogle-cloud-firestorecontinuous-integrationfirebase-tools

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!


Solution

  • 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