# cPanel Quick Start Guide (No Terminal Needed!)

## Simple 7-Step Deployment

### Step 1: Prepare Files on Your Computer

1. Download/copy your farm-website folder
2. Open the folder and DELETE the `node_modules` folder (if it exists)
3. Create a ZIP file of the entire folder

### Step 2: Upload to cPanel

1. Login to your cPanel
2. Open **File Manager**
3. Go to `public_html` folder
4. Click **Upload** button (top right)
5. Upload your ZIP file
6. After upload, go back to File Manager
7. Find your ZIP file, right-click → **Extract**
8. Delete the ZIP file after extraction

### Step 3: Setup Node.js App

1. In cPanel, search for **"Setup Node.js App"** (usually in Software section)
2. Click **"Create Application"**
3. Fill in the form:
   - **Node.js version**: Select latest (14.x or higher)
   - **Application mode**: Production
   - **Application root**: `/home/YOUR_USERNAME/public_html/farm-website`
     (Replace YOUR_USERNAME with your actual cPanel username)
   - **Application URL**: Select your domain
   - **Application startup file**: `server.js`
4. Click **"Create"**

### Step 4: Install Dependencies (EASIEST WAY)

After creating the app, you'll see your application listed.

**Look for the "Run NPM Install" button and click it!**

- Wait 1-2 minutes
- You'll see "NPM install completed successfully"
- If you don't see this button, see Alternative Method below

**Alternative Method:**

1. On your LOCAL computer (not cPanel):
   ```bash
   npm install --production
   ```

2. ZIP the ENTIRE folder (now including node_modules)

3. Upload this new ZIP to cPanel and extract it

4. Skip the "Run NPM Install" step since modules are already included

### Step 5: Create Uploads Folder

1. In **File Manager**, navigate to your app folder
2. Click **"+ Folder"** button
3. Name it: `uploads`
4. Right-click the `uploads` folder → **"Change Permissions"**
5. Set to **755** (check the boxes: Owner all, Group read+execute, World read+execute)
6. Click **"Change Permissions"**

### Step 6: Start the Application

1. Go back to **"Setup Node.js App"**
2. Find your application in the list
3. Click the **"Start"** or **"Restart"** button
4. Wait for status to show **"Running"** (green indicator)

### Step 7: Test Your Website

1. Visit your domain (e.g., `http://yourdomain.com`)
2. You should see your farm website!
3. Test admin panel: `http://yourdomain.com/admin/login`
   - Username: `admin`
   - Password: `admin123`

## Troubleshooting

### "Application won't start" or "Error 503"

**Solution 1: Check the path**
- Make sure Application root path is correct
- It should be: `/home/YOUR_USERNAME/public_html/farm-website`
- Replace YOUR_USERNAME with your actual cPanel username

**Solution 2: Reinstall dependencies**
- Click "Run NPM Install" button again
- Or upload with node_modules included (see Step 4 Alternative Method)

**Solution 3: Check startup file**
- Make sure "Application startup file" is set to: `server.js`
- Not `index.js` or anything else

### "Run NPM Install button doesn't work"

**Use the Manual Method:**

1. On your computer, open terminal/command prompt
2. Navigate to your project folder:
   ```bash
   cd path/to/farm-website
   ```

3. Run:
   ```bash
   npm install --production
   ```

4. Now ZIP the entire folder (including node_modules)

5. Upload this ZIP to cPanel and extract

6. The dependencies are now included!

### "Can't upload - file too large"

If your ZIP is too large for cPanel upload:

**Option 1: Use FTP**
- Use FileZilla or any FTP client
- Upload all files directly (no ZIP needed)

**Option 2: Split the upload**
- Upload project files first (without node_modules)
- Use "Run NPM Install" in cPanel

### "Images not uploading in admin"

1. Check if `uploads` folder exists
2. Check folder permissions (should be 755)
3. In File Manager, right-click uploads → Change Permissions → 755

### "Admin login not working"

- Make sure you're using: `admin` / `admin123`
- Check if application is running (green status)
- Try restarting the application

## What You Should See

**When everything works:**
- ✅ Node.js App status shows "Running" (green)
- ✅ Website loads at your domain
- ✅ You can browse products
- ✅ Admin panel login works
- ✅ You can add/edit products

## Next Steps After Successful Deployment

1. **Change admin password** (see README.md for instructions)
2. **Add your real products** via admin panel
3. **Update content** on Home, About, Contact pages
4. **Upload product images**
5. **Test quote request form**

## Important Notes

- **Default credentials**: admin / admin123 (CHANGE THIS!)
- **Application must be "Running"** to work
- **Restart after changes** to code files
- **uploads folder** must have 755 permissions
- **Keep cPanel Node.js version updated**

## Quick Reference

**Your Important URLs:**
- Website: `http://yourdomain.com`
- Admin: `http://yourdomain.com/admin/login`
- cPanel: `http://yourdomain.com:2083` or `http://yourdomain.com/cpanel`

**Application Settings:**
- Startup file: `server.js`
- Mode: Production
- Default port: Auto-assigned by cPanel

**File Locations:**
- App files: `/home/YOUR_USERNAME/public_html/farm-website/`
- Uploads: `/home/YOUR_USERNAME/public_html/farm-website/uploads/`

## Need More Help?

1. Check if Node.js App is "Running" in cPanel
2. Look at error logs in Node.js App interface
3. Verify all files uploaded correctly
4. Make sure uploads folder exists with 755 permissions
5. Try restarting the application
6. Contact your hosting provider if Node.js App feature isn't working

---

**Remember:** The easiest way is to click "Run NPM Install" button in cPanel after creating the app. If that doesn't work, install dependencies on your local computer and upload everything including node_modules folder.
