# HDC Connect v2 — Namecheap installation for a non-programmer

## What you are installing
One Node.js application serves the HDC frontend and backend. The database is MariaDB/MySQL.

## A. Prepare the domain
1. Log into Namecheap and make sure `healingdrivenchurch.org` is connected to the hosting account.
2. Open cPanel.
3. Make sure HTTPS/SSL is active for the domain.

## B. Create the database
1. In cPanel open **Database Wizard** (or Manage My Databases).
2. Create a database, for example `hdc_connect`.
3. Create a database user and a strong password.
4. Add the user to the database and choose **All Privileges**.
5. Open phpMyAdmin, select the new database, choose **Import**, and import `backend/database.sql`.

Namecheap's current cPanel instructions describe Database Wizard as the simple way to create a database, user and privileges.

## C. Upload the application
1. In cPanel File Manager create a folder outside `public_html`, for example `hdc-app`.
2. Upload the ZIP and extract it.
3. IMPORTANT: after extracting, the folder containing `backend/server.js` and `backend/package.json` should be the application root.
4. You may keep `frontend` and `backend` inside that root.

## D. Create the Node.js application
1. cPanel → **Setup Node.js App** → **Create Application**.
2. Node.js version: choose a currently available LTS version (22.x is a good choice if offered).
3. Application mode: **Production**.
4. Application root: the path to the folder containing `backend` and `frontend`.
5. Application URL: `https://healingdrivenchurch.org`.
6. Application startup file: `backend/server.js`.
7. Add these environment variables:
   - `PORT` = leave blank if cPanel provides the port; otherwise use the port shown by the Node app interface.
   - `SITE_URL` = `https://healingdrivenchurch.org`
   - `JWT_SECRET` = a long random secret you create
   - `DB_HOST` = `localhost`
   - `DB_PORT` = `3306`
   - `DB_NAME` = your full cPanel database name
   - `DB_USER` = your full cPanel database username
   - `DB_PASSWORD` = your database password
8. Click Create.
9. Stop the app if necessary and click **Run NPM Install**.
10. Start the application.

Namecheap's current documentation confirms Setup Node.js App supports Node version selection, Production mode, application root, application URL, startup file, environment variables, NPM install and Start/Restart controls.

## E. Test
Open:
https://healingdrivenchurch.org

Then test:
- Home
- About
- Services
- Events
- Prayer
- Register
- Login
- HDC Connect

## F. Create an administrator
For safety, normal registrations create `member` accounts. After creating the first HDC account, open phpMyAdmin and run:

UPDATE users SET role='admin' WHERE email='YOUR-ADMIN-EMAIL';

Then visit:
https://healingdrivenchurch.org/admin.html

## If the site shows an error
1. cPanel → Setup Node.js App → check the app status.
2. Restart the application.
3. Check the application's error/log output.
4. Confirm the database name, username and password exactly match cPanel.
5. Confirm `database.sql` was imported.
6. Confirm the Node application root contains the `backend` and `frontend` folders.

## Important limitation
Namecheap shared hosting is suitable for this initial production deployment, but high-scale real-time chat, large media storage and heavy traffic may eventually justify moving the API/database/media to dedicated cloud infrastructure. The frontend/backend separation in this project makes that migration easier later.
