better-auth-studio 1.0.0

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 (72) hide show
  1. package/README.md +1 -0
  2. package/dist/auth-adapter.d.ts +24 -0
  3. package/dist/auth-adapter.d.ts.map +1 -0
  4. package/dist/auth-adapter.js +481 -0
  5. package/dist/auth-adapter.js.map +1 -0
  6. package/dist/cli.d.ts +3 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +49 -0
  9. package/dist/cli.js.map +1 -0
  10. package/dist/config.d.ts +25 -0
  11. package/dist/config.d.ts.map +1 -0
  12. package/dist/config.js +308 -0
  13. package/dist/config.js.map +1 -0
  14. package/dist/data.d.ts +38 -0
  15. package/dist/data.d.ts.map +1 -0
  16. package/dist/data.js +275 -0
  17. package/dist/data.js.map +1 -0
  18. package/dist/routes.d.ts +3 -0
  19. package/dist/routes.d.ts.map +1 -0
  20. package/dist/routes.js +1490 -0
  21. package/dist/routes.js.map +1 -0
  22. package/dist/studio.d.ts +10 -0
  23. package/dist/studio.d.ts.map +1 -0
  24. package/dist/studio.js +70 -0
  25. package/dist/studio.js.map +1 -0
  26. package/frontend/index.html +13 -0
  27. package/frontend/package-lock.json +4675 -0
  28. package/frontend/package.json +52 -0
  29. package/frontend/pnpm-lock.yaml +4020 -0
  30. package/frontend/postcss.config.js +6 -0
  31. package/frontend/src/App.tsx +36 -0
  32. package/frontend/src/components/CommandPalette.tsx +219 -0
  33. package/frontend/src/components/Layout.tsx +159 -0
  34. package/frontend/src/components/ui/badge.tsx +40 -0
  35. package/frontend/src/components/ui/button.tsx +53 -0
  36. package/frontend/src/components/ui/card.tsx +78 -0
  37. package/frontend/src/components/ui/input.tsx +20 -0
  38. package/frontend/src/components/ui/label.tsx +19 -0
  39. package/frontend/src/components/ui/select.tsx +71 -0
  40. package/frontend/src/index.css +130 -0
  41. package/frontend/src/lib/utils.ts +6 -0
  42. package/frontend/src/main.tsx +10 -0
  43. package/frontend/src/pages/Dashboard.tsx +231 -0
  44. package/frontend/src/pages/OrganizationDetails.tsx +1281 -0
  45. package/frontend/src/pages/Organizations.tsx +874 -0
  46. package/frontend/src/pages/Sessions.tsx +623 -0
  47. package/frontend/src/pages/Settings.tsx +1019 -0
  48. package/frontend/src/pages/TeamDetails.tsx +666 -0
  49. package/frontend/src/pages/Users.tsx +728 -0
  50. package/frontend/tailwind.config.js +75 -0
  51. package/frontend/tsconfig.json +31 -0
  52. package/frontend/tsconfig.node.json +10 -0
  53. package/frontend/vite.config.ts +31 -0
  54. package/package.json +59 -0
  55. package/public/assets/main-C-TXCXVW.css +1 -0
  56. package/public/assets/main-CCzTTP3P.js +296 -0
  57. package/public/index.html +14 -0
  58. package/src/auth-adapter.ts +471 -0
  59. package/src/cli.ts +51 -0
  60. package/src/config.ts +318 -0
  61. package/src/data.ts +351 -0
  62. package/src/routes.ts +1585 -0
  63. package/src/studio.ts +86 -0
  64. package/test-project/README.md +0 -0
  65. package/test-project/better-auth.db +0 -0
  66. package/test-project/better-auth_migrations/2025-08-27T15-55-04.099Z.sql +7 -0
  67. package/test-project/better-auth_migrations/2025-09-04T02-33-19.422Z.sql +7 -0
  68. package/test-project/package.json +29 -0
  69. package/test-project/pnpm-lock.yaml +1728 -0
  70. package/test-project/src/auth.ts +47 -0
  71. package/test-project/src/index.ts +40 -0
  72. package/tsconfig.json +21 -0
@@ -0,0 +1,47 @@
1
+ import { betterAuth } from "better-auth";
2
+ import Database from "better-sqlite3";
3
+ import { organization } from "better-auth/plugins";
4
+ // Better Auth configuration
5
+ export const auth = betterAuth({
6
+ secret: process.env.AUTH_SECRET || "better-auth-secret-123456789",
7
+ database: new Database("./better-auth.db"),
8
+ socialProviders: {
9
+ github: {
10
+ clientId: process.env.GITHUB_CLIENT_ID!,
11
+ clientSecret: process.env.GITHUB_CLIENT_SECRET!,
12
+ redirectUri: "http://localhost:3000/api/auth/callback/github"
13
+ }
14
+ },
15
+ emailAndPassword: {
16
+ enabled: true,
17
+ disableSignUp: false,
18
+ requireEmailVerification: true,
19
+ minPasswordLength: 8,
20
+ maxPasswordLength: 128,
21
+ autoSignIn: true,
22
+ sendResetPassword: async ({ user, url, token }) => {
23
+ // Send reset password email
24
+ console.log(`Reset password email for ${user.email}: ${url}`);
25
+ },
26
+ resetPasswordTokenExpiresIn: 3600 // 1 hour
27
+ },
28
+ plugins: [
29
+ organization({
30
+ teams: {
31
+ enabled: true
32
+ }
33
+ })
34
+ ],
35
+ session: {
36
+ expiresIn: 60 * 60 * 24 * 7, // 7 days
37
+ updateAge: 60 * 60 * 24 // 1 day
38
+ },
39
+ rateLimit: {
40
+ enabled: true,
41
+ window: 10,
42
+ max: 100
43
+ },
44
+ telemetry: {
45
+ enabled: false
46
+ }
47
+ });
@@ -0,0 +1,40 @@
1
+ import express from 'express';
2
+ import { auth } from './auth.js';
3
+
4
+ const app = express();
5
+ const PORT = process.env.PORT || 3000;
6
+ // Middleware
7
+ app.use(express.json());
8
+ // Health check
9
+ app.get('/health', (req, res) => {
10
+ res.json({
11
+ status: 'ok',
12
+ message: 'Better Auth Test Project Running',
13
+ timestamp: new Date().toISOString()
14
+ });
15
+ });
16
+
17
+ // Root endpoint
18
+ app.get('/', async (req, res) => {
19
+ const users = await (await auth.$context).adapter.findMany({
20
+ model: "user",
21
+ })
22
+ console.log({users})
23
+ res.json({
24
+ message: 'Better Auth Test Project',
25
+ description: 'This is a test project for Better Auth Studio',
26
+ users: JSON.stringify(users, null, 2),
27
+ endpoints: {
28
+ health: '/health',
29
+ auth: '/api/auth/*'
30
+ }
31
+ });
32
+ });
33
+
34
+ // Better Auth routes
35
+ app.use('/api/auth', auth);
36
+
37
+ // Start server
38
+ app.listen(PORT, () => {
39
+ console.log(`🚀 Better Auth Test Project running on http://localhost:${PORT}`);
40
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "commonjs",
5
+ "lib": ["ES2020"],
6
+ "outDir": "./dist",
7
+ "rootDir": "./src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "declaration": true,
13
+ "declarationMap": true,
14
+ "sourceMap": true,
15
+ "resolveJsonModule": true,
16
+ "moduleResolution": "node",
17
+ "allowSyntheticDefaultImports": true
18
+ },
19
+ "include": ["src/**/*"],
20
+ "exclude": ["node_modules", "dist", "public"]
21
+ }