✓ Dockerfile - Container image for FastAPI backend
✓ .dockerignore - Docker build optimization
✓ cloudbuild-backend.yaml - Cloud Build pipeline (backend)
✓ cloudbuild-frontend.yaml - Cloud Build pipeline (frontend)
✓ firebase.json - Firebase Hosting configuration
✓ .github/workflows/deploy-backend.yml - Auto-deploy backend
✓ .github/workflows/deploy-frontend.yml - Auto-deploy frontend
✓ setup-gcp.sh - Linux/macOS setup script
✓ setup-gcp.ps1 - Windows PowerShell setup script
✓ DEPLOYMENT_SETUP_COMPLETE.md - Complete setup guide (START HERE!)
✓ QUICK_DEPLOY.md - 5-minute quickstart
✓ DEPLOYMENT_GUIDE.md - Detailed reference guide
✓ DEPLOYMENT_COMMANDS.md - Copy-paste commands
✓ README.md - Updated with deployment info
1. Run setup script (setup-gcp.ps1 or setup-gcp.sh)
↓
2. Save output values
↓
3. Add GitHub secrets (6 secrets)
↓
4. Push to main branch
↓
5. Watch GitHub Actions deploy automatically
✅ Backend live on Cloud Run
✅ Frontend live on Firebase Hosting
✅ Auto-scaling enabled
✅ CDN configured
✅ Firestore connected
Users
↓
Firebase Hosting CDN
├─ Frontend (Next.js)
├─ API Routing
└─ Static Assets
↓
Google Cloud Load Balancer
↓
Cloud Run (Auto-scaling)
├─ Backend API (FastAPI)
├─ 2GB Memory per instance
├─ 2 CPU cores per instance
└─ Max 100 instances
↓
Firestore Database
├─ Sessions
├─ Messages
├─ Contracts
└─ Analysis Results
↓
Cloud Storage
├─ PDF Documents
├─ Reports
└─ Backups
| Component | Local | Production |
|---|---|---|
| Frontend | http://localhost:3000 | https://PROJECT_ID.web.app |
| Backend | http://localhost:8000 | https://legalmind-backend-PROJECT_ID.cloudfunctions.net |
| API Docs | http://localhost:8000/docs | https://legalmind-backend-PROJECT_ID.cloudfunctions.net/docs |
| Database | Firestore (emulator) | Firestore (cloud) |
| Storage | Local | Cloud Storage |
✓ legalmind-backend@PROJECT_ID.iam.gserviceaccount.com
- Permissions: Firestore, Cloud Storage, Logs, Secrets
✓ github-actions@PROJECT_ID.iam.gserviceaccount.com
- Permissions: Cloud Run, Container Registry
✓ Workload Identity Federation
- GitHub Actions authenticate without passwords/keys
- OIDC tokens for secure CI/CD
✓ Cloud Run API
✓ Firestore API
✓ Cloud Storage API
✓ Cloud Build API
✓ Container Registry API
✓ Firebase API
✓ Secret Manager API
✓ Cloud Logging API
✓ Cloud IAM API
| Service | Free Tier | Usage | Cost |
|---|---|---|---|
| Cloud Run | 2M req/month | ~10k req/day | $0-5 |
| Firestore | 25k reads/day | ~5k reads/day | $0 |
| Firestore | 25k writes/day | ~2k writes/day | $0 |
| Cloud Storage | 5GB/month | ~2GB | $0 |
| Firebase Hosting | 10GB/month transfer | ~2GB | $0 |
| TOTAL | $0-5/month |
- Cold Start: 2-3 seconds (first request after idle)
- Warm Response: 50-200ms (typical request)
- Scalability: 0 to 100 instances (auto)
- Availability: 99.95% SLA
- Timeout: 3600 seconds (1 hour)
- CDN: Global edge locations
- Page Load: <1 second (cached)
- Availability: 99.95% SLA
- HTTPS: Automatic SSL/TLS
- Minification: Automatic
- Response Time: <10ms (typical)
- Availability: 99.999% SLA
- Consistency: Strong (reads) / Eventually (writes)
- Scalability: Unlimited collections
- Throughput: 25k reads/writes per second (free tier)
- HTTPS/TLS encryption
- DDoS protection
- Auto-scaling
- Load balancing
- Automated backups (Firestore)
- CDN caching
- Firewall rules
- Request logging
- Error tracking
- Performance monitoring
- Custom domain
- Email alerts
- Advanced monitoring
- Budget alerts
- Multi-region deployment
- Disaster recovery
- WAF (Web Application Firewall)
- VPC networking
- ✅ Verify both frontend and backend are live
- ✅ Test API endpoints with Postman/curl
- ✅ Verify Firestore connection
- ✅ Check logs for errors
- ✅ Set up monitoring and alerts
- ✅ Configure custom domain (optional)
- ✅ Enable analytics
- ✅ Load test the application
- ✅ Optimize cold starts
- ✅ Enable caching strategies
- ✅ Set up CI/CD pipeline improvements
- ✅ Implement APM (Application Performance Monitoring)
- ✅ Cost optimization
- ✅ Security hardening
- ✅ Disaster recovery testing
- ✅ Performance tuning
| Issue | Solution |
|---|---|
| Deploy Failed | Check GitHub Actions logs → Cloud Run logs |
| API 403 Forbidden | Enable unauthenticated access on Cloud Run |
| Frontend Not Loading | Check Firebase Hosting deployment status |
| Database Connection Error | Verify service account has Firestore permissions |
| Cold Start Too Slow | Set min instances to 1 (costs $10-15/month) |
| Out of Storage Quota | Enable Cloud Storage lifecycle policies |
| High Costs | Check Cloud Run min instances, set to 0 |
- 📖 DEPLOYMENT_SETUP_COMPLETE.md - Full setup instructions
- 📖 QUICK_DEPLOY.md - 5-minute guide
- 📖 DEPLOYMENT_GUIDE.md - Advanced configuration
- 📖 DEPLOYMENT_COMMANDS.md - Copy-paste commands
- 🔗 Google Cloud Documentation
- 🔗 Firebase Documentation
- 🔗 Cloud Run Guide
- GitHub repository pushed to main branch
- Google Cloud Project created
- gcloud CLI installed locally
- Docker installed locally
- Node.js 18+ installed
- Git credentials configured
- All environment variables set
- Backend URL accessible and responding
- Frontend loads in browser
- API documentation visible at
/docs - Firestore data syncing properly
- Cloud Storage buckets created
- GitHub Actions workflows passing
- Logs visible in Cloud Logging
- All 6 GitHub secrets added
Status: ✅ Ready for Deployment
Total Setup Time: ~10 minutes Total Configuration Files: 11 Documentation Pages: 5
Your LegalMind project is fully configured for production deployment on Google Cloud!
🚀 Ready to deploy? Start with DEPLOYMENT_SETUP_COMPLETE.md