Manual setup
Assuming you are using Create React App (CRA) and you want to setup firebase to have 3 distinct ENVs for development of a production application.
devproduat(user acceptance test)
1. Create firebase projects
Create a firebase project for each ENVs from the firebase dashboard/console at console.firebase.google.com
2. Create a web app in firebase for your ENVs
3. Turn on firebase services
For all 3 envs
Create firestore db
Enable cloud functions
Enable hosting
Turn on auth
with preferred auth method eg google/gmail
4. and config credentials to the project
add the Firebase config object values CRA in .env file, see .env.example
In your code add some logic to switch between envs eg
you can then build the CRA app in different
devproduat
Optional other services
5. Google Cloud task
5.1 Setup a google cloud task for each env
Enable cloud task API for all 3 envs from GCP dashboard for these firebase projects
Eg the google cloud task coul be used by the an STT cloud function
5.2 Create a google queue
Create a Google Queue to use with the cloud task (for all 3 envs)
Create a Google Queue (eg firestore-stt) to use Google Task within this project. This is for using GCP STT with firebase cloud functions. See architecture diagram for more info.
If you don't have gcloud you can either set it up, or use the gcp cloud shell, in cloud console for the project.
6 GCP STT (Speech To Text)
To use GCP STT via cloud functions
6.1 Enable GCP STT API for all 3 envs
Enable GCP STT API (for all 3 envs) from GCP dashboard for these firebase projects
6.2 Firestore API Keys in cloud function for STT
Setup Firestore API Keys in cloud function (for all 3 envs)
Login to Firebase Console
Select your project
Project Settings
Under the General Tab
See the Web API key
Set the Firebase web API key as env var for cloud functions, to be able to use to call the GCP STT operation end point, outside of the STT SDK to check progress of a transcription.
more info here This could be used by a cloud function to retrieve data from a STT operation eg
7. deploy the app
eg
Assuming you bundled the react app
eg
This will deploy hosting and cloud function
Successful deployment, will return the hosting url.
TODO: This can be done with npm scripts with less steps.
Links
Last updated
Was this helpful?