# Putting EntreJourneyMap on your domain (cPanel)

EntreJourneyMap is a Node.js app. It builds your result, VIP and Blueprint pages for each visitor,
and runs checkout and Archie on the server. So it goes in through cPanel's **Setup Node.js App**,
not by uploading files into `public_html`.

**You need:** a cPanel account whose host offers **Setup Node.js App** (sometimes called "Node.js
Selector") with **Node.js 20.9 or newer** (20 or 22 recommended). If you can't find it, ask your host
to enable Node.js apps.

## First upload

1. **Create the app.** cPanel → *Setup Node.js App* → **Create Application**:
   - **Node.js version:** 20.x or 22.x
   - **Application mode:** Production
   - **Application root:** `entrejourneymap` (a folder in your home directory, **not** inside `public_html`)
   - **Application URL:** your domain (or a subdomain such as `app.yourdomain.com`)
   - **Application startup file:** `app.js`

   Click **Create**, then **Stop App**.

2. **Upload the files.** cPanel → *File Manager*:
   - Turn on **Settings → Show Hidden Files (dotfiles)**. The `.env` and `.next` items start with a dot.
   - Open the `entrejourneymap` folder and delete anything cPanel put there (such as a sample `app.js`).
   - **Upload** `entrejourneymap-cpanel.zip`, then right-click it → **Extract** into this folder.
   - Check that `app.js`, `server.js`, `package.json`, `.env`, `.next`, `public` and `node_modules` sit
     **directly** in `entrejourneymap`, not in a subfolder. Then delete the zip.

3. **Check the settings.** Right-click `.env` → **Edit**:
   - `SITE_URL=https://yourdomain.com` (your real address, with https)
   - `PAYMENTS_MODE=mock` lets anyone unlock the VIP Ticket for free while you test. Change it to
     `disabled` to show "Coming soon" instead.
   - Leave `REPORT_TOKEN_SECRET` as it is. It is already a unique random value.

4. **Start it.** Back in *Setup Node.js App*, click **Start App** (or **Restart**), then open your
   domain. **Don't click "Run NPM Install"**: everything the app needs is already in `node_modules`.

5. **Turn on HTTPS.** cPanel → *SSL/TLS Status* → **Run AutoSSL** if your domain doesn't have a
   certificate yet.

## Updating later

1. On your computer, in the `entrejourneymap` folder: `npm run package:cpanel`
2. In *Setup Node.js App*: **Stop App**.
3. In *File Manager*: delete the old `.next`, `node_modules` and `public` folders, then upload and extract
   the new zip. **When asked, don't overwrite your existing `.env`** (or put your old values back),
   because changing `REPORT_TOKEN_SECRET` breaks the private links buyers already have.
4. **Start App**.

## If something goes wrong

- **"Incomplete response" / 503 / blank page:** open *Setup Node.js App* and check that the Node.js
  version is 20.9 or newer and the startup file is `app.js`. The app's error log is usually in
  `entrejourneymap/stderr.log`.
- **The page loads but has no styling:** the `.next/static` folder is missing. Re-extract the zip and
  make sure hidden files are shown.
- **The site sits in a sub-folder such as `yourdomain.com/app`:** this build expects to be at the
  root of a domain or subdomain. Use a subdomain (e.g. `app.yourdomain.com`) instead.
