better-auth-studio 1.0.6 → 1.0.8

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 (51) hide show
  1. package/dist/config.d.ts +1 -0
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/config.js +126 -29
  4. package/dist/config.js.map +1 -1
  5. package/dist/routes.d.ts.map +1 -1
  6. package/dist/routes.js +28 -2
  7. package/dist/routes.js.map +1 -1
  8. package/package.json +8 -1
  9. package/frontend/index.html +0 -13
  10. package/frontend/package-lock.json +0 -4675
  11. package/frontend/package.json +0 -52
  12. package/frontend/pnpm-lock.yaml +0 -4020
  13. package/frontend/postcss.config.js +0 -6
  14. package/frontend/src/App.tsx +0 -36
  15. package/frontend/src/components/CommandPalette.tsx +0 -219
  16. package/frontend/src/components/Layout.tsx +0 -159
  17. package/frontend/src/components/ui/badge.tsx +0 -40
  18. package/frontend/src/components/ui/button.tsx +0 -53
  19. package/frontend/src/components/ui/card.tsx +0 -78
  20. package/frontend/src/components/ui/input.tsx +0 -20
  21. package/frontend/src/components/ui/label.tsx +0 -19
  22. package/frontend/src/components/ui/select.tsx +0 -71
  23. package/frontend/src/index.css +0 -130
  24. package/frontend/src/lib/utils.ts +0 -6
  25. package/frontend/src/main.tsx +0 -10
  26. package/frontend/src/pages/Dashboard.tsx +0 -231
  27. package/frontend/src/pages/OrganizationDetails.tsx +0 -1281
  28. package/frontend/src/pages/Organizations.tsx +0 -874
  29. package/frontend/src/pages/Sessions.tsx +0 -623
  30. package/frontend/src/pages/Settings.tsx +0 -1019
  31. package/frontend/src/pages/TeamDetails.tsx +0 -666
  32. package/frontend/src/pages/Users.tsx +0 -728
  33. package/frontend/tailwind.config.js +0 -75
  34. package/frontend/tsconfig.json +0 -31
  35. package/frontend/tsconfig.node.json +0 -10
  36. package/frontend/vite.config.ts +0 -31
  37. package/src/auth-adapter.ts +0 -473
  38. package/src/cli.ts +0 -51
  39. package/src/config.ts +0 -320
  40. package/src/data.ts +0 -351
  41. package/src/routes.ts +0 -1585
  42. package/src/studio.ts +0 -86
  43. package/test-project/README.md +0 -0
  44. package/test-project/better-auth.db +0 -0
  45. package/test-project/better-auth_migrations/2025-08-27T15-55-04.099Z.sql +0 -7
  46. package/test-project/better-auth_migrations/2025-09-04T02-33-19.422Z.sql +0 -7
  47. package/test-project/package.json +0 -29
  48. package/test-project/pnpm-lock.yaml +0 -1728
  49. package/test-project/src/auth.ts +0 -47
  50. package/test-project/src/index.ts +0 -40
  51. package/tsconfig.json +0 -21
@@ -1,1019 +0,0 @@
1
- import { useState, useEffect } from 'react'
2
- import {
3
- Database,
4
- Shield,
5
- Mail,
6
- Globe,
7
- Clock,
8
- Zap,
9
- CheckCircle,
10
- XCircle,
11
- AlertTriangle,
12
- Info,
13
- RefreshCw,
14
- Lock,
15
- Key,
16
- Users,
17
- Settings as SettingsIcon,
18
- Bell,
19
- Eye,
20
- Puzzle
21
- } from 'lucide-react'
22
- import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
23
- import { Badge } from '@/components/ui/badge'
24
-
25
- interface AuthConfig {
26
- appName?: string
27
- baseURL?: string
28
- basePath?: string
29
- secret?: string
30
- database?: {
31
- type?: string
32
- url?: string
33
- dialect?: string
34
- casing?: string
35
- debugLogs?: boolean
36
- }
37
- secondaryStorage?: any
38
- emailVerification?: {
39
- sendOnSignUp?: boolean
40
- sendOnSignIn?: boolean
41
- autoSignInAfterVerification?: boolean
42
- expiresIn?: number
43
- }
44
- emailAndPassword?: {
45
- enabled: boolean
46
- disableSignUp?: boolean
47
- requireEmailVerification?: boolean
48
- maxPasswordLength?: number
49
- minPasswordLength?: number
50
- resetPasswordTokenExpiresIn?: number
51
- autoSignIn?: boolean
52
- revokeSessionsOnPasswordReset?: boolean
53
- }
54
- socialProviders?: Array<{
55
- type: string
56
- clientId?: string
57
- clientSecret?: string
58
- redirectUri?: string
59
- }>
60
- user?: {
61
- modelName?: string
62
- changeEmail?: {
63
- enabled: boolean
64
- }
65
- deleteUser?: {
66
- enabled?: boolean
67
- deleteTokenExpiresIn?: number
68
- }
69
- }
70
- session?: {
71
- modelName?: string
72
- expiresIn?: number
73
- updateAge?: number
74
- disableSessionRefresh?: boolean
75
- storeSessionInDatabase?: boolean
76
- preserveSessionInDatabase?: boolean
77
- cookieCache?: {
78
- enabled?: boolean
79
- maxAge?: number
80
- }
81
- freshAge?: number
82
- }
83
- account?: {
84
- modelName?: string
85
- updateAccountOnSignIn?: boolean
86
- accountLinking?: {
87
- enabled?: boolean
88
- trustedProviders?: string[]
89
- allowDifferentEmails?: boolean
90
- allowUnlinkingAll?: boolean
91
- updateUserInfoOnLink?: boolean
92
- }
93
- encryptOAuthTokens?: boolean
94
- }
95
- verification?: {
96
- modelName?: string
97
- disableCleanup?: boolean
98
- }
99
- trustedOrigins?: string[]
100
- rateLimit?: {
101
- enabled?: boolean
102
- window?: number
103
- max?: number
104
- storage?: string
105
- modelName?: string
106
- }
107
- advanced?: {
108
- ipAddress?: {
109
- ipAddressHeaders?: string[]
110
- disableIpTracking?: boolean
111
- }
112
- useSecureCookies?: boolean
113
- disableCSRFCheck?: boolean
114
- crossSubDomainCookies?: {
115
- enabled: boolean
116
- additionalCookies?: string[]
117
- domain?: string
118
- }
119
- cookies?: Record<string, any>
120
- defaultCookieAttributes?: any
121
- cookiePrefix?: string
122
- database?: {
123
- defaultFindManyLimit?: number
124
- useNumberId?: boolean
125
- }
126
- }
127
- logger?: any
128
- disabledPaths?: string[]
129
- telemetry?: {
130
- enabled?: boolean
131
- debug?: boolean
132
- }
133
- }
134
-
135
- interface SystemInfo {
136
- studioVersion: string
137
- nodeVersion: string
138
- platform: string
139
- uptime: string
140
- }
141
-
142
- interface Plugin {
143
- id: string
144
- name: string
145
- version: string
146
- description: string
147
- enabled: boolean
148
- }
149
-
150
- interface PluginsResponse {
151
- plugins: Plugin[]
152
- configPath: string | null
153
- totalPlugins: number
154
- error?: string
155
- }
156
-
157
- export default function Settings() {
158
- const [config, setConfig] = useState<AuthConfig | null>(null)
159
- const [systemInfo, setSystemInfo] = useState<SystemInfo | null>(null)
160
- const [plugins, setPlugins] = useState<PluginsResponse | null>(null)
161
- const [loading, setLoading] = useState(true)
162
-
163
- useEffect(() => {
164
- fetchConfig()
165
- fetchSystemInfo()
166
- fetchPlugins()
167
- }, [])
168
-
169
- const fetchConfig = async () => {
170
- try {
171
- const response = await fetch('/api/config')
172
- const data = await response.json()
173
- console.log('Config data:', data)
174
- setConfig(data)
175
- } catch (error) {
176
- console.error('Failed to fetch config:', error)
177
- } finally {
178
- setLoading(false)
179
- }
180
- }
181
-
182
- const fetchSystemInfo = async () => {
183
- try {
184
- const response = await fetch('/api/health')
185
- const data = await response.json()
186
- console.log('System info:', data)
187
- setSystemInfo(data.system || {
188
- studioVersion: 'v1.0.0',
189
- nodeVersion: process.version,
190
- platform: navigator.platform,
191
- uptime: '2h 15m'
192
- })
193
- } catch (error) {
194
- console.error('Failed to fetch system info:', error)
195
- setSystemInfo({
196
- studioVersion: 'v1.0.0',
197
- nodeVersion: 'v18.0.0',
198
- platform: 'macOS',
199
- uptime: '2h 15m'
200
- })
201
- }
202
- }
203
-
204
- const fetchPlugins = async () => {
205
- try {
206
- const response = await fetch('/api/plugins')
207
- const data = await response.json()
208
- setPlugins(data)
209
- } catch (error) {
210
- console.error('Failed to fetch plugins:', error)
211
- setPlugins({
212
- plugins: [],
213
- configPath: null,
214
- totalPlugins: 0,
215
- error: 'Failed to fetch plugins'
216
- })
217
- }
218
- }
219
-
220
- const getConnectionStatus = (type: string) => {
221
- switch (type?.toLowerCase()) {
222
- case 'postgresql':
223
- case 'postgres':
224
- return <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1"><CheckCircle className="w-3 h-3" />Connected</Badge>
225
- case 'mysql':
226
- return <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1"><CheckCircle className="w-3 h-3" />Connected</Badge>
227
- case 'sqlite':
228
- return <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1"><Info className="w-3 h-3" />Local</Badge>
229
- default:
230
- return <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1"><AlertTriangle className="w-3 h-3" />Unknown</Badge>
231
- }
232
- }
233
-
234
- const getProviderIcon = (provider: string) => {
235
- switch (provider.toLowerCase()) {
236
- case 'google':
237
- return <Globe className="w-5 h-5 text-white" />
238
- case 'github':
239
- return <Shield className="w-5 h-5 text-white" />
240
- case 'discord':
241
- return <Globe className="w-5 h-5 text-white" />
242
- case 'twitter':
243
- return <Globe className="w-5 h-5 text-white" />
244
- default:
245
- return <Globe className="w-5 h-5 text-white" />
246
- }
247
- }
248
-
249
- if (loading) {
250
- return (
251
- <div className="flex items-center justify-center h-64">
252
- <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-white"></div>
253
- </div>
254
- )
255
- }
256
-
257
- return (
258
- <div className="space-y-8 animate-fade-in">
259
- <div className="flex items-center justify-between p-5 pt-7">
260
- <div>
261
- <h1 className="text-3xl font-normal text-white tracking-tight">Settings</h1>
262
- <p className="text-gray-300 mt-2">Configure your Better Auth application</p>
263
- </div>
264
-
265
- </div>
266
- <hr className='w-full border-white/15 h-px'/>
267
- <hr className='w-full border-white/15 h-px'/>
268
- <div className="grid grid-cols-1 lg:grid-cols-2 gap-8 p-5">
269
- {/* Application Configuration */}
270
- <Card className="border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none">
271
- <CardHeader>
272
- <CardTitle className="text-white flex items-center space-x-2">
273
- <SettingsIcon className="w-5 h-5 text-white" />
274
- <span>Application</span>
275
- </CardTitle>
276
- <CardDescription>Basic application configuration</CardDescription>
277
- </CardHeader>
278
- <hr className='w-full border-white/15 h-px -mt-3 mb-1'/>
279
- <CardContent className="space-y-0 px-0 pb-0 border-b-none">
280
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
281
- <div className="flex items-center space-x-3">
282
- <Globe className="w-5 h-5 text-white" />
283
- <div>
284
- <p className="text-sm font-medium text-white">App Name</p>
285
- <p className="text-xs text-gray-400">Application display name</p>
286
- </div>
287
- </div>
288
- <div className="text-right">
289
- <p className="text-sm font-medium text-white">
290
- {config?.appName || 'Better Auth'}
291
- </p>
292
- </div>
293
- </div>
294
-
295
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
296
- <div className="flex items-center space-x-3">
297
- <Key className="w-5 h-5 text-white" />
298
- <div>
299
- <p className="text-sm font-medium text-white">Base URL</p>
300
- <p className="text-xs text-gray-400">Application base URL</p>
301
- </div>
302
- </div>
303
- <div className="text-right">
304
- <p className="text-sm font-medium text-white">
305
- {config?.baseURL || 'Not set'}
306
- </p>
307
- </div>
308
- </div>
309
-
310
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
311
- <div className="flex items-center space-x-3">
312
- <Lock className="w-5 h-5 text-white" />
313
- <div>
314
- <p className="text-sm font-medium text-white">Base Path</p>
315
- <p className="text-xs text-gray-400">Auth API base path</p>
316
- </div>
317
- </div>
318
- <div className="text-right">
319
- <p className="text-sm font-medium text-white">
320
- {config?.basePath || '/api/auth'}
321
- </p>
322
- </div>
323
- </div>
324
-
325
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
326
- <div className="flex items-center space-x-3">
327
- <Shield className="w-5 h-5 text-white" />
328
- <div>
329
- <p className="text-sm font-medium text-white">Secret</p>
330
- <p className="text-xs text-gray-400">Encryption secret</p>
331
- </div>
332
- </div>
333
- <div className="text-right">
334
- <p className="text-sm font-medium text-white">
335
- {config?.secret ? 'Configured' : 'Not set'}
336
- </p>
337
- </div>
338
- </div>
339
- </CardContent>
340
- </Card>
341
-
342
- {/* Database Configuration */}
343
- <Card className="border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none">
344
- <CardHeader>
345
- <CardTitle className="text-white flex items-center space-x-2">
346
- <Database className="w-5 h-5 text-white" />
347
- <span>Database</span>
348
- </CardTitle>
349
- <CardDescription>Database connection and configuration</CardDescription>
350
- </CardHeader>
351
- <hr className='w-full border-white/15 h-px -mt-3 mb-1'/>
352
- <CardContent className="space-y-0 px-0 pb-0 border-b-none">
353
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
354
- <div className="flex items-center space-x-3">
355
- <Database className="w-5 h-5 text-white" />
356
- <div>
357
- <p className="text-sm font-medium text-white">
358
- {config?.database?.type || 'Unknown'}
359
- </p>
360
- <p className="text-xs text-gray-400">Database Type</p>
361
- </div>
362
- </div>
363
- {config?.database?.type && getConnectionStatus(config.database.type)}
364
- </div>
365
-
366
- {config?.database?.dialect && (
367
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
368
- <div className="flex items-center space-x-3">
369
- <Database className="w-5 h-5 text-white" />
370
- <div>
371
- <p className="text-sm font-medium text-white">Dialect</p>
372
- <p className="text-xs text-gray-400">Database dialect</p>
373
- </div>
374
- </div>
375
- <div className="text-right">
376
- <p className="text-sm font-medium text-white">
377
- {config.database.dialect}
378
- </p>
379
- </div>
380
- </div>
381
- )}
382
-
383
- {config?.database?.casing && (
384
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
385
- <div className="flex items-center space-x-3">
386
- <SettingsIcon className="w-5 h-5 text-white" />
387
- <div>
388
- <p className="text-sm font-medium text-white">Casing</p>
389
- <p className="text-xs text-gray-400">Table name casing</p>
390
- </div>
391
- </div>
392
- <div className="text-right">
393
- <p className="text-sm font-medium text-white capitalize">
394
- {config.database.casing}
395
- </p>
396
- </div>
397
- </div>
398
- )}
399
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
400
- <div className="flex items-center space-x-3">
401
- <RefreshCw className="w-5 h-5 text-white" />
402
- <div>
403
- <p className="text-sm font-medium text-white">Debug Logs</p>
404
- <p className="text-xs text-gray-400">Database debug logging</p>
405
- </div>
406
- </div>
407
- <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1">
408
- {config?.database?.debugLogs ? (
409
- <>
410
- <AlertTriangle className="w-3 h-3" />
411
- Enabled
412
- </>
413
- ) : (
414
- <>
415
- <CheckCircle className="w-3 h-3" />
416
- Disabled
417
- </>
418
- )}
419
- </Badge>
420
- </div>
421
- </CardContent>
422
- </Card>
423
-
424
- {/* Authentication Providers */}
425
- <Card className="border-white/15 bg-black rounded-none">
426
- <CardHeader className="border-b border-white/15">
427
- <CardTitle className="text-white flex items-center space-x-2">
428
- <Shield className="w-5 h-5 text-white" />
429
- <span>Providers</span>
430
- </CardTitle>
431
- <CardDescription>Configured authentication providers</CardDescription>
432
- </CardHeader>
433
- <CardContent className="p-0">
434
- {config?.socialProviders && config.socialProviders.length > 0 ? (
435
- config.socialProviders.map((provider, index) => (
436
- <div key={index} className="flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0">
437
- <div className="flex items-center space-x-3">
438
- {getProviderIcon(provider.type)}
439
- <div>
440
- <p className="text-sm font-medium text-white capitalize">{provider.type}</p>
441
- <p className="text-xs text-gray-400">
442
- {provider.clientId ? 'Configured' : 'Not configured'}
443
- </p>
444
- </div>
445
- </div>
446
- <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1">
447
- {provider.clientId ? (
448
- <>
449
- <CheckCircle className="w-3 h-3" />
450
- Active
451
- </>
452
- ) : (
453
- <>
454
- <AlertTriangle className="w-3 h-3" />
455
- Setup Required
456
- </>
457
- )}
458
- </Badge>
459
- </div>
460
- ))
461
- ) : (
462
- <div className="text-center py-8">
463
- <Shield className="w-8 h-8 text-white mx-auto mb-2" />
464
- <p className="text-sm text-gray-400">No providers configured</p>
465
- </div>
466
- )}
467
- </CardContent>
468
- </Card>
469
-
470
- {/* Email & Password */}
471
- <Card className="border-white/15 bg-black rounded-none">
472
- <CardHeader className="border-b border-white/15">
473
- <CardTitle className="text-white flex items-center space-x-2">
474
- <Mail className="w-5 h-5 text-white" />
475
- <span>Email & Password</span>
476
- </CardTitle>
477
- <CardDescription>Email authentication settings</CardDescription>
478
- </CardHeader>
479
- <CardContent className="p-0">
480
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
481
- <div className="flex items-center space-x-3">
482
- <Mail className="w-5 h-5 text-white" />
483
- <div>
484
- <p className="text-sm font-medium text-white">Email Authentication</p>
485
- <p className="text-xs text-gray-400">Allow users to sign up with email</p>
486
- </div>
487
- </div>
488
- <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1">
489
- {config?.emailAndPassword?.enabled ? (
490
- <>
491
- <CheckCircle className="w-3 h-3" />
492
- Enabled
493
- </>
494
- ) : (
495
- <>
496
- <XCircle className="w-3 h-3" />
497
- Disabled
498
- </>
499
- )}
500
- </Badge>
501
- </div>
502
-
503
- {config?.emailAndPassword?.enabled && (
504
- <>
505
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
506
- <div className="flex items-center space-x-3">
507
- <Users className="w-5 h-5 text-white" />
508
- <div>
509
- <p className="text-sm font-medium text-white">Sign Up</p>
510
- <p className="text-xs text-gray-400">Allow new user registration</p>
511
- </div>
512
- </div>
513
- <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1">
514
- {config?.emailAndPassword?.disableSignUp ? (
515
- <>
516
- <XCircle className="w-3 h-3" />
517
- Disabled
518
- </>
519
- ) : (
520
- <>
521
- <CheckCircle className="w-3 h-3" />
522
- Enabled
523
- </>
524
- )}
525
- </Badge>
526
- </div>
527
-
528
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
529
- <div className="flex items-center space-x-3">
530
- <Shield className="w-5 h-5 text-white" />
531
- <div>
532
- <p className="text-sm font-medium text-white">Email Verification</p>
533
- <p className="text-xs text-gray-400">Require email verification</p>
534
- </div>
535
- </div>
536
- <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1">
537
- {config?.emailAndPassword?.requireEmailVerification ? (
538
- <>
539
- <CheckCircle className="w-3 h-3" />
540
- Required
541
- </>
542
- ) : (
543
- <>
544
- <AlertTriangle className="w-3 h-3" />
545
- Optional
546
- </>
547
- )}
548
- </Badge>
549
- </div>
550
-
551
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
552
- <div className="flex items-center space-x-3">
553
- <Lock className="w-5 h-5 text-white" />
554
- <div>
555
- <p className="text-sm font-medium text-white">Password Length</p>
556
- <p className="text-xs text-gray-400">Min/Max password length</p>
557
- </div>
558
- </div>
559
- <div className="text-right">
560
- <p className="text-sm font-medium text-white">
561
- {config?.emailAndPassword?.minPasswordLength || 8} - {config?.emailAndPassword?.maxPasswordLength || 128}
562
- </p>
563
- </div>
564
- </div>
565
-
566
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0">
567
- <div className="flex items-center space-x-3">
568
- <Zap className="w-5 h-5 text-white" />
569
- <div>
570
- <p className="text-sm font-medium text-white">Auto Sign In</p>
571
- <p className="text-xs text-gray-400">Auto sign in after registration</p>
572
- </div>
573
- </div>
574
- <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1">
575
- {config?.emailAndPassword?.autoSignIn ? (
576
- <>
577
- <CheckCircle className="w-3 h-3" />
578
- Enabled
579
- </>
580
- ) : (
581
- <>
582
- <AlertTriangle className="w-3 h-3" />
583
- Disabled
584
- </>
585
- )}
586
- </Badge>
587
- </div>
588
- </>
589
- )}
590
- </CardContent>
591
- </Card>
592
-
593
- {/* Session Configuration */}
594
- <Card className="border-white/15 bg-black rounded-none">
595
- <CardHeader className="border-b border-white/15">
596
- <CardTitle className="text-white flex items-center space-x-2">
597
- <Clock className="w-5 h-5 text-white" />
598
- <span>Session</span>
599
- </CardTitle>
600
- <CardDescription>Session management settings</CardDescription>
601
- </CardHeader>
602
- <CardContent className="p-0">
603
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
604
- <div className="flex items-center space-x-3">
605
- <Clock className="w-5 h-5 text-white" />
606
- <div>
607
- <p className="text-sm font-medium text-white">Session Duration</p>
608
- <p className="text-xs text-gray-400">How long sessions last</p>
609
- </div>
610
- </div>
611
- <div className="text-right">
612
- <p className="text-sm font-medium text-white">
613
- {config?.session?.expiresIn ? `${Math.floor(config.session.expiresIn / (60 * 60 * 24))} days` : '7 days'}
614
- </p>
615
- <p className="text-xs text-gray-400">Default</p>
616
- </div>
617
- </div>
618
-
619
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
620
- <div className="flex items-center space-x-3">
621
- <RefreshCw className="w-5 h-5 text-white" />
622
- <div>
623
- <p className="text-sm font-medium text-white">Update Age</p>
624
- <p className="text-xs text-gray-400">Session refresh interval</p>
625
- </div>
626
- </div>
627
- <div className="text-right">
628
- <p className="text-sm font-medium text-white">
629
- {config?.session?.updateAge ? `${Math.floor(config.session.updateAge / (60 * 60))} hours` : '24 hours'}
630
- </p>
631
- </div>
632
- </div>
633
-
634
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
635
- <div className="flex items-center space-x-3">
636
- <Zap className="w-5 h-5 text-white" />
637
- <div>
638
- <p className="text-sm font-medium text-white">Session Refresh</p>
639
- <p className="text-xs text-gray-400">Auto refresh sessions</p>
640
- </div>
641
- </div>
642
- <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1">
643
- {config?.session?.disableSessionRefresh ? (
644
- <>
645
- <XCircle className="w-3 h-3" />
646
- Disabled
647
- </>
648
- ) : (
649
- <>
650
- <CheckCircle className="w-3 h-3" />
651
- Enabled
652
- </>
653
- )}
654
- </Badge>
655
- </div>
656
-
657
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0">
658
- <div className="flex items-center space-x-3">
659
- <Database className="w-5 h-5 text-white" />
660
- <div>
661
- <p className="text-sm font-medium text-white">Store in Database</p>
662
- <p className="text-xs text-gray-400">Store sessions in database</p>
663
- </div>
664
- </div>
665
- <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1">
666
- {config?.session?.storeSessionInDatabase ? (
667
- <>
668
- <CheckCircle className="w-3 h-3" />
669
- Enabled
670
- </>
671
- ) : (
672
- <>
673
- <Info className="w-3 h-3" />
674
- Secondary Storage
675
- </>
676
- )}
677
- </Badge>
678
- </div>
679
- </CardContent>
680
- </Card>
681
-
682
- {/* Rate Limiting */}
683
- <Card className="border-white/15 bg-black rounded-none">
684
- <CardHeader className="border-b border-white/15">
685
- <CardTitle className="text-white flex items-center space-x-2">
686
- <Shield className="w-5 h-5 text-white" />
687
- <span>Rate Limiting</span>
688
- </CardTitle>
689
- <CardDescription>API rate limiting configuration</CardDescription>
690
- </CardHeader>
691
- <CardContent className="p-0">
692
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
693
- <div className="flex items-center space-x-3">
694
- <Shield className="w-5 h-5 text-white" />
695
- <div>
696
- <p className="text-sm font-medium text-white">Rate Limiting</p>
697
- <p className="text-xs text-gray-400">Enable rate limiting</p>
698
- </div>
699
- </div>
700
- <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1">
701
- {config?.rateLimit?.enabled ? (
702
- <>
703
- <CheckCircle className="w-3 h-3" />
704
- Enabled
705
- </>
706
- ) : (
707
- <>
708
- <AlertTriangle className="w-3 h-3" />
709
- Disabled
710
- </>
711
- )}
712
- </Badge>
713
- </div>
714
-
715
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
716
- <div className="flex items-center space-x-3">
717
- <Clock className="w-5 h-5 text-red-400" />
718
- <div>
719
- <p className="text-sm font-medium text-white">Rate Limit Window</p>
720
- <p className="text-xs text-gray-400">Time window for rate limiting</p>
721
- </div>
722
- </div>
723
- <div className="text-right">
724
- <p className="text-sm font-medium text-white">
725
- {config?.rateLimit?.window ? `${config.rateLimit.window} seconds` : '10 seconds'}
726
- </p>
727
- <p className="text-xs text-gray-400">Window</p>
728
- </div>
729
- </div>
730
-
731
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
732
- <div className="flex items-center space-x-3">
733
- <Shield className="w-5 h-5 text-white" />
734
- <div>
735
- <p className="text-sm font-medium text-white">Max Requests</p>
736
- <p className="text-xs text-gray-400">Maximum requests per window</p>
737
- </div>
738
- </div>
739
- <div className="text-right">
740
- <p className="text-sm font-medium text-white">
741
- {config?.rateLimit?.max || 100}
742
- </p>
743
- <p className="text-xs text-gray-400">Requests</p>
744
- </div>
745
- </div>
746
-
747
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0">
748
- <div className="flex items-center space-x-3">
749
- <Database className="w-5 h-5 text-white" />
750
- <div>
751
- <p className="text-sm font-medium text-white">Storage</p>
752
- <p className="text-xs text-gray-400">Rate limit storage type</p>
753
- </div>
754
- </div>
755
- <div className="text-right">
756
- <p className="text-sm font-medium text-white capitalize">
757
- {config?.rateLimit?.storage || 'memory'}
758
- </p>
759
- </div>
760
- </div>
761
- </CardContent>
762
- </Card>
763
-
764
- {/* Advanced Configuration */}
765
- <Card className="border-white/15 bg-black rounded-none">
766
- <CardHeader className="border-b border-white/15">
767
- <CardTitle className="text-white flex items-center space-x-2">
768
- <SettingsIcon className="w-5 h-5 text-white" />
769
- <span>Advanced</span>
770
- </CardTitle>
771
- <CardDescription>Advanced configuration options</CardDescription>
772
- </CardHeader>
773
- <CardContent className="p-0">
774
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
775
- <div className="flex items-center space-x-3">
776
- <Lock className="w-5 h-5 text-white" />
777
- <div>
778
- <p className="text-sm font-medium text-white">Secure Cookies</p>
779
- <p className="text-xs text-gray-400">Use secure cookies</p>
780
- </div>
781
- </div>
782
- <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1">
783
- {config?.advanced?.useSecureCookies ? (
784
- <>
785
- <CheckCircle className="w-3 h-3" />
786
- Enabled
787
- </>
788
- ) : (
789
- <>
790
- <AlertTriangle className="w-3 h-3" />
791
- Disabled
792
- </>
793
- )}
794
- </Badge>
795
- </div>
796
-
797
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
798
- <div className="flex items-center space-x-3">
799
- <Shield className="w-5 h-5 text-white" />
800
- <div>
801
- <p className="text-sm font-medium text-white">CSRF Check</p>
802
- <p className="text-xs text-gray-400">CSRF protection</p>
803
- </div>
804
- </div>
805
- <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1">
806
- {config?.advanced?.disableCSRFCheck ? (
807
- <>
808
- <XCircle className="w-3 h-3" />
809
- Disabled
810
- </>
811
- ) : (
812
- <>
813
- <CheckCircle className="w-3 h-3" />
814
- Enabled
815
- </>
816
- )}
817
- </Badge>
818
- </div>
819
-
820
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
821
- <div className="flex items-center space-x-3">
822
- <Eye className="w-5 h-5 text-white" />
823
- <div>
824
- <p className="text-sm font-medium text-white">IP Tracking</p>
825
- <p className="text-xs text-gray-400">Track IP addresses</p>
826
- </div>
827
- </div>
828
- <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1">
829
- {config?.advanced?.ipAddress?.disableIpTracking ? (
830
- <>
831
- <XCircle className="w-3 h-3" />
832
- Disabled
833
- </>
834
- ) : (
835
- <>
836
- <CheckCircle className="w-3 h-3" />
837
- Enabled
838
- </>
839
- )}
840
- </Badge>
841
- </div>
842
-
843
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0">
844
- <div className="flex items-center space-x-3">
845
- <Bell className="w-5 h-5 text-white" />
846
- <div>
847
- <p className="text-sm font-medium text-white">Telemetry</p>
848
- <p className="text-xs text-gray-400">Usage analytics</p>
849
- </div>
850
- </div>
851
- <Badge variant="secondary" className="text-xs group-hover:bg-white group-hover:border-black group-hover:text-black bg-black/70 border border-white/15 rounded-none border-dashed flex items-center gap-1">
852
- {config?.telemetry?.enabled ? (
853
- <>
854
- <AlertTriangle className="w-3 h-3" />
855
- Enabled
856
- </>
857
- ) : (
858
- <>
859
- <CheckCircle className="w-3 h-3" />
860
- Disabled
861
- </>
862
- )}
863
- </Badge>
864
- </div>
865
- </CardContent>
866
- </Card>
867
-
868
- {/* System Information */}
869
- <Card className="border-white/15 bg-black rounded-none">
870
- <CardHeader className="border-b border-white/15">
871
- <CardTitle className="text-white flex items-center space-x-2">
872
- <Info className="w-5 h-5 text-white" />
873
- <span>System Info</span>
874
- </CardTitle>
875
- <CardDescription>Better Auth Studio system information</CardDescription>
876
- </CardHeader>
877
- <CardContent className="p-0">
878
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
879
- <div className="flex items-center space-x-3">
880
- <Zap className="w-5 h-5 text-white" />
881
- <div>
882
- <p className="text-sm font-medium text-white">Studio Version</p>
883
- <p className="text-xs text-gray-400">Better Auth Studio</p>
884
- </div>
885
- </div>
886
- <div className="text-right">
887
- <p className="text-sm font-medium text-white">
888
- {systemInfo?.studioVersion || 'v1.0.0'}
889
- </p>
890
- <p className="text-xs text-gray-400">Latest</p>
891
- </div>
892
- </div>
893
-
894
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
895
- <div className="flex items-center space-x-3">
896
- <Info className="w-5 h-5 text-white" />
897
- <div>
898
- <p className="text-sm font-medium text-white">Node.js Version</p>
899
- <p className="text-xs text-gray-400">Runtime environment</p>
900
- </div>
901
- </div>
902
- <div className="text-right">
903
- <p className="text-sm font-medium text-white">
904
- {systemInfo?.nodeVersion || 'v18.0.0'}
905
- </p>
906
- <p className="text-xs text-gray-400">Current</p>
907
- </div>
908
- </div>
909
-
910
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
911
- <div className="flex items-center space-x-3">
912
- <Globe className="w-5 h-5 text-white" />
913
- <div>
914
- <p className="text-sm font-medium text-white">Platform</p>
915
- <p className="text-xs text-gray-400">Operating system</p>
916
- </div>
917
- </div>
918
- <div className="text-right">
919
- <p className="text-sm font-medium text-white">
920
- {systemInfo?.platform || 'macOS'}
921
- </p>
922
- <p className="text-xs text-gray-400">System</p>
923
- </div>
924
- </div>
925
-
926
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15 last:border-b-0">
927
- <div className="flex items-center space-x-3">
928
- <Clock className="w-5 h-5 text-white" />
929
- <div>
930
- <p className="text-sm font-medium text-white">Uptime</p>
931
- <p className="text-xs text-gray-400">Service uptime</p>
932
- </div>
933
- </div>
934
- <div className="text-right">
935
- <p className="text-sm font-medium text-white">
936
- {systemInfo?.uptime || '2h 15m'}
937
- </p>
938
- <p className="text-xs text-gray-400">Running</p>
939
- </div>
940
- </div>
941
- </CardContent>
942
- </Card>
943
-
944
- {/* Plugins Configuration */}
945
- <Card className="border-white/15 bg-black/70 px-0 sm:px-0 md:px-0 lg:px-0 xl:px-0 rounded-none lg:col-span-2">
946
- <CardHeader>
947
- <CardTitle className="text-white flex items-center space-x-2">
948
- <Puzzle className="w-5 h-5 text-white" />
949
- <span>Plugins</span>
950
- </CardTitle>
951
- <CardDescription>Better Auth plugins enabled in your configuration</CardDescription>
952
- </CardHeader>
953
- <hr className='w-full border-white/15 h-px -mt-3 mb-1'/>
954
- <CardContent className="space-y-0 px-0 pb-0 border-b-none">
955
- {plugins?.plugins && plugins.plugins.length > 0 ? (
956
- <>
957
- <div className="flex items-center justify-between p-4 px-5 border-b border-white/15">
958
- <div className="flex items-center space-x-3">
959
- <Info className="w-5 h-5 text-white" />
960
- <div>
961
- <p className="text-sm font-medium text-white">Total Plugins</p>
962
- <p className="text-xs text-gray-400">Currently enabled plugins</p>
963
- </div>
964
- </div>
965
- <div className="text-right">
966
- <p className="text-sm font-medium text-white">{plugins.totalPlugins}</p>
967
- <p className="text-xs text-gray-400">Active</p>
968
- </div>
969
- </div>
970
-
971
- {plugins.plugins.map((plugin, index) => (
972
- <div key={plugin.id} className={`flex items-center justify-between p-4 px-5 ${index < plugins.plugins.length - 1 ? 'border-b border-white/15' : ''}`}>
973
- <div className="flex items-center space-x-3">
974
- <Puzzle className="w-5 h-5 text-white" />
975
- <div>
976
- <p className="text-sm font-medium text-white">{plugin.name}</p>
977
- <p className="text-xs text-gray-400">{plugin.description}</p>
978
- </div>
979
- </div>
980
- <div className="text-right flex items-center space-x-2">
981
- <Badge variant="secondary" className="text-xs bg-green-900/50 border border-green-500/30 text-green-400 rounded-sm flex items-center gap-1">
982
- <CheckCircle className="w-3 h-3" />
983
- Enabled
984
- </Badge>
985
- <p className="text-xs text-gray-400">v{plugin.version}</p>
986
- </div>
987
- </div>
988
- ))}
989
-
990
- {plugins.configPath && (
991
- <div className="p-4 px-5 bg-black/30 border-t border-white/10">
992
- <p className="text-xs text-gray-400">
993
- Config file: <span className="text-white font-mono">{plugins.configPath}</span>
994
- </p>
995
- </div>
996
- )}
997
- </>
998
- ) : (
999
- <div className="flex items-center justify-between p-4 px-5">
1000
- <div className="flex items-center space-x-3">
1001
- <AlertTriangle className="w-5 h-5 text-yellow-400" />
1002
- <div>
1003
- <p className="text-sm font-medium text-white">No Plugins Enabled</p>
1004
- <p className="text-xs text-gray-400">
1005
- {plugins?.error || 'No plugins are currently configured in your Better Auth setup'}
1006
- </p>
1007
- </div>
1008
- </div>
1009
- <Badge variant="secondary" className="text-xs bg-yellow-900/50 border border-yellow-500/30 text-yellow-400 rounded-sm">
1010
- None
1011
- </Badge>
1012
- </div>
1013
- )}
1014
- </CardContent>
1015
- </Card>
1016
- </div>
1017
- </div>
1018
- )
1019
- }