# Deploy on Hostinger — viratechnology.net (cPanel Application Manager)

You are using **Software → Application Manager** (Phusion Passenger). That is the correct panel for your plan.

Passenger’s default Node entry file is **`app.js`** (not `server.js`).

## Your exact Register Application values

Fill the form like this:

| Field | What to enter |
| --- | --- |
| **Application Name** | `viratechnology` |
| **Deployment Domain** | select **`viratechnology.net`** from the dropdown |
| **Base Application URL** | leave the path as **`/`** (so it shows `viratechnology.net` + `/`) — this puts the app on the site root |
| **Application Path** | **`viratechnology.net`** ← not `/` (this is relative to `/home/laptopma`) |
| **Deployment Environment** | **Production** |
| **Environment Variables** | Add → Name: `SESSION_SECRET` → Value: a long random string → Save |

Then click **Deploy**.

That maps to:

```text
/home/laptopma/viratechnology.net/app.js
/home/laptopma/viratechnology.net/package.json
```

---

## Before you click Deploy — files must already be there

1. Download: https://github.com/idawoodhashmi/vira/archive/refs/heads/cursor/hostinger-cpanel-deploy-f116.zip
2. File Manager → `/home/laptopma/viratechnology.net`
3. Upload + extract. If GitHub nested a folder, move contents up until you see:

```text
/home/laptopma/viratechnology.net/app.js
/home/laptopma/viratechnology.net/package.json
/home/laptopma/viratechnology.net/server.js
/home/laptopma/viratechnology.net/app/
...
```

4. Move any old `index.php` / `index.html` aside (e.g. `_old/`).

---

## After Deploy

### 1) Install npm packages

In Application Manager, on your app row, use **Enable Dependencies** (runs `npm install`).

Or Terminal:

```bash
export PATH=/opt/cpanel/ea-nodejs20/bin:$PATH
# if node20 path missing, try ea-nodejs22 or ea-nodejs18
cd /home/laptopma/viratechnology.net
npm install
```

### 2) Build Next.js

```bash
export PATH=/opt/cpanel/ea-nodejs20/bin:$PATH
cd /home/laptopma/viratechnology.net
npm run build
```

### 3) Restart Passenger

```bash
mkdir -p /home/laptopma/viratechnology.net/tmp
touch /home/laptopma/viratechnology.net/tmp/restart.txt
```

### 4) Open the site

https://viratechnology.net

---

## Why Application Path must not be `/`

| You type | Passenger uses |
| --- | --- |
| `/` (wrong) | `/home/laptopma/` — your home folder, not the site |
| `viratechnology.net` (correct) | `/home/laptopma/viratechnology.net/` |

---

## Demo logins

| Role | Email | Password |
| --- | --- | --- |
| Admin | `admin@vira.sa` | `demo1234` |
| Client | `client@vira.sa` | `demo1234` |

---

## Logs / troubleshooting

- Node logs: `/home/laptopma/viratechnology.net/logs/`
- Blank/503: confirm `app.js` exists, build finished (`.next/` folder present), then `touch tmp/restart.txt`
- Still old PHP page: rename `index.php` / `index.html` in the domain folder
- `node: command not found`: use full path `/opt/cpanel/ea-nodejs20/bin/npm` (or 22/18)

Official docs:

- [Application Manager](https://docs.cpanel.net/cpanel/software/application-manager/)
- [Install a Node.js application](https://docs.cpanel.net/knowledge-base/web-services/how-to-install-a-node.js-application/)
