This guide will walk you through setting up Firebase and Vertex AI for the Cloud Architect AI project.
Note
For an automated setup experience, you can use the included setup script by running ./setup.sh in the project root directory. The script will guide you through most of the steps below.
- Go to Firebase Console
- Click "Add project"
- Enter a project name (e.g., "cloud-architect-ai")
- Choose whether to enable Google Analytics (recommended)
- Accept the terms and click "Create project"
- Wait for the project to be created and click "Continue"
- In the Firebase console, click on the web icon (</>) to add a web app
- Enter a nickname for your app (e.g., "Cloud Architect AI Web")
- Check the box for "Also set up Firebase Hosting"
- Click "Register app"
- Copy the Firebase configuration object that appears
- Replace the placeholder configuration in
src/lib/firebaseApp.tswith your configuration - Click "Next" and then "Continue to console"
-
Install the Firebase CLI if you haven't already:
npm install -g firebase-tools
-
Log in to Firebase:
firebase login
-
Initialize Firebase in your project directory:
firebase init
-
Select "Hosting" when prompted for features
-
Select your Firebase project
-
Specify "dist" as your public directory
-
Configure as a single-page app: Yes
-
Set up automatic builds and deploys with GitHub: No (unless you want to)
- Go to the Google Cloud Console
- Make sure you're in the same project as your Firebase project
- Navigate to "APIs & Services" > "Library"
- Search for "Vertex AI API"
- Click on it and then click "Enable"
- In the Firebase console, go to "Extensions"
- Click "Browse Extensions"
- Search for "Vertex AI"
- Select "Use Vertex AI with Firebase"
- Click "Install extension"
- Follow the prompts to configure the extension
- Choose the region closest to your users
- Select the Gemini model (gemini-pro)
- Configure authentication as needed
-
Update
.firebasercwith your Firebase project ID:{ "projects": { "default": "YOUR_FIREBASE_PROJECT_ID" } } -
Make sure your
firebase.jsonlooks like this:{ "hosting": { "public": "dist", "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], "rewrites": [ { "source": "**", "destination": "/index.html" } ] } }
-
Build your project:
npm run build
-
Deploy to Firebase:
firebase deploy
-
Your app should now be live at
https://YOUR_PROJECT_ID.web.app
If you encounter authentication issues with Vertex AI:
- Make sure you've enabled billing for your Google Cloud project
- Ensure the service account has the necessary permissions
- Check that the Vertex AI API is enabled
- Verify that the Firebase Extensions for Vertex AI is properly configured
If you encounter issues during deployment:
- Make sure you're logged in to the correct Firebase account
- Verify that your
.firebasercfile has the correct project ID - Ensure that your build process completed successfully
- Check that the "dist" directory exists and contains your built application