# Planexa deployment on Namecheap cPanel

Target: `https://planexa.dmarknetwork.com`

## 1. Upload

1. In **Setup Node.js App**, click **Stop App**.
2. Open **File Manager** and go to `/home/qhoobbrb/planexa_app`.
3. Upload the deployment ZIP there and extract it directly in that folder.
4. Confirm that `package.json` and `server.js` are directly inside `planexa_app` (not in another nested folder).

## 2. Install and build

Open cPanel **Terminal** and run:

```bash
source /home/qhoobbrb/nodevenv/planexa_app/24/bin/activate
cd /home/qhoobbrb/planexa_app
npm install --include=dev
npm run build
mkdir -p /home/qhoobbrb/planexa_storage
```

Do not upload a local `node_modules` folder.

## 3. Environment variables

In **Setup Node.js App > Environment variables**, add:

| Name | Value |
|---|---|
| `NEXT_PUBLIC_SUPABASE_URL` | `https://tqibkidqfucrcqovutvh.supabase.co` |
| `NEXT_PUBLIC_SUPABASE_ANON_KEY` | `sb_publishable_tZv4g67Q5nhF4GVW0JtD6w_PyHQmr6J` |
| `SUPABASE_SERVICE_ROLE_KEY` | Supabase service-role key (server secret) |
| `DEVELOPER_ADMIN_EMAIL` | Private developer/admin email |
| `DEVELOPER_ADMIN_PASSWORD` | A new long, unique password |
| `DEVELOPER_COOKIE_SECRET` | At least 32 random characters |
| `PLANEXA_STORAGE_PATH` | `/home/qhoobbrb/planexa_storage` |
| `NEXT_PUBLIC_APP_URL` | `https://planexa.dmarknetwork.com` |

Never place the service-role key, developer password, or cookie secret in a public file or chat message.

## 4. Supabase URL settings

In Supabase **Authentication > URL Configuration**:

- Site URL: `https://planexa.dmarknetwork.com`
- Redirect URL: `https://planexa.dmarknetwork.com/auth/callback`

Run `supabase/migrations/009_tenant_branding_and_domains.sql` in Supabase SQL Editor if it has not already been applied.

## 5. Start and verify

1. Return to **Setup Node.js App** and click **Restart**.
2. Ensure the startup file is `server.js` and Node version is `24.18.0`.
3. Open `https://planexa.dmarknetwork.com/api/health`.
4. A successful setup returns `status: "healthy"`.
5. Then test signup/login, dashboard, company settings, and file/image upload.

If HTTPS is not active, run cPanel **SSL/TLS Status > Run AutoSSL** first.
