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.
- package/README.md +1 -0
- package/dist/auth-adapter.d.ts +24 -0
- package/dist/auth-adapter.d.ts.map +1 -0
- package/dist/auth-adapter.js +481 -0
- package/dist/auth-adapter.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +49 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +25 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +308 -0
- package/dist/config.js.map +1 -0
- package/dist/data.d.ts +38 -0
- package/dist/data.d.ts.map +1 -0
- package/dist/data.js +275 -0
- package/dist/data.js.map +1 -0
- package/dist/routes.d.ts +3 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +1490 -0
- package/dist/routes.js.map +1 -0
- package/dist/studio.d.ts +10 -0
- package/dist/studio.d.ts.map +1 -0
- package/dist/studio.js +70 -0
- package/dist/studio.js.map +1 -0
- package/frontend/index.html +13 -0
- package/frontend/package-lock.json +4675 -0
- package/frontend/package.json +52 -0
- package/frontend/pnpm-lock.yaml +4020 -0
- package/frontend/postcss.config.js +6 -0
- package/frontend/src/App.tsx +36 -0
- package/frontend/src/components/CommandPalette.tsx +219 -0
- package/frontend/src/components/Layout.tsx +159 -0
- package/frontend/src/components/ui/badge.tsx +40 -0
- package/frontend/src/components/ui/button.tsx +53 -0
- package/frontend/src/components/ui/card.tsx +78 -0
- package/frontend/src/components/ui/input.tsx +20 -0
- package/frontend/src/components/ui/label.tsx +19 -0
- package/frontend/src/components/ui/select.tsx +71 -0
- package/frontend/src/index.css +130 -0
- package/frontend/src/lib/utils.ts +6 -0
- package/frontend/src/main.tsx +10 -0
- package/frontend/src/pages/Dashboard.tsx +231 -0
- package/frontend/src/pages/OrganizationDetails.tsx +1281 -0
- package/frontend/src/pages/Organizations.tsx +874 -0
- package/frontend/src/pages/Sessions.tsx +623 -0
- package/frontend/src/pages/Settings.tsx +1019 -0
- package/frontend/src/pages/TeamDetails.tsx +666 -0
- package/frontend/src/pages/Users.tsx +728 -0
- package/frontend/tailwind.config.js +75 -0
- package/frontend/tsconfig.json +31 -0
- package/frontend/tsconfig.node.json +10 -0
- package/frontend/vite.config.ts +31 -0
- package/package.json +59 -0
- package/public/assets/main-C-TXCXVW.css +1 -0
- package/public/assets/main-CCzTTP3P.js +296 -0
- package/public/index.html +14 -0
- package/src/auth-adapter.ts +471 -0
- package/src/cli.ts +51 -0
- package/src/config.ts +318 -0
- package/src/data.ts +351 -0
- package/src/routes.ts +1585 -0
- package/src/studio.ts +86 -0
- package/test-project/README.md +0 -0
- package/test-project/better-auth.db +0 -0
- package/test-project/better-auth_migrations/2025-08-27T15-55-04.099Z.sql +7 -0
- package/test-project/better-auth_migrations/2025-09-04T02-33-19.422Z.sql +7 -0
- package/test-project/package.json +29 -0
- package/test-project/pnpm-lock.yaml +1728 -0
- package/test-project/src/auth.ts +47 -0
- package/test-project/src/index.ts +40 -0
- 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
|
+
}
|