stackkit-cli 0.3.1 → 0.4.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 +19 -17
- package/dist/commands/add.d.ts +0 -1
- package/dist/commands/add.js +0 -1
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.js +0 -1
- package/dist/commands/list.d.ts +0 -1
- package/dist/commands/list.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -2
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +0 -1
- package/dist/utils/code-inject.d.ts +0 -1
- package/dist/utils/code-inject.js +0 -1
- package/dist/utils/detect.d.ts +0 -1
- package/dist/utils/detect.js +0 -1
- package/dist/utils/env-editor.d.ts +0 -1
- package/dist/utils/env-editor.js +0 -1
- package/dist/utils/files.d.ts +0 -1
- package/dist/utils/files.js +0 -1
- package/dist/utils/json-editor.d.ts +0 -1
- package/dist/utils/json-editor.js +0 -1
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/logger.js +3 -2
- package/dist/utils/package-manager.d.ts +0 -1
- package/dist/utils/package-manager.js +0 -1
- package/modules/auth/better-auth-nextjs/files/api/auth/[...all]/route.ts +3 -1
- package/modules/auth/better-auth-nextjs/files/lib/auth.ts +19 -11
- package/modules/auth/better-auth-nextjs/module.json +7 -4
- package/modules/auth/clerk-express/files/lib/auth.ts +7 -0
- package/modules/auth/clerk-express/module.json +19 -0
- package/modules/auth/clerk-nextjs/files/lib/auth-provider.tsx +5 -0
- package/modules/auth/clerk-nextjs/files/middleware.ts +9 -0
- package/modules/auth/clerk-nextjs/module.json +27 -0
- package/modules/auth/clerk-react/files/lib/auth-provider.tsx +15 -0
- package/modules/auth/clerk-react/module.json +18 -0
- package/modules/database/drizzle-postgresql/files/drizzle.config.ts +10 -0
- package/modules/database/drizzle-postgresql/files/lib/db.ts +7 -0
- package/modules/database/drizzle-postgresql/files/lib/schema.ts +8 -0
- package/modules/database/drizzle-postgresql/module.json +34 -0
- package/modules/database/mongoose-mongodb/files/lib/db.ts +40 -0
- package/modules/database/mongoose-mongodb/module.json +17 -0
- package/package.json +4 -3
- package/templates/bases/nextjs-base/README.md +36 -0
- package/templates/bases/nextjs-base/app/favicon.ico +0 -0
- package/templates/bases/nextjs-base/app/globals.css +26 -3
- package/templates/bases/nextjs-base/app/layout.tsx +21 -6
- package/templates/bases/nextjs-base/app/page.tsx +61 -4
- package/templates/bases/nextjs-base/eslint.config.mjs +18 -0
- package/templates/bases/nextjs-base/next.config.ts +4 -2
- package/templates/bases/nextjs-base/package-lock.json +6538 -0
- package/templates/bases/nextjs-base/package.json +12 -10
- package/templates/bases/nextjs-base/postcss.config.mjs +7 -0
- package/templates/bases/nextjs-base/public/file.svg +1 -0
- package/templates/bases/nextjs-base/public/globe.svg +1 -0
- package/templates/bases/nextjs-base/public/next.svg +1 -0
- package/templates/bases/nextjs-base/public/vercel.svg +1 -0
- package/templates/bases/nextjs-base/public/window.svg +1 -0
- package/templates/bases/nextjs-base/template.json +12 -1
- package/templates/bases/nextjs-base/tsconfig.json +9 -2
- package/templates/bases/react-vite-base/index.html +13 -0
- package/templates/bases/react-vite-base/package.json +27 -0
- package/templates/bases/react-vite-base/src/App.css +14 -0
- package/templates/bases/react-vite-base/src/App.tsx +23 -0
- package/templates/bases/react-vite-base/src/index.css +68 -0
- package/templates/bases/react-vite-base/src/main.tsx +10 -0
- package/templates/bases/react-vite-base/src/vite-env.d.ts +1 -0
- package/templates/bases/react-vite-base/template.json +5 -0
- package/templates/bases/react-vite-base/tsconfig.json +21 -0
- package/templates/bases/react-vite-base/vite.config.ts +7 -0
- package/dist/commands/add.d.ts.map +0 -1
- package/dist/commands/add.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/list.d.ts.map +0 -1
- package/dist/commands/list.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/utils/code-inject.d.ts.map +0 -1
- package/dist/utils/code-inject.js.map +0 -1
- package/dist/utils/detect.d.ts.map +0 -1
- package/dist/utils/detect.js.map +0 -1
- package/dist/utils/env-editor.d.ts.map +0 -1
- package/dist/utils/env-editor.js.map +0 -1
- package/dist/utils/files.d.ts.map +0 -1
- package/dist/utils/files.js.map +0 -1
- package/dist/utils/json-editor.d.ts.map +0 -1
- package/dist/utils/json-editor.js.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/package-manager.d.ts.map +0 -1
- package/dist/utils/package-manager.js.map +0 -1
- package/templates/auth/authjs-express/config.json +0 -20
- package/templates/auth/authjs-express/files/lib/auth.ts +0 -43
- package/templates/auth/authjs-express/files/routes/auth.ts +0 -12
- package/templates/auth/authjs-express/lib/auth.ts +0 -43
- package/templates/auth/authjs-express/module.json +0 -39
- package/templates/auth/authjs-express/routes/auth.ts +0 -12
- package/templates/auth/authjs-nextjs/app/api/auth/[...nextauth]/route.ts +0 -3
- package/templates/auth/authjs-nextjs/config.json +0 -19
- package/templates/auth/authjs-nextjs/files/api/auth/[...nextauth]/route.ts +0 -3
- package/templates/auth/authjs-nextjs/files/lib/auth.ts +0 -45
- package/templates/auth/authjs-nextjs/lib/auth.ts +0 -45
- package/templates/auth/authjs-nextjs/module.json +0 -38
- package/templates/auth/better-auth-express/config.json +0 -18
- package/templates/auth/better-auth-express/src/lib/auth.ts +0 -12
- package/templates/auth/better-auth-express/src/routes/auth.ts +0 -10
- package/templates/auth/better-auth-nextjs/app/api/auth/[...all]/route.ts +0 -4
- package/templates/auth/better-auth-nextjs/config.json +0 -18
- package/templates/auth/better-auth-nextjs/lib/auth.ts +0 -14
- package/templates/auth/better-auth-react/config.json +0 -15
- package/templates/auth/better-auth-react/files/lib/auth-client.ts +0 -9
- package/templates/auth/better-auth-react/lib/auth-client.ts +0 -9
- package/templates/auth/better-auth-react/module.json +0 -26
- package/templates/auth/nextauth/app/api/auth/[...nextauth]/route.ts +0 -3
- package/templates/auth/nextauth/config.json +0 -18
- package/templates/auth/nextauth/lib/auth.ts +0 -31
- package/templates/bases/nextjs-base/.eslintrc.json +0 -3
- package/templates/databases/prisma-mongodb/config.json +0 -21
- package/templates/databases/prisma-mongodb/lib/db.ts +0 -13
- package/templates/databases/prisma-mongodb/prisma/schema.prisma +0 -16
- package/templates/databases/prisma-postgresql/config.json +0 -22
- package/templates/databases/prisma-postgresql/lib/db.ts +0 -13
- package/templates/databases/prisma-postgresql/prisma/schema.prisma +0 -16
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "auth",
|
|
3
|
-
"displayName": "Auth.js (Express)",
|
|
4
|
-
"description": "Authentication with Auth.js for Express",
|
|
5
|
-
"category": "auth",
|
|
6
|
-
"supportedFrameworks": ["express"],
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"@auth/express": "^0.7.6",
|
|
9
|
-
"@auth/core": "^0.37.4"
|
|
10
|
-
},
|
|
11
|
-
"envVars": [
|
|
12
|
-
{
|
|
13
|
-
"key": "AUTH_SECRET",
|
|
14
|
-
"value": "",
|
|
15
|
-
"description": "Secret for encrypting tokens. Generate with: openssl rand -base64 32",
|
|
16
|
-
"required": true
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"key": "AUTH_TRUST_HOST",
|
|
20
|
-
"value": "true",
|
|
21
|
-
"description": "Trust the host header (required for Express)",
|
|
22
|
-
"required": true
|
|
23
|
-
}
|
|
24
|
-
],
|
|
25
|
-
"patches": [
|
|
26
|
-
{
|
|
27
|
-
"type": "create-file",
|
|
28
|
-
"description": "Create Auth.js configuration",
|
|
29
|
-
"source": "lib/auth.ts",
|
|
30
|
-
"destination": "src/lib/auth.ts"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"type": "create-file",
|
|
34
|
-
"description": "Create auth routes",
|
|
35
|
-
"source": "routes/auth.ts",
|
|
36
|
-
"destination": "src/routes/auth.ts"
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Router } from 'express';
|
|
2
|
-
import { Auth } from '@auth/core';
|
|
3
|
-
import { authConfig } from '../lib/auth';
|
|
4
|
-
|
|
5
|
-
const router = Router();
|
|
6
|
-
|
|
7
|
-
router.all('/auth/*', async (req, res) => {
|
|
8
|
-
const response = await Auth(req, authConfig);
|
|
9
|
-
return res.status(response.status).json(response.body);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export default router;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "authjs-nextjs",
|
|
3
|
-
"displayName": "Auth.js v5 (Next.js)",
|
|
4
|
-
"description": "Modern authentication with Auth.js v5 (NextAuth successor)",
|
|
5
|
-
"frameworks": ["nextjs"],
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"next-auth": "^5.0.0-beta.25"
|
|
8
|
-
},
|
|
9
|
-
"envVars": {
|
|
10
|
-
"AUTH_SECRET": {
|
|
11
|
-
"value": "",
|
|
12
|
-
"description": "Secret for encrypting tokens. Generate with: openssl rand -base64 32"
|
|
13
|
-
},
|
|
14
|
-
"AUTH_URL": {
|
|
15
|
-
"value": "http://localhost:3000",
|
|
16
|
-
"description": "Canonical URL of your site (change in production)"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import NextAuth from 'next-auth';
|
|
2
|
-
import GitHub from 'next-auth/providers/github';
|
|
3
|
-
import Google from 'next-auth/providers/google';
|
|
4
|
-
import Credentials from 'next-auth/providers/credentials';
|
|
5
|
-
|
|
6
|
-
export const { handlers, signIn, signOut, auth } = NextAuth({
|
|
7
|
-
providers: [
|
|
8
|
-
// GitHub OAuth Provider
|
|
9
|
-
// Uncomment and add GITHUB_ID and GITHUB_SECRET to .env
|
|
10
|
-
// GitHub({
|
|
11
|
-
// clientId: process.env.GITHUB_ID!,
|
|
12
|
-
// clientSecret: process.env.GITHUB_SECRET!,
|
|
13
|
-
// }),
|
|
14
|
-
|
|
15
|
-
// Google OAuth Provider
|
|
16
|
-
// Uncomment and add GOOGLE_ID and GOOGLE_SECRET to .env
|
|
17
|
-
// Google({
|
|
18
|
-
// clientId: process.env.GOOGLE_ID!,
|
|
19
|
-
// clientSecret: process.env.GOOGLE_SECRET!,
|
|
20
|
-
// }),
|
|
21
|
-
|
|
22
|
-
// Credentials Provider (email/password)
|
|
23
|
-
Credentials({
|
|
24
|
-
credentials: {
|
|
25
|
-
email: { label: 'Email', type: 'email' },
|
|
26
|
-
password: { label: 'Password', type: 'password' },
|
|
27
|
-
},
|
|
28
|
-
authorize: async (credentials) => {
|
|
29
|
-
// Add your own authentication logic here
|
|
30
|
-
// This is just a demo - DO NOT use in production
|
|
31
|
-
if (credentials?.email === 'demo@example.com' && credentials?.password === 'demo') {
|
|
32
|
-
return {
|
|
33
|
-
id: '1',
|
|
34
|
-
name: 'Demo User',
|
|
35
|
-
email: 'demo@example.com',
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
},
|
|
40
|
-
}),
|
|
41
|
-
],
|
|
42
|
-
pages: {
|
|
43
|
-
signIn: '/auth/signin',
|
|
44
|
-
},
|
|
45
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import NextAuth from 'next-auth';
|
|
2
|
-
import GitHub from 'next-auth/providers/github';
|
|
3
|
-
import Google from 'next-auth/providers/google';
|
|
4
|
-
import Credentials from 'next-auth/providers/credentials';
|
|
5
|
-
|
|
6
|
-
export const { handlers, signIn, signOut, auth } = NextAuth({
|
|
7
|
-
providers: [
|
|
8
|
-
// GitHub OAuth Provider
|
|
9
|
-
// Uncomment and add GITHUB_ID and GITHUB_SECRET to .env
|
|
10
|
-
// GitHub({
|
|
11
|
-
// clientId: process.env.GITHUB_ID!,
|
|
12
|
-
// clientSecret: process.env.GITHUB_SECRET!,
|
|
13
|
-
// }),
|
|
14
|
-
|
|
15
|
-
// Google OAuth Provider
|
|
16
|
-
// Uncomment and add GOOGLE_ID and GOOGLE_SECRET to .env
|
|
17
|
-
// Google({
|
|
18
|
-
// clientId: process.env.GOOGLE_ID!,
|
|
19
|
-
// clientSecret: process.env.GOOGLE_SECRET!,
|
|
20
|
-
// }),
|
|
21
|
-
|
|
22
|
-
// Credentials Provider (email/password)
|
|
23
|
-
Credentials({
|
|
24
|
-
credentials: {
|
|
25
|
-
email: { label: 'Email', type: 'email' },
|
|
26
|
-
password: { label: 'Password', type: 'password' },
|
|
27
|
-
},
|
|
28
|
-
authorize: async (credentials) => {
|
|
29
|
-
// Add your own authentication logic here
|
|
30
|
-
// This is just a demo - DO NOT use in production
|
|
31
|
-
if (credentials?.email === 'demo@example.com' && credentials?.password === 'demo') {
|
|
32
|
-
return {
|
|
33
|
-
id: '1',
|
|
34
|
-
name: 'Demo User',
|
|
35
|
-
email: 'demo@example.com',
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
},
|
|
40
|
-
}),
|
|
41
|
-
],
|
|
42
|
-
pages: {
|
|
43
|
-
signIn: '/auth/signin',
|
|
44
|
-
},
|
|
45
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "auth",
|
|
3
|
-
"displayName": "Auth.js v5 (Next.js)",
|
|
4
|
-
"description": "Modern authentication with Auth.js v5 (NextAuth successor)",
|
|
5
|
-
"category": "auth",
|
|
6
|
-
"supportedFrameworks": ["nextjs"],
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"next-auth": "^5.0.0-beta.25"
|
|
9
|
-
},
|
|
10
|
-
"envVars": [
|
|
11
|
-
{
|
|
12
|
-
"key": "AUTH_SECRET",
|
|
13
|
-
"value": "",
|
|
14
|
-
"description": "Secret for encrypting tokens. Generate with: openssl rand -base64 32",
|
|
15
|
-
"required": true
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"key": "AUTH_URL",
|
|
19
|
-
"value": "http://localhost:3000",
|
|
20
|
-
"description": "Canonical URL of your site (change in production)",
|
|
21
|
-
"required": false
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"patches": [
|
|
25
|
-
{
|
|
26
|
-
"type": "create-file",
|
|
27
|
-
"description": "Create Auth.js configuration",
|
|
28
|
-
"source": "lib/auth.ts",
|
|
29
|
-
"destination": "{{lib}}/auth.ts"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"type": "create-file",
|
|
33
|
-
"description": "Create Auth.js API route",
|
|
34
|
-
"source": "api/auth/[...nextauth]/route.ts",
|
|
35
|
-
"destination": "{{router}}/api/auth/[...nextauth]/route.ts"
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "better-auth-express",
|
|
3
|
-
"displayName": "Better Auth (Express)",
|
|
4
|
-
"auth": "better-auth",
|
|
5
|
-
"compatibleWith": {
|
|
6
|
-
"frameworks": ["express"],
|
|
7
|
-
"databases": ["prisma-postgresql", "prisma-mongodb"]
|
|
8
|
-
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"better-auth": "^1.1.4",
|
|
11
|
-
"@better-auth/prisma": "^1.1.4"
|
|
12
|
-
},
|
|
13
|
-
"env": {
|
|
14
|
-
"BETTER_AUTH_SECRET": "your-secret-here",
|
|
15
|
-
"BETTER_AUTH_URL": "http://localhost:3000"
|
|
16
|
-
},
|
|
17
|
-
"files": ["src/lib/auth.ts", "src/routes/auth.ts"]
|
|
18
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { prismaAdapter } from '@better-auth/prisma';
|
|
2
|
-
import { betterAuth } from 'better-auth';
|
|
3
|
-
import { prisma } from './db';
|
|
4
|
-
|
|
5
|
-
export const auth = betterAuth({
|
|
6
|
-
database: prismaAdapter(prisma, {
|
|
7
|
-
provider: 'postgresql',
|
|
8
|
-
}),
|
|
9
|
-
emailAndPassword: {
|
|
10
|
-
enabled: true,
|
|
11
|
-
},
|
|
12
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "better-auth-nextjs",
|
|
3
|
-
"displayName": "Better Auth (Next.js)",
|
|
4
|
-
"auth": "better-auth",
|
|
5
|
-
"compatibleWith": {
|
|
6
|
-
"frameworks": ["nextjs"],
|
|
7
|
-
"databases": ["prisma-postgresql", "prisma-mongodb"]
|
|
8
|
-
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"better-auth": "^1.1.4",
|
|
11
|
-
"@better-auth/prisma": "^1.1.4"
|
|
12
|
-
},
|
|
13
|
-
"env": {
|
|
14
|
-
"BETTER_AUTH_SECRET": "your-secret-here",
|
|
15
|
-
"BETTER_AUTH_URL": "http://localhost:3000"
|
|
16
|
-
},
|
|
17
|
-
"files": ["lib/auth.ts", "app/api/auth/[...all]/route.ts"]
|
|
18
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { prismaAdapter } from '@better-auth/prisma';
|
|
2
|
-
import { betterAuth } from 'better-auth';
|
|
3
|
-
import { prisma } from './db';
|
|
4
|
-
|
|
5
|
-
export const auth = betterAuth({
|
|
6
|
-
database: prismaAdapter(prisma, {
|
|
7
|
-
provider: 'postgresql',
|
|
8
|
-
}),
|
|
9
|
-
emailAndPassword: {
|
|
10
|
-
enabled: true,
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export type Session = typeof auth.$Infer.Session;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "better-auth-react",
|
|
3
|
-
"displayName": "Better Auth (React)",
|
|
4
|
-
"description": "Client-side authentication with Better Auth for React",
|
|
5
|
-
"frameworks": ["react", "react-vite"],
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"better-auth": "^1.0.0"
|
|
8
|
-
},
|
|
9
|
-
"envVars": {
|
|
10
|
-
"VITE_AUTH_URL": {
|
|
11
|
-
"value": "http://localhost:3000",
|
|
12
|
-
"description": "Base URL of your auth server (optional if same domain)"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createAuthClient } from 'better-auth/react';
|
|
2
|
-
|
|
3
|
-
export const authClient = createAuthClient({
|
|
4
|
-
/** The base URL of the server (optional if you're using the same domain) */
|
|
5
|
-
baseURL: import.meta.env.VITE_AUTH_URL || 'http://localhost:3000',
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
// Export specific methods for convenience
|
|
9
|
-
export const { signIn, signUp, signOut, useSession } = authClient;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createAuthClient } from 'better-auth/react';
|
|
2
|
-
|
|
3
|
-
export const authClient = createAuthClient({
|
|
4
|
-
/** The base URL of the server (optional if you're using the same domain) */
|
|
5
|
-
baseURL: import.meta.env.VITE_AUTH_URL || 'http://localhost:3000',
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
// Export specific methods for convenience
|
|
9
|
-
export const { signIn, signUp, signOut, useSession } = authClient;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "auth",
|
|
3
|
-
"displayName": "Better Auth (React)",
|
|
4
|
-
"description": "Client-side authentication with Better Auth for React",
|
|
5
|
-
"category": "auth",
|
|
6
|
-
"supportedFrameworks": ["react", "react-vite"],
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"better-auth": "^1.0.0"
|
|
9
|
-
},
|
|
10
|
-
"envVars": [
|
|
11
|
-
{
|
|
12
|
-
"key": "VITE_AUTH_URL",
|
|
13
|
-
"value": "http://localhost:3000",
|
|
14
|
-
"description": "Base URL of your auth server (optional if same domain)",
|
|
15
|
-
"required": false
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"patches": [
|
|
19
|
-
{
|
|
20
|
-
"type": "create-file",
|
|
21
|
-
"description": "Create Better Auth client configuration",
|
|
22
|
-
"source": "lib/auth-client.ts",
|
|
23
|
-
"destination": "src/lib/auth-client.ts"
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "nextauth",
|
|
3
|
-
"displayName": "Auth.js (NextAuth)",
|
|
4
|
-
"auth": "nextauth",
|
|
5
|
-
"compatibleWith": {
|
|
6
|
-
"frameworks": ["nextjs"],
|
|
7
|
-
"databases": ["prisma-postgresql", "prisma-mongodb"]
|
|
8
|
-
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"next-auth": "^5.0.0-beta.25",
|
|
11
|
-
"@auth/prisma-adapter": "^2.7.4"
|
|
12
|
-
},
|
|
13
|
-
"env": {
|
|
14
|
-
"AUTH_SECRET": "your-secret-here",
|
|
15
|
-
"NEXTAUTH_URL": "http://localhost:3000"
|
|
16
|
-
},
|
|
17
|
-
"files": ["app/api/auth/[...nextauth]/route.ts", "lib/auth.ts", "middleware.ts"]
|
|
18
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { prisma } from '@/lib/db';
|
|
2
|
-
import { PrismaAdapter } from '@auth/prisma-adapter';
|
|
3
|
-
import NextAuth from 'next-auth';
|
|
4
|
-
import CredentialsProvider from 'next-auth/providers/credentials';
|
|
5
|
-
|
|
6
|
-
export const { handlers, auth, signIn, signOut } = NextAuth({
|
|
7
|
-
adapter: PrismaAdapter(prisma),
|
|
8
|
-
session: {
|
|
9
|
-
strategy: 'jwt',
|
|
10
|
-
},
|
|
11
|
-
providers: [
|
|
12
|
-
CredentialsProvider({
|
|
13
|
-
name: 'Credentials',
|
|
14
|
-
credentials: {
|
|
15
|
-
email: { label: 'Email', type: 'email' },
|
|
16
|
-
password: { label: 'Password', type: 'password' },
|
|
17
|
-
},
|
|
18
|
-
async authorize(credentials) {
|
|
19
|
-
// Add your authentication logic here
|
|
20
|
-
if (!credentials?.email || !credentials?.password) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
// Replace with your actual user lookup
|
|
24
|
-
return { id: '1', email: credentials.email as string };
|
|
25
|
-
},
|
|
26
|
-
}),
|
|
27
|
-
],
|
|
28
|
-
pages: {
|
|
29
|
-
signIn: '/auth/signin',
|
|
30
|
-
},
|
|
31
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "prisma-mongodb",
|
|
3
|
-
"displayName": "Prisma + MongoDB",
|
|
4
|
-
"database": "prisma-mongodb",
|
|
5
|
-
"compatibleWith": ["nextjs", "express"],
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"@prisma/client": "^6.2.0"
|
|
8
|
-
},
|
|
9
|
-
"devDependencies": {
|
|
10
|
-
"prisma": "^6.2.0"
|
|
11
|
-
},
|
|
12
|
-
"scripts": {
|
|
13
|
-
"db:generate": "prisma generate",
|
|
14
|
-
"db:push": "prisma db push",
|
|
15
|
-
"db:studio": "prisma studio"
|
|
16
|
-
},
|
|
17
|
-
"env": {
|
|
18
|
-
"DATABASE_URL": "mongodb://localhost:27017/mydb"
|
|
19
|
-
},
|
|
20
|
-
"files": ["prisma/schema.prisma", "lib/db.ts"]
|
|
21
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { PrismaClient } from '@prisma/client';
|
|
2
|
-
|
|
3
|
-
const globalForPrisma = globalThis as unknown as {
|
|
4
|
-
prisma: PrismaClient | undefined;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const prisma =
|
|
8
|
-
globalForPrisma.prisma ??
|
|
9
|
-
new PrismaClient({
|
|
10
|
-
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
generator client {
|
|
2
|
-
provider = "prisma-client-js"
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
datasource db {
|
|
6
|
-
provider = "mongodb"
|
|
7
|
-
url = env("DATABASE_URL")
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
model User {
|
|
11
|
-
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
12
|
-
email String @unique
|
|
13
|
-
name String?
|
|
14
|
-
createdAt DateTime @default(now())
|
|
15
|
-
updatedAt DateTime @updatedAt
|
|
16
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "prisma-postgresql",
|
|
3
|
-
"displayName": "Prisma + PostgreSQL",
|
|
4
|
-
"database": "prisma-postgresql",
|
|
5
|
-
"compatibleWith": ["nextjs", "express"],
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"@prisma/client": "^6.2.0"
|
|
8
|
-
},
|
|
9
|
-
"devDependencies": {
|
|
10
|
-
"prisma": "^6.2.0"
|
|
11
|
-
},
|
|
12
|
-
"scripts": {
|
|
13
|
-
"db:generate": "prisma generate",
|
|
14
|
-
"db:push": "prisma db push",
|
|
15
|
-
"db:migrate": "prisma migrate dev",
|
|
16
|
-
"db:studio": "prisma studio"
|
|
17
|
-
},
|
|
18
|
-
"env": {
|
|
19
|
-
"DATABASE_URL": "postgresql://user:password@localhost:5432/mydb"
|
|
20
|
-
},
|
|
21
|
-
"files": ["prisma/schema.prisma", "lib/db.ts"]
|
|
22
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { PrismaClient } from '@prisma/client';
|
|
2
|
-
|
|
3
|
-
const globalForPrisma = globalThis as unknown as {
|
|
4
|
-
prisma: PrismaClient | undefined;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const prisma =
|
|
8
|
-
globalForPrisma.prisma ??
|
|
9
|
-
new PrismaClient({
|
|
10
|
-
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
generator client {
|
|
2
|
-
provider = "prisma-client-js"
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
datasource db {
|
|
6
|
-
provider = "postgresql"
|
|
7
|
-
url = env("DATABASE_URL")
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
model User {
|
|
11
|
-
id String @id @default(cuid())
|
|
12
|
-
email String @unique
|
|
13
|
-
name String?
|
|
14
|
-
createdAt DateTime @default(now())
|
|
15
|
-
updatedAt DateTime @updatedAt
|
|
16
|
-
}
|