# 🚀 Deploy Now - Quick Commands Reference

**Status**: ✅ Ready to Deploy  
**For**: Immediate deployment  
**Time**: 15 minutes

---

## 🎯 ONE-TIME SETUP (First Time Only)

### Step 1: Install Firebase Tools

```bash
# Install globally (once per machine)
npm install -g firebase-tools

# Verify installation
firebase --version
```

### Step 2: Login to Firebase

```bash
# Opens browser to login
firebase login

# Verify you're logged in
firebase projects:list
```

### Step 3: Select Project

```bash
# Set default project
firebase use findvault-55a8e

# Verify selection
firebase projects:list
# Should show: findvault-55a8e (active)
```

---

## ✅ CUSTOMIZATION (Do This Before Deploying!)

### Update YouTube Videos (Required)

**Open**: `index.html`  
**Go to**: Line ~1360  
**Replace all 3 video URLs:**

```html
<!-- BEFORE -->
onclick="playVideo('https://www.youtube.com/embed/dQw4w9WgXcQ')"

<!-- AFTER (Use YOUR video IDs) -->
onclick="playVideo('https://www.youtube.com/embed/YOUR_VIDEO_ID_1')"
onclick="playVideo('https://www.youtube.com/embed/YOUR_VIDEO_ID_2')"
onclick="playVideo('https://www.youtube.com/embed/YOUR_VIDEO_ID_3')"
```

### Update Social Media Links (Recommended)

**Open**: `index.html`  
**Go to**: Line ~1363  
**Update 4 links:**

```html
<!-- WhatsApp -->
<a href="https://wa.me/YOUR_COUNTRY_CODE_AND_NUMBER" target="_blank">

<!-- Telegram -->
<a href="https://t.me/YOUR_CHANNEL" target="_blank">

<!-- Instagram -->
<a href="https://instagram.com/YOUR_HANDLE" target="_blank">

<!-- Twitter -->
<a href="https://twitter.com/YOUR_HANDLE" target="_blank">
```

### Update Support Email

**Open**: `index.html`  
**Go to**: Line ~1573  
**Update:**

```html
<!-- BEFORE -->
<a href="mailto:support@findvault.in">

<!-- AFTER -->
<a href="mailto:YOUR_EMAIL@domain.com">
```

---

## 🚀 DEPLOY TO PRODUCTION (Main Command)

### Single Command to Deploy Everything

```bash
firebase deploy
```

**What this does:**
- ✅ Deploys website (hosting)
- ✅ Deploys Firestore rules (security)
- ✅ Deploys functions (backend)
- ✅ Deploys configuration

**Time**: 2-3 minutes

**Output**: Shows deployment status and live URL

### Deploy Specific Parts (Optional)

```bash
# Just hosting (website only)
firebase deploy --only hosting

# Just Firestore rules (security only)
firebase deploy --only firestore:rules

# Just functions (backend only)
firebase deploy --only functions

# Just storage (file storage)
firebase deploy --only storage
```

---

## ✅ VERIFY DEPLOYMENT SUCCESS

### Check Deployment Status

```bash
# View recent deployments
firebase deploy:list

# View specific deployment details
firebase projects:describe findvault-55a8e
```

### Open Live Website

```bash
# Opens in default browser
firebase open hosting

# Or visit manually
https://findvault-55a8e.web.app
```

### View Functions Logs (If Used)

```bash
firebase functions:log
```

### View Hosting Logs

```bash
firebase hosting:disable  # WARNING: Disables site
firebase hosting:enable   # Re-enables site
```

---

## 🧪 TESTING AFTER DEPLOYMENT

### Test 1: Help Widget

```
1. Go to https://findvault-55a8e.web.app
2. Scroll bottom-right
3. See 💬 button ✓
4. Click to expand ✓
5. See menu with options ✓
```

### Test 2: Video Guides

```
1. Scroll to Video section
2. See 3 video cards ✓
3. Click any video ✓
4. Modal opens with YouTube ✓
5. Video plays ✓
```

### Test 3: Fraud Detection

```
1. Go to /activate.html?tag=TEST123
2. Fill form, activate tag
3. Open /scan.html?id=TEST123 from DIFFERENT device
4. See "Tag Locked" message ✓
5. Check admin fraud alerts ✓
```

### Test 4: Mobile Responsive

```
1. Open site on mobile phone
2. Help widget visible ✓
3. Help cards stack properly ✓
4. Videos responsive ✓
5. All buttons clickable ✓
```

### Test 5: Console Check

```
1. Press F12 (open DevTools)
2. Go to Console tab
3. Should see NO red errors ✓
4. Should see NO warnings ✓
5. Firebase should be connected ✓
```

---

## 🔄 ROLLBACK (If Needed)

### View Previous Versions

```bash
firebase hosting:channels:list
```

### Rollback to Previous Version

```bash
# Deploy to a channel first (safe backup)
firebase hosting:channel:deploy my-backup

# View all versions
firebase hosting:channels:list

# Rollback command
firebase deploy --only hosting
# Then re-deploy latest from your code
```

---

## 📊 MONITORING AFTER DEPLOY

### Check Real-Time Logs

```bash
# Follow logs in real-time
firebase functions:log --follow

# View hosting metrics
firebase projects:describe findvault-55a8e
```

### Check Firestore (Data Monitoring)

```bash
# List all collections
firebase firestore:bulk-export

# Import from backup
firebase firestore:bulk-import
```

### Enable Error Tracking

**In Firebase Console:**
1. Click on Error Reporting
2. Set up notifications
3. Get alerts for errors

---

## 🆘 TROUBLESHOOTING

### Issue: "Project not found"

```bash
# Fix: Check if project is set
firebase projects:list

# Solution: Set correct project
firebase use findvault-55a8e
```

### Issue: "Deployment failed"

```bash
# Fix: Check Firebase CLI version
firebase --version

# Update if old
npm install -g firebase-tools@latest

# Then retry
firebase deploy
```

### Issue: "Rules invalid"

```bash
# Fix: Validate rules before deploying
firebase firestore:rules:validate

# Then check syntax and retry
firebase deploy --only firestore:rules
```

### Issue: "Site shows 404"

```bash
# Fix: Clear browser cache
# Chrome: Ctrl+Shift+Delete (Windows) or Cmd+Shift+Delete (Mac)

# Then reload
https://findvault-55a8e.web.app

# If still not working:
firebase hosting:channel:delete live  # Careful!
firebase deploy --only hosting
```

---

## 📈 PERFORMANCE MONITORING

### View Hosting Analytics

**In Firebase Console:**
1. Click Hosting
2. See traffic, usage, performance
3. Monitor from dashboard

### Check Page Load Speed

```bash
# Use Lighthouse (Chrome built-in)
1. Open DevTools (F12)
2. Click Lighthouse tab
3. Click "Generate report"
4. See performance metrics
```

### Monitor Real-Time Users

**In Firebase Console:**
1. Click Analytics
2. Real-time users dashboard
3. See live visitor count

---

## 🔐 SECURITY AFTER DEPLOY

### Verify SSL/HTTPS

```bash
# Check certificate
https://findvault-55a8e.web.app
# Click padlock → Certificate details
# Should show valid HTTPS ✓
```

### Check Security Headers

**In browser (Chrome):**
1. Press F12
2. Click Network tab
3. Reload page
4. Click HTML response
5. Check Response Headers
6. Should see:
   - X-Content-Type-Options ✓
   - X-Frame-Options ✓
   - Strict-Transport-Security ✓

### Verify Firestore Security

**In Firebase Console:**
1. Click Firestore
2. Click Rules tab
3. Should show your rules ✓
4. Status: "Published" ✓

---

## 💾 BACKUP & RECOVERY

### Create Backup

```bash
# Export all Firestore data
firebase firestore:bulk-export

# Downloaded to: firestore-export
```

### Restore from Backup

```bash
# Import previously exported data
firebase firestore:bulk-import ./firestore-export
```

### Automatic Backups (Firebase Premium)

**In Firebase Console:**
1. Click Firestore
2. Click Backups
3. Enable automatic backups
4. Choose schedule

---

## 📞 SUPPORT COMMANDS

### Get Firebase Project Info

```bash
firebase projects:describe findvault-55a8e
```

### View Billing Status

```bash
# Opens Firebase billing dashboard
firebase open billing
```

### Contact Firebase Support

```bash
# Opens Firebase support page
firebase open support
```

### View Documentation

```bash
# Opens Firebase docs
firebase open documentation
```

---

## ⚡ QUICK REFERENCE - Common Tasks

### Most Common: Full Deploy
```bash
firebase deploy
```

### Just Website Changed
```bash
firebase deploy --only hosting
```

### Security Rules Changed
```bash
firebase deploy --only firestore:rules
```

### View Live Site
```bash
firebase open hosting
```

### View Admin Dashboard
```bash
# Manual URL:
https://findvault-55a8e.web.app/admin.html
```

### Monitor Fraud Alerts
```bash
# In admin dashboard:
1. Go to /admin.html
2. Click "🚨 Fraud Alerts" tab
3. See real-time alerts
```

### Deploy + Test
```bash
firebase deploy && firebase open hosting
```

---

## 📋 DEPLOYMENT CHECKLIST

Before running `firebase deploy`:

- [ ] YouTube URLs updated (3 videos)
- [ ] Social media links updated (4 links)
- [ ] Support email updated
- [ ] Emergency numbers correct
- [ ] No local changes uncommitted
- [ ] Browser cache cleared
- [ ] No console errors
- [ ] All features tested

After running `firebase deploy`:

- [ ] Deployment shows "✅ Deploy complete"
- [ ] Site loads at findvault-55a8e.web.app
- [ ] Help widget visible
- [ ] Fraud alerts working
- [ ] Admin dashboard accessible
- [ ] No 404 errors
- [ ] Mobile responsive
- [ ] Console clear of errors

---

## 🎊 DEPLOYMENT COMPLETE!

**When you see:**
```
✅ Deploy complete!
✅ Visit your site at: https://findvault-55a8e.web.app
```

**You're done! 🎉**

Your FindVault is now LIVE in production with:
- ✅ All features working
- ✅ Security active
- ✅ Admin dashboard ready
- ✅ Help system active
- ✅ Fraud detection running
- ✅ Monitoring enabled

---

## 🚀 NEXT STEPS

1. **Test**: Verify all features work
2. **Monitor**: Watch fraud alerts dashboard
3. **Support**: Help first users
4. **Optimize**: Fix any performance issues
5. **Scale**: Plan for growth

---

## 📚 Need More Help?

- **Setup Issues**: Read FIREBASE_CONFIG.md
- **Feature Help**: Read HELP_FEATURES_GUIDE.md
- **Security Details**: Read SECURITY.md
- **Full Checklist**: Read FINAL_PRODUCTION_CHECKLIST.md
- **Complete Index**: Read MASTER_PRODUCTION_INDEX.md

---

**Version**: 1.0  
**Status**: ✅ Ready  
**Last Updated**: February 3, 2026

**Remember: Deploy is just ONE command: `firebase deploy`** ✨
