# 🚀 Quick Deployment (Simplest Way)

## Just 3 Steps to Go Live

---

## ✅ Step 1: Generate JWT Secret (1 minute)

Run in PowerShell:
```powershell
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
```

Copy the output (long string).

---

## ✅ Step 2: Upload & Setup (10 minutes)

1. **Login to cPanel** → Search "Setup Node.js App" → Click **Create Application**

2. **Fill in**:
   - Application root: `public_html/email-client`
   - Application URL: `https://email.tagneticai.com`
   - Port: `3000`
   - Start file: `npm start`
   - Node version: `20.x`

3. Click **Create** (cPanel handles everything)

---

## ✅ Step 3: Configure (5 minutes)

**Via SSH or cPanel Terminal**:

```bash
cd public_html/email-client
cp .env.example .env
nano .env
```

**Change only these**:
```env
EMAIL_HOST=mail.yourdomain.com
EMAIL_USER=your-email@yourdomain.com
EMAIL_PASSWORD=your-password
JWT_SECRET=<paste your JWT secret from Step 1>
NEXT_PUBLIC_API_URL=https://email.tagneticai.com
```

Save: `Ctrl+O` → Enter → `Ctrl+X`

```bash
npm ci
npm run build
```

**Done!**

---

## 🎉 That's It!

Visit: `https://email.tagneticai.com`

Login with your email credentials.

---

## 🆘 Issues?

**"Can't connect to mail server"**
- Check EMAIL_HOST, EMAIL_USER, EMAIL_PASSWORD

**"502 Bad Gateway"**
- Restart app in cPanel Setup Node.js App

**"Won't start"**
- Run: `npm run build` again

---

## 📁 Before Step 2: Upload Files

**Via WinSCP**:
1. Download https://winscp.net/
2. Connect with cPanel credentials
3. Create: `public_html/email-client/`
4. Drag your project files there

Or **Via SCP**:
```powershell
cd "C:\Path\To\TagneticAI-Email Client"
scp -r app package.json components lib .env.example *.js *.ts username@your-server-ip:~/public_html/email-client/
```

---

**Questions?** See `CPANEL-DEPLOYMENT.md` for details.
