This guide explains how to deploy your Angular CRUD app to Vercel with Firebase configuration.
Make sure all changes are committed and pushed:
git add .
git commit -m "Add Vercel deployment configuration"
git push origin main- Go to Vercel Dashboard
- Click "Add New..." → "Project"
- Import your GitHub repository
- Vercel will auto-detect it as an Angular project
Before deploying, add these environment variables in Vercel:
In Vercel Dashboard → Your Project → Settings → Environment Variables
Add the following variables:
| Variable Name | Value | Description |
|---|---|---|
FIREBASE_API_KEY |
Your Firebase API Key | From Firebase Console |
FIREBASE_AUTH_DOMAIN |
your-project.firebaseapp.com |
Firebase Auth Domain |
FIREBASE_PROJECT_ID |
your-project-id |
Firebase Project ID |
FIREBASE_DATABASE_URL |
https://your-project-default-rtdb.firebaseio.com |
Realtime Database URL |
FIREBASE_STORAGE_BUCKET |
your-project.firebasestorage.app |
Firebase Storage Bucket |
FIREBASE_MESSAGING_SENDER_ID |
1097055780760 |
Firebase Messaging Sender ID |
FIREBASE_APP_ID |
1:1097055780760:web:xxxxx |
Firebase App ID |
- Go to Firebase Console
- Select your project
- Click the ⚙️ icon → Project settings
- Scroll down to Your apps section
- Click on your web app or create one
- Copy the config values
Example Firebase config:
{
apiKey: "AIzaSyBpS40iQ-UVgPYsWOW6BqwShOQJYEoan_8",
authDomain: "mis-clientes2-6d900.firebaseapp.com",
databaseURL: "https://mis-clientes2-6d900-default-rtdb.firebaseio.com",
projectId: "mis-clientes2-6d900",
storageBucket: "mis-clientes2-6d900.firebasestorage.app",
messagingSenderId: "1097055780760",
appId: "1:1097055780760:web:022e23ed9ff15ead7db5ed"
}Once environment variables are set:
- Click "Deploy" in Vercel
- Wait for the build to complete
- Your app will be live at
https://your-app.vercel.app
The deployment uses a custom build script (scripts/set-env.js) that:
- Reads environment variables from Vercel
- Generates
environment.tsandenvironment.development.tsfiles - Runs the Angular build with proper Firebase configuration
This keeps your Firebase credentials secure and out of the repository.
- ✅ Environment files (
environment.ts,environment.development.ts) are in.gitignore - ✅ Credentials are stored as Vercel environment variables
- ✅ The
set-env.jsscript generates files during build time - ✅ Never commit Firebase credentials to the repository
Solution: Make sure you've added all 4 environment variables in Vercel settings.
Solution:
- Verify environment variables are correct
- Check Firebase Console that your domain is authorized
- Add your Vercel domain to Firebase Authorized domains:
- Firebase Console → Authentication → Settings → Authorized domains
- Add:
your-app.vercel.app
Solution: Add your Vercel domain to Google OAuth:
- Firebase Console → Authentication → Sign-in method → Google
- Add your Vercel domain to authorized domains
After deployment, test these features:
- ✅ Home page loads
- ✅ User registration works
- ✅ Email/password login works
- ✅ Google Sign-In works
- ✅ Password recovery works
- ✅ User profile page loads
- ✅ Employee CRUD operations work
Every git push to main will automatically trigger a new deployment.
git add .
git commit -m "Your changes"
git push origin mainVercel will automatically build and deploy the new version.