# Putting LocaJour live on Namecheap

Your backend is already deployed and waiting. This file is only about getting
the website running on your cPanel hosting.

**Why the domain showed "Index of /":** LocaJour is not a static website. It
runs server code, so uploading the files to `public_html` just lists them.
cPanel has to *run* the app with Node.js, which is what the steps below set up.

Upload **`LOCAJOUR-namecheap.zip`** — it already contains the production build.
Do not upload the other zip, and do not run `npm run build` on the server:
shared hosting does not have the memory for it.

---

## Already done for you

| | |
| --- | --- |
| Production backend | `https://colorful-deer-619.eu-west-1.convex.cloud` |
| Auth keys + `SITE_URL` | set on the production backend |
| Owner account | `myamsssimo@gmail.com` (the password you chose) |
| Website build | compiled against the production backend |

The production database is **empty** — no demo apartments or guests. That is
correct for a real business.

---

## 1. Clear `public_html`

In **cPanel → File Manager**, delete everything currently inside
`public_html` (the `src`, `convex`, `public`, `scripts` folders and the loose
files). That upload cannot work and will get in the way.

Leave the `public_html` folder itself in place, empty.

## 2. Upload the app **outside** `public_html`

The Node.js app must not live in `public_html`.

1. Go to your home directory in File Manager (one level above `public_html`).
2. Create a folder called **`locajour`**.
3. Upload `LOCAJOUR-namecheap.zip` into it.
4. Select it → **Extract**.
5. Delete the zip afterwards.

## 3. Create the Node.js application

**cPanel → Setup Node.js App → CREATE APPLICATION**

| Field | Value |
| --- | --- |
| Node.js version | **22.x** (20.x also fine) |
| Application mode | **Production** |
| Application root | `locajour` |
| Application URL | `locajourimmobilier.com` |
| Application startup file | `server.js` |

Then, still on that screen, add these **environment variables**:

| Name | Value |
| --- | --- |
| `NEXT_PUBLIC_CONVEX_URL` | `https://colorful-deer-619.eu-west-1.convex.cloud` |
| `NEXT_PUBLIC_CONVEX_SITE_URL` | `https://colorful-deer-619.eu-west-1.convex.site` |
| `NODE_ENV` | `production` |

Optional, add later if you want them:
`GOOGLE_PLACES_API_KEY`, `NEXT_PUBLIC_CONTACT_PHONE`, `NEXT_PUBLIC_CONTACT_WHATSAPP`.

Click **CREATE**.

## 4. Install and start

1. **Stop** the application.
2. Under **Detected configuration files**, click **Run NPM Install** and wait
   (a few minutes — it installs ~34 packages).
3. Click **START APP**.

Open `https://locajourimmobilier.com`. You should see the showroom, not a file
list. Sign in from the top right with your owner account.

---

## 5. First things to set up once you are in

1. **Settings → General** — business name, contact phone, address, currency.
2. **Settings → Website & reviews** — WhatsApp number, Google review link,
   Place ID, Meta Pixel.
3. **Apartments → Add apartment**, then **Photos** on each card to upload its
   pictures.
4. **Workers** — create your staff accounts and give them roles.

---

## If it will not start

Open **Setup Node.js App → your app → logs**, and check:

- **"Cannot find module 'next'"** — Run NPM Install did not finish. Run it again.
- **Memory / 503 errors** — Next.js needs roughly 512 MB. If your plan is too
  tight, the app will restart in a loop. This is the main limitation of shared
  hosting for this kind of app.
- **Sign-in fails but pages load** — `SITE_URL` on the backend must match your
  real address exactly. It is currently `https://locajourimmobilier.com`.
  Change it with:
  `npx convex env set --prod SITE_URL=https://your-address`

### If shared hosting proves too slow

You can keep the Namecheap **domain** and host the site on Vercel's free tier,
which is built for Next.js. You would point the domain's DNS at Vercel and
change nothing else — the backend and your data stay exactly where they are.

---

## Rebuilding later

If you change the code, rebuild **on your machine** and upload the new `.next`
folder plus whatever files changed:

```bash
mv .env.local /tmp/ && npm run build && mv /tmp/.env.local .
```

Moving `.env.local` aside matters: it points at the development backend and
otherwise overrides `.env.production`, which would silently build your site
against the wrong database.
