For **Admin panel only** projects, the login is `/`, the home page is `/dashboard`, and other panel pages omit the `/admin` prefix. The proxy matches `/dashboard/:path*`, `/users/:path*` and `/settings/:path*`. Components use `@/components` and `@/components/ui`. API endpoints such as `/api/admin/users/export` keep their paths. Examples below use the combined public website + admin panel layout; generated standalone guides use the app's actual paths.

## Configure auth environments

Database variables use environment suffixes. Auth variables use their ordinary names in each deployment's scope:

```dotenv
BETTER_AUTH_URL=https://your-app.example.com
BETTER_AUTH_SECRET=replace-with-a-random-secret-of-at-least-32-characters
```

Use a random secret of at least 32 characters. Keep the local secret, staging secret, and production secret separate; never commit private dotenv files.

| Environment       | Auth origin                                       |
| ----------------- | ------------------------------------------------- |
| Local development | The generated Portless URL                        |
| Vercel Production | Your assigned public origin in `BETTER_AUTH_URL`  |
| Vercel Preview    | The exact deployment URL supplied by `VERCEL_URL` |

Enable Vercel system environment variables and open the unique Preview deployment URL. Preview origin validation does not trust every Vercel hostname.

After publishing your Git repository and its main branch, the Vercel helper can prepare deployment variables and Git integration:

```sh npm
npx dinvolt vercel setup
```

```sh bun
bunx dinvolt vercel setup
```

```sh pnpm
pnpm dlx dinvolt vercel setup
```

```sh yarn
yarn dlx dinvolt vercel setup
```

It generates separate remote secrets and preserves existing ones. See [database environments](/guides/database/environments#database-environments) for credential names and target selection.

## Customize authentication

### Change options or plugins

Edit `src/lib/auth-config.ts`. The application uses Better Auth's Drizzle adapter and Admin plugin; `nextCookies()` remains the final server plugin so Server Actions can set cookies.

After changing options that affect the schema:

1. Regenerate the shared auth schema:

   ```sh
   bun run auth:generate
   ```

2. Review `src/db/auth-schema.ts`.
3. Generate and review the Drizzle migration:

   ```sh
   bun run db:generate
   ```

4. Apply the reviewed migration to the intended database:

   ```sh
   bun run db:migrate
   ```

Projects without development can use the selected staging/production variant of the auth-generation script. See [database migrations](/guides/database/migrations#change-your-schema) for other migration targets.

Preserve the `user`, `session`, `account`, and `verification` exports and the Admin role/ban/impersonation fields. All schema changes use Drizzle migrations with this adapter.

### Server and CLI entry points

Application code imports `getAuth` from `@/lib/auth` and `getDb` from `@/db`. Both entry points enforce `server-only`.

The root `auth.config.ts` shares internal configuration with those entry points for trusted CLI commands. Keep those guards in place.

Authentication initializes lazily. An anonymous session endpoint can return `null` before database access; a present cookie always goes through Better Auth validation. Responses remain private and uncached.

### Provider transactions

PlanetScale's auth adapter enables transactions. Turso keeps the default nontransactional mode because its pinned HTTP driver cannot safely overlap auth transactions on one stream. Keep that setting until the driver supports isolated concurrent transactions.

## Customize the admin interface

The panel is application-owned source. Its installed version and hashes live in `.dinvolt/ui/config.json`; a new Dinvolt release does not replace your installed files.

Use `PageHeader` for page titles and its `actions` slot for buttons such as the built-in create/edit sheets.

The protected shell streams a minimal server-verified identity to `useAdminUser`. That hook observes the existing identity without another session request. The breadcrumb also reuses the detail query rather than fetching again.

Keep these reads scoped to the current administrator and route. Clear queries after identity changes, and keep private API authorization independent of the visual shell.

The `/admin/settings` and `/admin/settings/preferences` pages are examples. Their forms validate and preview locally; add authorized server storage to persist settings or uploads.


