# How to Upload CompareKit to cPanel

## The .htaccess Problem (You're Here)

You're getting a "403 Forbidden" error because of the .htaccess file. Let's fix this:

### Solution 1: Delete .htaccess for Now (Quickest)

**For now, just delete or don't upload the .htaccess file at all.**

The app will work fine without it once Node.js is running. The .htaccess is only needed for:
- Preventing directory listings (cosmetic)
- Routing (only needed if Node.js isn't running)

### Solution 2: Upload .htaccess Correctly

If you want to upload it:

1. **In cPanel File Manager:**
   - Make sure "Show Hidden Files" is enabled (Settings)
   - Upload `htaccess.txt`
   - Rename it to `.htaccess` (with the dot)
   - Right-click → "Change Permissions" → Set to `644`

2. **Or via FTP:**
   - Upload as `htaccess.txt`
   - Rename to `.htaccess` after upload
   - Set permissions to 644

---

## Recommended Upload Method (Without .htaccess Issues)

### Method A: Skip .htaccess Entirely

**Just upload everything EXCEPT .htaccess**

The app will work fine once Node.js is configured. You don't need .htaccess.

**Upload these files/folders:**
```
CompareKit/
├── src/
├── public/
├── cache/
├── generated/
├── node_modules/           (upload if pre-installed locally)
├── package.json
├── package-lock.json
├── .env
├── setup.js
├── index.html              (root index.html for status)
├── README.md
├── GETTING-STARTED.md
└── CPANEL-DEPLOYMENT.md
```

**DO NOT upload:**
- `.htaccess` (causes your current error)
- `.git/` (if exists)
- `test-output.png`
- Any local test files

---

## Step-by-Step: Complete Upload Process

### Step 1: Prepare Files Locally

In your local CompareKit folder:
```bash
# Remove problematic files
rm .htaccess
rm -rf .git
rm -rf node_modules  # Will reinstall on server
```

### Step 2: Zip the Folder

```bash
# On Mac/Linux
cd /Users/rogzim/Projects
zip -r CompareKit.zip CompareKit -x "*.git*" -x "*node_modules*" -x "*.htaccess"

# Or just compress CompareKit folder using Finder/Windows Explorer
```

### Step 3: Upload to cPanel

1. Log into **cPanel**
2. Go to **File Manager**
3. Navigate to `public_html/`
4. Click **Upload**
5. Upload `CompareKit.zip`
6. Right-click → **Extract**
7. Delete the .zip file after extraction

### Step 4: Set Up Node.js App

1. In cPanel, find **"Setup Node.js App"**
2. Click **"Create Application"**
3. Fill in:
   ```
   Application root: public_html/CompareKit
   Application URL: /CompareKit
   Application startup file: src/server.js
   Node.js version: 18.x (or latest)
   ```
4. Click **Create**

### Step 5: Install Dependencies

1. In the Node.js app interface
2. Click **"Run NPM Install"** button
3. Wait 2-3 minutes

### Step 6: Set Environment Variables (Optional)

Add these in the Node.js app interface:
```
NODE_ENV = production
PORT = (leave as auto-assigned)
```

### Step 7: Start Application

1. Click **"Start"** or **"Restart"**
2. Wait 10 seconds
3. Visit: `https://kodepilot.com/CompareKit/`

---

## What If Node.js Setup Isn't Available?

### Option A: Check for Node.js Support

1. Search cPanel for:
   - "Node.js"
   - "Application Manager"
   - "Setup Node.js App"
   - "CloudLinux Node.js Selector"

2. If not found, **contact your hosting provider**:
   ```
   Subject: Enable Node.js Support

   Hi, I need to run a Node.js application on my hosting account.
   Can you please enable Node.js support or let me know if it's available?

   I need Node.js 18.x or higher.

   Thanks!
   ```

### Option B: Deploy Elsewhere (Recommended if no Node.js)

If your hosting doesn't support Node.js, deploy to:

#### Vercel (Easiest, Free)

1. Install Vercel CLI:
   ```bash
   npm install -g vercel
   ```

2. In your CompareKit folder:
   ```bash
   vercel
   ```

3. Follow prompts, done!

#### Railway (Free)

1. Go to https://railway.app
2. Click "Start a New Project"
3. Connect GitHub or upload files
4. Deploy automatically

#### Render (Free)

1. Go to https://render.com
2. Create Web Service
3. Connect repo or upload
4. Auto-deploys

---

## Testing After Upload

### If Node.js is Running:

Visit: `https://kodepilot.com/CompareKit/`

You should see the CompareKit interface.

### If Node.js Isn't Running Yet:

Visit: `https://kodepilot.com/CompareKit/index.html`

You should see a setup status page (not directory listing).

### Health Check:

```bash
curl https://kodepilot.com/CompareKit/health
```

Should return:
```json
{
  "status": "ok",
  "service": "CompareKit",
  "version": "1.0.0"
}
```

---

## Common Issues & Solutions

### "Directory Listing Showing"
- **Cause:** Node.js not running, no index.html in root
- **Fix:** Make sure `index.html` is in the CompareKit root folder

### "403 Forbidden"
- **Cause:** .htaccess syntax error or wrong permissions
- **Fix:** Delete .htaccess file, you don't need it

### "404 Not Found"
- **Cause:** Wrong path or app not started
- **Fix:** Check Node.js app is "Running" in cPanel

### "500 Internal Server Error"
- **Cause:** Node.js crashed or dependencies not installed
- **Fix:** Check error logs in cPanel Node.js app interface

---

## Quick Reference

**Your URL:** `https://kodepilot.com/CompareKit/`

**Files That Must Be Uploaded:**
- ✅ src/ folder
- ✅ public/ folder
- ✅ package.json
- ✅ .env (if configured)
- ✅ index.html (root)

**Files to SKIP:**
- ❌ .htaccess (causing your current issue)
- ❌ node_modules/ (reinstall on server)
- ❌ .git/

**After Upload:**
1. Set up Node.js app in cPanel
2. Run NPM Install
3. Start application
4. Visit your URL

---

Need help? Let me know what error you're seeing!
