Deployment Architecture
The application uses a dual-environment strategy:| Environment | URL | Purpose | Data |
|---|---|---|---|
| Development | arre-app-dev.web.app | Staging/testing | Test data, wiped frequently |
| Production | arre.app (planned) | Live users | Real user data, backed up |
Currently, all deployments go to
arre-app-dev. A separate production project is planned for future phases.Prerequisites
Before deploying, ensure you have:Manual Deployment
Full Deployment (Frontend + Backend)
Deploy the complete application including Firestore rules, Cloud Functions, and Hosting:Build the application
dist/ directory with production optimizations.- Output
- Selective Deployment
Production Build Process
The build command runs Vite with production optimizations:- Code minification - Reduces bundle size
- Tree shaking - Removes unused code
- Asset optimization - Compresses images and fonts
- Code splitting - Creates efficient chunks
- Environment injection - Embeds
VITE_*variables
Environment Configuration
Local Development
Uses.env file (not committed to git):
.env
CI/CD (GitHub Actions)
Uses GitHub Secrets injected at build time:How Vite Injects Variables
Vite embeds environment variables at build time:Secret Management
GitHub Secrets
Store sensitive values in GitHub repository settings:Add secrets
Required secrets:
| Secret Name | Description |
|---|---|
VITE_FIREBASE_API_KEY | Firebase API key |
VITE_FIREBASE_AUTH_DOMAIN | Auth domain |
VITE_FIREBASE_PROJECT_ID | Project ID |
VITE_FIREBASE_STORAGE_BUCKET | Storage bucket |
VITE_FIREBASE_MESSAGING_SENDER_ID | FCM sender ID |
VITE_FIREBASE_APP_ID | App ID |
FIREBASE_SERVICE_ACCOUNT_ARRE_APP_DEV | Service account JSON |
GEMINI_API_KEY | AI QA agent key |
Firebase Service Account
Generate a service account for CI/CD:Open Firebase Console
Go to Firebase Console
Firebase Console Operations
View Deployment Status
Open Firebase Console
Navigate to Firebase Console - Arre App Dev
Check Hosting
Build > Hosting > Release historyView:
- Current live version
- Deployment timestamp
- Deployed files
- Rollback options
Authentication Setup
Enable sign-in methods:Enable providers
Build > Authentication > Sign-in methodEnable:
- Google (requires support email)
- Anonymous (for dev login)
Without authorized domains, OAuth sign-in will fail with
auth/unauthorized-domain.Production Deployment Strategy
Recommended: Dual-Project Setup
For robust production operations:- Development
- Production
Project:
arre-app-dev- URL:
arre-app-dev.web.app - Purpose: Staging, testing, demo
- Data: Test data, frequently wiped
- Deploy: On every merge to
main
Release Workflow
Rollback
Firebase Hosting retains deployment history for easy rollback:Open Firebase Console
Rollbacks take effect immediately without requiring a rebuild.
Cost Control
Pause Deployment
To stop consumption while keeping data:- Disable Hosting
- Delete Functions
Downgrade Plan
Delete Project
Monitoring
Function Logs
View Cloud Function execution:- Build > Functions >
processMagicImport> Logs
Hosting Metrics
View bandwidth and request metrics:- Build > Hosting > Usage
Firestore Usage
Monitor read/write operations:- Build > Firestore Database > Usage
Troubleshooting
Authentication Fails
Error:auth/unauthorized-domain
Fix: Add domain to authorized domains:
- Firebase Console > Authentication > Settings > Authorized domains
Build Fails
Error:import.meta.env.VITE_FIREBASE_API_KEY is undefined
Fix: Ensure .env file exists with all required variables
Deployment Fails
Error:HTTP Error: 403, The caller does not have permission
Fix: Re-authenticate with Firebase CLI:
Function Cold Starts
Issue: First function invocation is slow (5-10 seconds) Solution: Accept as normal Firebase behavior, or upgrade to always-on instances (paid)Next Steps
Testing
Write and run Playwright E2E tests
CI/CD Pipeline
Understand automated workflows and AI QA agent