# Simplified Namecheap cPanel Deployment

This package is prepared for the subdomain `numbers.techfusion.africa` and application directory `/home/mijizpbt/numbers.techfusion.africa`.

## What you upload

Upload `signalharbor-numbers-techfusion-cpanel-simple.zip` into:

```text
/home/mijizpbt/numbers.techfusion.africa
```

Extract it there. The archive contains a production-only `package.json`, root-level `app.js`, compiled `dist/index.js`, and `dotenv` as a runtime dependency. The production-only package manifest intentionally excludes Vite development packages, so cPanel’s **Run NPM Install** should not encounter the previous peer-dependency conflict.

## cPanel Node.js settings

Use these values in **Setup Node.js App**:

| Setting | Value |
|---|---|
| Node.js version | `22.23.2` |
| Mode | `Production` |
| Application root | `numbers.techfusion.africa` |
| Application URL domain | `techfusion.africa` |
| Application URL alias | `numbers` |
| Startup file | `app.js` |

The Application URL alias must be only `numbers`, not a full URL.

## Install dependencies

After extracting the archive, open the Node.js application in cPanel and click **Run NPM Install**. This time the package manifest contains only runtime dependencies, including `dotenv`, and does not include the incompatible development-only Vite plugin.

Then click **Restart**.

If you prefer SSH, use:

```bash
source /home/mijizpbt/nodevenv/numbers.techfusion.africa/22/bin/activate
cd /home/mijizpbt/numbers.techfusion.africa
npm install --omit=dev
node -e "import('dotenv').then(() => console.log('dotenv OK'))"
```

## Create the database

Create the cPanel MySQL database and user first. In phpMyAdmin, select the empty database and import these files in this order:

```text
deployment/cpanel_schema.sql
deployment/cpanel_inventory_seed.sql
```

`cpanel_schema.sql` creates the application tables. `cpanel_inventory_seed.sql` imports **9,975 validated USA numbers** from the supplied workbook. The seed file uses `INSERT IGNORE` and unique indexes, so duplicate rows do not create duplicate phone numbers.

## Add only your private values

In **Setup Node.js App → Environment Variables**, add the values in `deployment/CPANEL_ENV_TEMPLATE.txt`.

You must supply these account-specific values yourself:

```text
DATABASE_URL
JWT_SECRET
VITE_APP_ID
OAUTH_SERVER_URL
VITE_OAUTH_PORTAL_URL
BUILT_IN_FORGE_API_URL
BUILT_IN_FORGE_API_KEY
VITE_FRONTEND_FORGE_API_URL
VITE_FRONTEND_FORGE_API_KEY
MPESA_CONSUMER_KEY
MPESA_CONSUMER_SECRET
MPESA_PASSKEY
MPESA_SHORTCODE
PESAPAL_CONSUMER_KEY
PESAPAL_CONSUMER_SECRET
PAYSTACK_PUBLIC_KEY
PAYSTACK_SECRET_KEY
```

Do not upload a real `.env` file containing these values. The template is intentionally a placeholder file. Rotate the database password and JWT secret that appeared in the screenshot before using them again.

If the database password contains special characters, URL-encode them inside `DATABASE_URL`. For example, `@` becomes `%40` and `+` becomes `%2B`.

## Start and test

After adding variables, click **Restart**. Open:

```text
https://numbers.techfusion.africa
```

The storefront should load. Then open `/admin` and sign in with the owner account. The database seed has already loaded the inventory, so you do not need to upload the Excel file again unless you want to replace or add inventory.

## SSL and payment callbacks

Activate SSL for `numbers.techfusion.africa` in cPanel’s Namecheap SSL tool. Then register:

```text
https://numbers.techfusion.africa/api/payments/paystack/webhook
https://numbers.techfusion.africa/api/payments/pesapal/ipn
https://numbers.techfusion.africa/api/payments/mpesa/callback
```

Do not test live payments until the storefront loads, the database is populated, HTTPS is active, and the provider credentials have been added.
