Firebase
Learn how to deploy Transcript Seeker to Firebase.
Setup
Before deploying to Firebase, you need to configure the .env.production.local
files for each app.
Please follow this guide to set up environment variables.
Change the NODE_ENV
to production
in the terminal:
Firebase Hosting
For more information on Firebase Hosting, refer to the official Firebase Hosting Documentation.
Create a Firebase Project
If not already, create a Firebase project in the Firebase Console:
- Create a project named Transcript Seeker.
- Then, create a new web app:
transcript-seeker-proxy
: Replacetranscript-seeker-proxy
infirebase.json
and.firebaserc
with this new ID.
- Navigate to Hosting and click "Get Started."
- Finally, Replace
transcript-seeker-bdc29
infirebase.json
and.firebaserc
with your project id. (This is for firebase hosting, when you click on get started it automatically creates a hosting project with ur app id)
Install Firebase CLI Globally
Always ensure you have the latest version of the Firebase CLI installed.
Make sure to use version
^11.18.0
or higher to deploy nodejs18
functions.
Log in to Firebase
Use the Firebase CLI to log into your Firebase account.
Google Cloud Run
For more information on installation and the Google Cloud CLI, check out the official Google Cloud CLI Documentation.
If you're using the devcontainer configuration provided by this repository, the GCloud CLI will be automatically installed.
Initialize Google Cloud CLI
This command will prompt you to log in and select the project you're working on.
Deployment
Proxy Deployment
You need to be on the Blaze plan to use Nitro with cloud functions.
Set Up Firebase Functions
In the Firebase Console:
- Navigate to Functions and click "Get Started."
This completes the Firebase setup.
Build and Deploy
To deploy to Firebase Hosting, first build the Nitro app, then deploy:
API Deployment
The API cannot be deployed to Firebase functions. Instead, we are using Google Cloud Run.
Create a Cloud Run Service
The following command will create a Cloud Run service. Modify the SERVICE_NAME
to suit your needs.
Build and Deploy the Cloud Run Service
The command below builds and deploys the Cloud Run service. Modify the SERVICE_NAME
and GITHUB_USERNAME
to suit your needs.
The below command assumes you are using a git repository. If you are not, you
can replace COMMIT_SHA
with a unique identifier.
If you have already deployed the frontend and are encountering a CORS error, it may be due to the API being built for production. Once the build is complete, the CORS error should be resolved.
Frontend Deployment
Build and Deploy
To deploy the frontend to Firebase Hosting, build the project and deploy: