> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tariqdev.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Deployment

> Deploy Sonata to Vercel, Railway, Render, or a VPS with production environment variables.

# Deployment

Before deploying, run:

```bash theme={null}
pnpm build
```

Fix build errors before shipping.

<Warning>
  Do not deploy with placeholder billing URLs, test API keys, or old metadata images. Buyers will see those in production.
</Warning>

## Environment Variables

Add the same production values to your hosting provider that you use locally.

Common variables:

```env theme={null}
PTERODACTYL_PANEL_URL=https://panel.example.com
PTERODACTYL_APP_KEY=ptla_xxxxxxxxxxxxxxxxx
UPTIMEROBOT_API_KEY=ur_xxxxxxxxxxxxxxxxx
NEXT_PUBLIC_DISCORD_GUILD_ID=000000000000000000
```

Only expose variables with `NEXT_PUBLIC_` when the browser needs them.

## Vercel

Recommended for most users.

1. Push the project to GitHub, GitLab, or Bitbucket.
2. Import the project in Vercel.
3. Confirm framework is Next.js.
4. Add environment variables.
5. Deploy.

Vercel settings:

```txt theme={null}
Framework Preset: Next.js
Install Command: pnpm install
Build Command: pnpm build
Output Directory: .next
```

## Railway

1. Create a new Railway project.
2. Deploy from GitHub.
3. Add environment variables.
4. Generate or connect a domain.

## Render

Use:

```txt theme={null}
Build Command: pnpm install && pnpm build
Start Command: pnpm start
```

Add environment variables in Render dashboard.

## VPS

Install dependencies:

```bash theme={null}
pnpm install
```

Build:

```bash theme={null}
pnpm build
```

Start:

```bash theme={null}
pnpm start
```

For production VPS deployments, use PM2 and Nginx.

Example:

```bash theme={null}
pm2 start pnpm --name sonata -- start
pm2 save
```

Example Nginx reverse proxy:

```nginx theme={null}
server {
  server_name example.com;

  location / {
    proxy_pass http://127.0.0.1:3000;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
  }
}
```

Use your own SSL setup, such as Certbot or your hosting provider's certificate manager.

## Post-Deploy Tests

After deployment, open production pages directly:

```txt theme={null}
/
/game-host
/web-host
/app-host
/vps
/domain
/nodes
/status
```

Then test:

* Checkout links.
* Domain lookup.
* Status API.
* Game stock API.
* Discord widget.
* Metadata preview.
* Mobile layout.

## Production Checklist

* Environment variables are set.
* Billing URLs are production URLs.
* Brand assets are replaced.
* SEO metadata is updated.
* Product data is accurate.
* Light and dark mode are readable.
* Domain lookup works.
* Status page works.
* Game stock works if enabled.
* License file is included.
* Build succeeds.
