Prerequisites
Before deploying to Firebase App Hosting, ensure you have:- A Firebase project created in the Firebase Console
- Firebase CLI installed (
npm install -g firebase-tools) - Your environment variables configured
Configuration
The project includes anapphosting.yaml configuration file that manages the Firebase App Hosting backend:
Scaling Configuration
ThemaxInstances setting controls how many server instances Firebase will automatically spin up in response to traffic:
- Development: Keep at
1to minimize costs - Production: Increase based on expected traffic (e.g.,
10,25,100)
Deployment Steps
Initialize Firebase App Hosting
Initialize App Hosting in your project:Select your Firebase project and follow the prompts.
Configure Environment Variables
Set your environment variables in the Firebase Console:
- Navigate to your project in the Firebase Console
- Go to App Hosting > Settings
- Add your
RESEND_API_KEYin the environment variables section
Continuous Deployment
Firebase App Hosting supports automatic deployments from your Git repository:- In the Firebase Console, navigate to App Hosting
- Click Connect to GitHub (or your preferred Git provider)
- Select your repository and branch
- Firebase will automatically deploy on every push to the selected branch
Monitoring and Logs
View your application logs and performance metrics:Troubleshooting
Build Failures
If your deployment fails during the build step:- Check the build logs:
firebase apphosting:logs - Verify all dependencies are listed in
package.json - Ensure environment variables are properly configured
Instance Scaling Issues
If you experience performance issues:- Increase
maxInstancesinapphosting.yaml - Monitor usage in the Firebase Console
- Consider upgrading your Firebase plan if needed