better-auth-devtools 0.1.1-alpha.1 → 0.1.1-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +110 -8
  2. package/package.json +11 -10
  3. package/LICENSE +0 -21
package/README.md CHANGED
@@ -1,14 +1,116 @@
1
- # better-auth-devtools
1
+ # Better Auth DevTools
2
2
 
3
- An unofficial Better Auth devtool as a single installable package.
3
+ > [!WARNING]
4
+ > Development-only auth tooling. Keep it disabled in production.
4
5
 
5
- This package is currently in alpha and may introduce breaking changes between releases.
6
+ > [!NOTE]
7
+ > This is an alpha release.
6
8
 
7
- This package is unofficial and is not affiliated with, endorsed by, or maintained by the Better Auth team.
9
+ > [!IMPORTANT]
10
+ > This project is unofficial. It is not affiliated with, endorsed by, or maintained by the Better Auth team.
8
11
 
9
- Use subpath exports:
12
+ `better-auth-devtools` is an unofficial Better Auth devtool for local auth scenario testing. It gives you managed test users, instant session switching, session inspection, and a React panel for approved session-field edits.
10
13
 
11
- - `better-auth-devtools/plugin`
12
- - `better-auth-devtools/react`
14
+ ## Installation
13
15
 
14
- See the root README for setup and demo usage.
16
+ ```bash
17
+ pnpm add better-auth-devtools
18
+ ```
19
+
20
+ Use these subpath exports:
21
+
22
+ ```ts
23
+ import { devtoolsPlugin, devtoolsClientPlugin } from "better-auth-devtools/plugin";
24
+ import { BetterAuthDevtools } from "better-auth-devtools/react";
25
+ ```
26
+
27
+ Required environment guard:
28
+
29
+ ```bash
30
+ DEV_AUTH_ENABLED=true
31
+ NODE_ENV=development
32
+ ```
33
+
34
+ ## AI Agent Prompt
35
+
36
+ ```text
37
+ Install and integrate better-auth-devtools as an unofficial development-only Better Auth utility. Use better-auth-devtools/plugin for the Better Auth server/client plugin setup and better-auth-devtools/react for the floating panel. Keep it disabled in production, require DEV_AUTH_ENABLED=true, use managed test users only, and do not implement arbitrary user impersonation.
38
+ ```
39
+
40
+ ## Minimal Usage
41
+
42
+ ```ts
43
+ import { betterAuth } from "better-auth";
44
+ import { createAuthClient } from "better-auth/react";
45
+ import { devtoolsPlugin, devtoolsClientPlugin } from "better-auth-devtools/plugin";
46
+
47
+ export const auth = betterAuth({
48
+ database,
49
+ plugins: [
50
+ devtoolsPlugin({
51
+ templates: {
52
+ admin: { label: "Admin", meta: { role: "admin" } },
53
+ viewer: { label: "Viewer", meta: { role: "viewer" } },
54
+ },
55
+ async createManagedUser(args) {
56
+ return { userId: "new-user-id", email: args.email, label: args.template.label };
57
+ },
58
+ async getSessionView(args) {
59
+ return {
60
+ userId: args.userId,
61
+ fields: { sessionId: args.sessionId, role: "viewer" },
62
+ editableFields: ["role"],
63
+ };
64
+ },
65
+ async patchSession(args) {
66
+ return {
67
+ userId: args.userId,
68
+ fields: { sessionId: args.sessionId, role: String(args.patch.role ?? "viewer") },
69
+ editableFields: ["role"],
70
+ };
71
+ },
72
+ }),
73
+ ],
74
+ });
75
+
76
+ export const authClient = createAuthClient({
77
+ plugins: [devtoolsClientPlugin()],
78
+ });
79
+ ```
80
+
81
+ ```tsx
82
+ "use client";
83
+
84
+ import { BetterAuthDevtools } from "better-auth-devtools/react";
85
+
86
+ export function Devtools() {
87
+ return (
88
+ <BetterAuthDevtools
89
+ enabled={process.env.NODE_ENV !== "production"}
90
+ basePath="/api/auth"
91
+ templates={["admin", "viewer"]}
92
+ editableFields={[
93
+ { key: "role", label: "Role", type: "select", options: ["admin", "viewer"] },
94
+ ]}
95
+ />
96
+ );
97
+ }
98
+ ```
99
+
100
+ ## Demo
101
+
102
+ ```bash
103
+ pnpm install
104
+ pnpm --dir apps/demo-app db:init
105
+ pnpm dev
106
+ ```
107
+
108
+ The demo app in [`apps/demo-app`](https://github.com/C-W-D-Harshit/better-auth-devtools/tree/main/apps/demo-app) is the reference integration.
109
+
110
+ ## Notes
111
+
112
+ - Managed test users only. This is not arbitrary user impersonation.
113
+ - Intended for local and trusted development environments.
114
+ - Current public API:
115
+ - `better-auth-devtools/plugin`
116
+ - `better-auth-devtools/react`
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "better-auth-devtools",
3
- "version": "0.1.1-alpha.1",
3
+ "version": "0.1.1-alpha.4",
4
4
  "private": false,
5
5
  "description": "Unofficial Better Auth devtool for managed test users, session switching, and a React DevTools panel via plugin/react subpath exports.",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
9
  "files": [
10
- "dist"
10
+ "dist",
11
+ "README.md"
11
12
  ],
12
13
  "license": "MIT",
13
14
  "author": "Harshit",
@@ -37,6 +38,13 @@
37
38
  "import": "./dist/react/index.js"
38
39
  }
39
40
  },
41
+ "scripts": {
42
+ "build": "tsc",
43
+ "dev": "tsc --watch",
44
+ "typecheck": "tsc --noEmit",
45
+ "lint": "echo 'no linter configured'",
46
+ "test": "pnpm exec vitest run"
47
+ },
40
48
  "keywords": [
41
49
  "better-auth",
42
50
  "auth",
@@ -57,12 +65,5 @@
57
65
  "react": "^19.0.0",
58
66
  "react-dom": "^19.0.0",
59
67
  "typescript": "^5.8.0"
60
- },
61
- "scripts": {
62
- "build": "tsc",
63
- "dev": "tsc --watch",
64
- "typecheck": "tsc --noEmit",
65
- "lint": "echo 'no linter configured'",
66
- "test": "pnpm exec vitest run"
67
68
  }
68
- }
69
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.