## Environments and origins

| Vercel target | Database source | App origin |
| --- | --- | --- |
| Production | Selected provider's `_PRODUCTION` keys | Verified domain assigned to the project. |
| Preview (opt in) | Selected provider's `_STAGING` keys | Unique deployment hostname supplied by Vercel. |

Public-only projects need a site origin. Admin projects also need database, authentication and optional recovery-email settings.

Hosting setup reads the relevant database values using Next.js dotenv precedence, including inherited values. It does not query the database or run migrations.

If credentials or an environment are missing, the interactive wizard offers the separate database setup flow. Complete it before continuing.

## Production domains

Choose a domain already assigned to the selected project, or associate a domain you own. For example:

```text
https://my-app.vercel.app
https://app.example.com
```

The wizard verifies domain ownership and DNS configuration. It does not purchase domains or edit DNS.

If a custom domain is pending, follow the instructions in **Vercel → Domains**, then rerun setup. Existing assignments are never taken over.

Production uses the verified origin for `NEXT_PUBLIC_SITE_URL` and, in admin projects, `BETTER_AUTH_URL`.

## Preview deployments

Enable Preview in the wizard to use your staging database for Git previews.

For authenticated previews, open the **unique deployment URL** from Vercel. For example:

```text
https://my-app-unique-deployment.vercel.app
```

Authentication derives its origin from `VERCEL_URL`. Site metadata uses `NEXT_PUBLIC_VERCEL_URL` when the deployment environment is `preview`.

Branch aliases and custom Preview domains are not automatically trusted authentication origins. To add a stable Preview domain, review both authentication origins and public metadata.

The generated resolver ignores production/local origins in Preview. It does not trust forwarded headers or every `*.vercel.app` hostname.

Preview is off by default for a new non-interactive connection. Omitting Preview on an existing integration preserves its current settings.

### Social images

Next.js 16.4 file-based social images can use the branch alias even when page metadata uses the unique deployment URL. This does not make the alias a trusted authentication origin.

If social images must use immutable deployment URLs, review explicit social-image metadata separately.

## Password recovery

For admin projects, configure these values separately for Production and Preview:

```dotenv
RESEND_API_KEY=<resend-api-key>
EMAIL_FROM=My App <noreply@example.com>
```

Enter them when the wizard asks. Local development email values are not copied to Vercel.

Email is optional. Without these settings, password recovery remains unavailable.

For scripts, use a private JSON file as shown in [Agents and scripts](/guides/vercel/automation#agents-and-scripts).


