# Better Auth DevTools

Stop logging in and out to test roles and permissions. A development-only panel for Better Auth that spawns managed test users and switches sessions instantly, right inside your app.

Source: https://www.better-auth-devtools.com/

- Package: [better-auth-devtools](https://www.npmjs.com/package/better-auth-devtools)
- Repository: [GitHub](https://github.com/C-W-D-Harshit/better-auth-devtools)

## Test any user, any role. One click.

Stable release ready for Better Auth.

## Everything you need to test auth

Built for the inner loop — the fast, repeatable checks you run dozens of times a day while building auth-gated features.

### Managed test users

Spin up test accounts from templates you define. Keep real users out of your everyday auth checks.

### Instant session switching

Jump into any managed user in one click. The app reloads against the new Better Auth session.

### Session inspection

Read the exact session your app exposes — user fields plus approved metadata.

### Field patching

Edit only the fields you explicitly allow, then refresh with the updated auth state.

### Repeatable personas

Stable roles like Admin, Editor, and Viewer make auth-gated UI easy to verify — every time.

### Dev-only by design

On in development, off in production, with an explicit kill switch you control.

## Two integration points

One server plugin and one zero-prop React component. No client plugin, no server-to-client wiring.

Install:

```bash
pnpm add better-auth-devtools
```

### 1. Add the plugin

```ts
import { betterAuth } from "better-auth";
import { devtools } from "better-auth-devtools";

export const auth = betterAuth({
  database,
  plugins: [devtools({ enabled: true })],
});
```

### 2. Mount the panel

```tsx
"use client";

import { BetterAuthDevtools } from "better-auth-devtools/react";

export function DevtoolsWrapper() {
  return <BetterAuthDevtools />;
}
```

Explicitly enabled for development. Production stays disabled. After adding it, run `npx auth@latest migrate` to apply the schema.

## Stop logging out to test as someone else

Install the package, add the plugin, and switch between managed test users in one click.
