# Deploy VEIL SMS API to api.shadowport.xyz

The mobile app needs the Node backend running on a public HTTPS API domain. Right now `shadowport.xyz` serves the web host/LiteSpeed site, so `/api/health` returns 404. Deploy this project backend to `api.shadowport.xyz`, then point the app at it.

## Required API URL

After deployment this must work:

```text
https://api.shadowport.xyz/api/health
```

It should return JSON with `ok: true`.

## cPanel / Node.js App Setup

1. Create subdomain:

```text
api.shadowport.xyz
```

2. In cPanel, open **Setup Node.js App**.

3. Create a Node app:

```text
Node version: 20+ recommended
Application root: folder containing this project
Application URL: api.shadowport.xyz
Application startup file: server/index.js
```

4. Add environment variables from `.env`:

```env
DEVIL_TRAFF_API_TOKEN=...
DEVIL_TRAFF_API_BASE_URL=https://api.devil-traff.cc
OXAPAY_MERCHANT_API_KEY=...
VEIL_SMS_EMAIL=...
TELEGRAM_BOT_TOKEN=...
TELEGRAM_CHAT_ID=...
OXAPAY_CALLBACK_URL=...
OXAPAY_RETURN_URL=
OXAPAY_SANDBOX=false
ADMIN_API_KEY=...
APP_LOGIN_USERNAME=...
APP_LOGIN_PASSWORD=...
ADMIN_USERNAME=...
ADMIN_PASSWORD=...
```

Do not set `PORT` manually on cPanel if it provides one automatically.

5. Run dependency install in the app panel/terminal:

```bash
npm install --omit=dev
```

6. Restart the Node app.

7. Test:

```text
https://api.shadowport.xyz/
https://api.shadowport.xyz/api/health
```

## Point app/admin to production API

When the API works, change:

```env
EXPO_PUBLIC_API_BASE_URL=https://api.shadowport.xyz
ADMIN_API_BASE_URL=https://api.shadowport.xyz
```

And in `app.json`:

```json
"extra": {
  "apiBaseUrl": "https://api.shadowport.xyz"
}
```

Then rebuild/reload the mobile app so customer push tokens register on the production backend.

## Admin Panel

The PHP admin panel can stay on the main site, but it must use:

```env
ADMIN_API_BASE_URL=https://api.shadowport.xyz
```

Push broadcasts will then send from the public backend instead of your local machine.
