## What the command changes

Dinvolt configures these Vercel settings:

| Setting                   | Value                                         |
| ------------------------- | --------------------------------------------- |
| Framework                 | Next.js                                       |
| Node.js                   | 24.x                                          |
| Root Directory            | App directory relative to the Git repository. |
| Build, install and output | Framework and lockfile defaults.              |
| Production Branch         | `main`                                        |

Locally, it saves `.vercel/project.json` and its Git ignore rule. It uses the pinned official Vercel CLI **65.11.0** through npm.

The command does not upload local source, commit or push changes. You manage the repository and migrations through your own workflow.

### Existing links and custom builds

Review custom build lifecycles, install hooks, `vercel-build` scripts and `vercel.json` overrides before setup.

These configurations need manual setup:

- `vercel.ts`, `vercel.toml` and legacy `now.json`.
- Repository mappings in `.vercel/repo.json`, managed with the official Vercel CLI.

Dinvolt preserves existing repository mappings. A local link to another team or repository stops setup.

### Older or customized starters

Before enabling Preview, adopt the deployment origin resolver in your app:

1. Add `getAuthOrigin` from `catalog/auth/auth-origin.ts`.
2. Use it for `baseURL` and `trustedOrigins` in `src/lib/auth-config.ts`.
3. Apply the Preview URL logic from `catalog/ui/site.ts` to `src/config/site.ts`.
4. Review and publish your changes.

Preserve your customizations. Hosting setup does not replace application source.

## Secrets and variable handling

Database, authentication and email credentials are sent as Secret values through stdin. Public origins and the email sender use Config values.

For each remote target, Dinvolt creates a new `BETTER_AUTH_SECRET` only when the key is absent. Reruns preserve existing remote secrets; local auth secrets are never copied.

| Situation | Behavior |
| --- | --- |
| An existing variable needs a change | Ask for replacement, or require `--replace` in scripts. |
| A remote secret already exists | Preserve it without requesting its value. |
| Auth secrets are shared across targets | Stop for explicit remediation in Vercel. |
| Database keys conflict with the target | Stop for explicit review. |
| A target defines local/admin/provider system keys | Stop for explicit review. |

Conflicting keys include `DINVOLT_DATABASE_ENV`, `DEV_ADMIN_*`, `VERCEL_TOKEN` and manually defined Vercel environment/URL variables.

### Advanced implementation details

Dinvolt writes the non-secret project link directly. It does not run `vercel link` or `env pull`, refresh OIDC in `.env.local`, or copy dotenv files into metadata.

Variable replacement uses the inspected ID through the official CLI's v10 API. This selects the base target variable without changing branch overrides. Encrypted Config entries may be read individually for comparison; retained database, auth and email secrets are never requested.

The production branch uses the scoped project-branch endpoint from Vercel's official Terraform provider. Dinvolt verifies the resulting settings before completing setup.

## Official contracts

For the underlying Vercel behavior, see:

- [Git integration and production branches](https://vercel.com/docs/git)
- [Git CLI](https://vercel.com/docs/cli/git) and [connection implementation](https://github.com/vercel/vercel/blob/main/packages/cli/src/util/git/connect-git-provider.ts)
- [CLI API authentication and stdin](https://vercel.com/docs/cli/api)
- [Environment variables](https://vercel.com/docs/cli/env) and [CLI variable updates](https://github.com/vercel/vercel/blob/main/packages/cli/src/util/env/update-env-record.ts)
- [Framework-prefixed system variables](https://vercel.com/docs/environment-variables/framework-environment-variables)
- [Production branch endpoint](https://github.com/vercel/terraform-provider-vercel/blob/main/client/project.go)


