stackkit-cli 0.4.3 → 0.4.5
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 +26 -2
- package/bin/stackkit.js +10 -1
- package/dist/commands/add.js +128 -10
- package/dist/commands/doctor.d.ts +11 -0
- package/dist/commands/doctor.js +483 -0
- package/dist/commands/list.d.ts +1 -1
- package/dist/commands/list.js +59 -38
- package/dist/index.js +11 -13
- package/dist/types/index.d.ts +29 -2
- package/dist/utils/config-utils.d.ts +2 -0
- package/dist/utils/config-utils.js +88 -0
- package/dist/utils/detect.js +12 -2
- package/dist/utils/env-editor.d.ts +0 -1
- package/dist/utils/env-editor.js +50 -25
- package/dist/utils/files.d.ts +8 -0
- package/dist/utils/files.js +51 -0
- package/dist/utils/js-conversion.d.ts +1 -0
- package/dist/utils/js-conversion.js +244 -0
- package/dist/utils/module-utils.d.ts +2 -0
- package/dist/utils/module-utils.js +461 -0
- package/dist/utils/package-manager.js +15 -31
- package/modules/auth/authjs/files/api/auth/[...nextauth]/route.ts +6 -0
- package/modules/auth/authjs/files/lib/auth-client.ts +11 -0
- package/modules/auth/authjs/files/lib/auth.ts +41 -0
- package/modules/auth/authjs/files/schemas/prisma-schema.prisma +45 -0
- package/modules/auth/authjs/module.json +95 -0
- package/modules/auth/better-auth/files/lib/auth-client.ts +7 -0
- package/modules/auth/better-auth/files/lib/auth.ts +75 -0
- package/modules/auth/better-auth/files/lib/email-service.ts +34 -0
- package/modules/auth/better-auth/files/lib/email-templates.ts +89 -0
- package/modules/auth/better-auth/files/schemas/prisma-schema.prisma +63 -0
- package/modules/auth/better-auth/module.json +191 -0
- package/modules/database/mongoose/files/lib/db.ts +68 -0
- package/modules/database/mongoose/files/models/User.ts +34 -0
- package/modules/database/mongoose/module.json +55 -0
- package/modules/database/prisma/files/lib/prisma.ts +4 -0
- package/modules/database/prisma/files/prisma/schema.prisma +8 -0
- package/modules/database/prisma/files/prisma.config.ts +12 -0
- package/modules/database/prisma/module.json +122 -0
- package/package.json +1 -1
- package/templates/express/.env.example +1 -10
- package/templates/express/package.json +15 -21
- package/templates/express/src/app.ts +9 -29
- package/templates/express/src/config/env.ts +3 -14
- package/templates/express/src/features/health/health.controller.ts +18 -0
- package/templates/express/src/features/health/health.route.ts +9 -0
- package/templates/express/src/features/health/health.service.ts +6 -0
- package/templates/express/src/middlewares/error.middleware.ts +2 -2
- package/templates/express/src/server.ts +1 -1
- package/templates/express/template.json +1 -5
- package/templates/express/tsconfig.json +0 -1
- package/templates/nextjs/lib/env.ts +8 -0
- package/templates/nextjs/package.json +7 -7
- package/templates/react-vite/.env.example +1 -2
- package/templates/react-vite/.prettierignore +4 -0
- package/templates/react-vite/.prettierrc +9 -0
- package/templates/react-vite/README.md +22 -0
- package/templates/react-vite/package.json +16 -16
- package/templates/react-vite/src/router.tsx +0 -12
- package/templates/react-vite/vite.config.ts +0 -6
- package/dist/commands/init.d.ts +0 -10
- package/dist/commands/init.js +0 -157
- package/dist/utils/code-inject.d.ts +0 -14
- package/dist/utils/code-inject.js +0 -70
- package/dist/utils/json-editor.d.ts +0 -8
- package/dist/utils/json-editor.js +0 -45
- package/modules/auth/better-auth-express/adapters/mongoose-mongodb.ts +0 -13
- package/modules/auth/better-auth-express/adapters/prisma-mongodb.ts +0 -15
- package/modules/auth/better-auth-express/adapters/prisma-postgresql.ts +0 -15
- package/modules/auth/better-auth-express/files/lib/auth.ts +0 -16
- package/modules/auth/better-auth-express/files/routes/auth.ts +0 -12
- package/modules/auth/better-auth-express/files/schemas/prisma-mongodb-schema.prisma +0 -72
- package/modules/auth/better-auth-express/files/schemas/prisma-postgresql-schema.prisma +0 -72
- package/modules/auth/better-auth-express/module.json +0 -61
- package/modules/auth/better-auth-nextjs/adapters/mongoose-mongodb.ts +0 -24
- package/modules/auth/better-auth-nextjs/adapters/prisma-mongodb.ts +0 -26
- package/modules/auth/better-auth-nextjs/adapters/prisma-postgresql.ts +0 -26
- package/modules/auth/better-auth-nextjs/files/lib/auth.ts +0 -26
- package/modules/auth/better-auth-nextjs/files/schemas/prisma-mongodb-schema.prisma +0 -72
- package/modules/auth/better-auth-nextjs/files/schemas/prisma-postgresql-schema.prisma +0 -72
- package/modules/auth/better-auth-nextjs/module.json +0 -62
- package/modules/auth/better-auth-react/files/lib/auth-client.ts +0 -9
- package/modules/auth/better-auth-react/module.json +0 -28
- package/modules/auth/clerk-express/files/lib/auth.ts +0 -7
- package/modules/auth/clerk-express/module.json +0 -34
- package/modules/auth/clerk-nextjs/files/lib/auth-provider.tsx +0 -5
- package/modules/auth/clerk-nextjs/files/middleware.ts +0 -9
- package/modules/auth/clerk-nextjs/module.json +0 -64
- package/modules/auth/clerk-react/files/lib/auth-provider.tsx +0 -15
- package/modules/auth/clerk-react/module.json +0 -28
- package/modules/database/mongoose-mongodb/files/lib/db.ts +0 -40
- package/modules/database/mongoose-mongodb/module.json +0 -55
- package/modules/database/prisma-mongodb/files/lib/db.ts +0 -9
- package/modules/database/prisma-mongodb/files/prisma/schema.prisma +0 -17
- package/modules/database/prisma-mongodb/module.json +0 -60
- package/modules/database/prisma-postgresql/files/lib/db.ts +0 -9
- package/modules/database/prisma-postgresql/files/prisma/schema.prisma +0 -17
- package/modules/database/prisma-postgresql/module.json +0 -60
- package/templates/react-vite/src/api/services/user.service.ts +0 -18
- package/templates/react-vite/src/pages/UserProfile.tsx +0 -40
- package/templates/react-vite/src/types/user.d.ts +0 -6
- /package/modules/auth/{better-auth-nextjs → better-auth}/files/api/auth/[...all]/route.ts +0 -0
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { prisma } from "@/lib/db";
|
|
2
|
-
import { prismaAdapter } from "@better-auth/prisma";
|
|
3
|
-
import { betterAuth } from "better-auth";
|
|
4
|
-
|
|
5
|
-
export const auth = betterAuth({
|
|
6
|
-
database: prismaAdapter(prisma, {
|
|
7
|
-
provider: "postgresql",
|
|
8
|
-
}),
|
|
9
|
-
emailAndPassword: {
|
|
10
|
-
enabled: true,
|
|
11
|
-
},
|
|
12
|
-
socialProviders: {
|
|
13
|
-
// Uncomment to add OAuth providers
|
|
14
|
-
// google: {
|
|
15
|
-
// clientId: process.env.GOOGLE_CLIENT_ID!,
|
|
16
|
-
// clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
|
|
17
|
-
// },
|
|
18
|
-
// github: {
|
|
19
|
-
// clientId: process.env.GITHUB_CLIENT_ID!,
|
|
20
|
-
// clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
21
|
-
// },
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export type Session = typeof auth.$Infer.Session;
|
|
26
|
-
export type User = typeof auth.$Infer.User;
|
|
@@ -1,26 +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", // Change to 'mongodb' if using MongoDB
|
|
8
|
-
}),
|
|
9
|
-
emailAndPassword: {
|
|
10
|
-
enabled: true,
|
|
11
|
-
},
|
|
12
|
-
socialProviders: {
|
|
13
|
-
// Uncomment to add OAuth providers
|
|
14
|
-
// google: {
|
|
15
|
-
// clientId: process.env.GOOGLE_CLIENT_ID!,
|
|
16
|
-
// clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
|
|
17
|
-
// },
|
|
18
|
-
// github: {
|
|
19
|
-
// clientId: process.env.GITHUB_CLIENT_ID!,
|
|
20
|
-
// clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
21
|
-
// },
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export type Session = typeof auth.$Infer.Session;
|
|
26
|
-
export type User = typeof auth.$Infer.User;
|
|
@@ -1,72 +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
|
-
// Better Auth models for MongoDB
|
|
11
|
-
model User {
|
|
12
|
-
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
13
|
-
name String
|
|
14
|
-
email String
|
|
15
|
-
emailVerified Boolean @default(false)
|
|
16
|
-
image String?
|
|
17
|
-
createdAt DateTime @default(now())
|
|
18
|
-
updatedAt DateTime @updatedAt
|
|
19
|
-
sessions Session[]
|
|
20
|
-
accounts Account[]
|
|
21
|
-
role String @default("USER")
|
|
22
|
-
|
|
23
|
-
@@unique([email])
|
|
24
|
-
@@map("user")
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
model Session {
|
|
28
|
-
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
29
|
-
expiresAt DateTime
|
|
30
|
-
token String @unique
|
|
31
|
-
createdAt DateTime @default(now())
|
|
32
|
-
updatedAt DateTime @updatedAt
|
|
33
|
-
ipAddress String?
|
|
34
|
-
userAgent String?
|
|
35
|
-
userId String @db.ObjectId
|
|
36
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
37
|
-
|
|
38
|
-
@@index([userId])
|
|
39
|
-
@@map("session")
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
model Account {
|
|
43
|
-
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
44
|
-
accountId String
|
|
45
|
-
providerId String
|
|
46
|
-
userId String @db.ObjectId
|
|
47
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
48
|
-
accessToken String?
|
|
49
|
-
refreshToken String?
|
|
50
|
-
idToken String?
|
|
51
|
-
accessTokenExpiresAt DateTime?
|
|
52
|
-
refreshTokenExpiresAt DateTime?
|
|
53
|
-
scope String?
|
|
54
|
-
password String?
|
|
55
|
-
createdAt DateTime @default(now())
|
|
56
|
-
updatedAt DateTime @updatedAt
|
|
57
|
-
|
|
58
|
-
@@index([userId])
|
|
59
|
-
@@map("account")
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
model Verification {
|
|
63
|
-
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
64
|
-
identifier String
|
|
65
|
-
value String
|
|
66
|
-
expiresAt DateTime
|
|
67
|
-
createdAt DateTime @default(now())
|
|
68
|
-
updatedAt DateTime @updatedAt
|
|
69
|
-
|
|
70
|
-
@@index([identifier])
|
|
71
|
-
@@map("verification")
|
|
72
|
-
}
|
|
@@ -1,72 +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
|
-
// Better Auth models for PostgreSQL
|
|
11
|
-
model User {
|
|
12
|
-
id String @id @default(cuid())
|
|
13
|
-
name String
|
|
14
|
-
email String
|
|
15
|
-
emailVerified Boolean @default(false)
|
|
16
|
-
image String?
|
|
17
|
-
createdAt DateTime @default(now())
|
|
18
|
-
updatedAt DateTime @updatedAt
|
|
19
|
-
sessions Session[]
|
|
20
|
-
accounts Account[]
|
|
21
|
-
role String @default("USER")
|
|
22
|
-
|
|
23
|
-
@@unique([email])
|
|
24
|
-
@@map("user")
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
model Session {
|
|
28
|
-
id String @id @default(cuid())
|
|
29
|
-
expiresAt DateTime
|
|
30
|
-
token String @unique
|
|
31
|
-
createdAt DateTime @default(now())
|
|
32
|
-
updatedAt DateTime @updatedAt
|
|
33
|
-
ipAddress String?
|
|
34
|
-
userAgent String?
|
|
35
|
-
userId String
|
|
36
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
37
|
-
|
|
38
|
-
@@index([userId])
|
|
39
|
-
@@map("session")
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
model Account {
|
|
43
|
-
id String @id @default(cuid())
|
|
44
|
-
accountId String
|
|
45
|
-
providerId String
|
|
46
|
-
userId String
|
|
47
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
48
|
-
accessToken String?
|
|
49
|
-
refreshToken String?
|
|
50
|
-
idToken String?
|
|
51
|
-
accessTokenExpiresAt DateTime?
|
|
52
|
-
refreshTokenExpiresAt DateTime?
|
|
53
|
-
scope String?
|
|
54
|
-
password String?
|
|
55
|
-
createdAt DateTime @default(now())
|
|
56
|
-
updatedAt DateTime @updatedAt
|
|
57
|
-
|
|
58
|
-
@@index([userId])
|
|
59
|
-
@@map("account")
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
model Verification {
|
|
63
|
-
id String @id @default(cuid())
|
|
64
|
-
identifier String
|
|
65
|
-
value String
|
|
66
|
-
expiresAt DateTime
|
|
67
|
-
createdAt DateTime @default(now())
|
|
68
|
-
updatedAt DateTime @updatedAt
|
|
69
|
-
|
|
70
|
-
@@index([identifier])
|
|
71
|
-
@@map("verification")
|
|
72
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "better-auth-nextjs",
|
|
3
|
-
"displayName": "Better Auth (Next.js)",
|
|
4
|
-
"description": "Modern authentication with Better Auth for Next.js App Router",
|
|
5
|
-
"category": "auth",
|
|
6
|
-
"provider": "better-auth",
|
|
7
|
-
"supportedFrameworks": ["nextjs"],
|
|
8
|
-
"databaseAdapters": {
|
|
9
|
-
"prisma-postgresql": {
|
|
10
|
-
"adapter": "adapters/prisma-postgresql.ts",
|
|
11
|
-
"schema": "files/schemas/prisma-postgresql-schema.prisma",
|
|
12
|
-
"schemaDestination": "prisma/schema.prisma",
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"better-auth": "^1.1.4",
|
|
15
|
-
"@better-auth/prisma": "^1.1.4"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"prisma-mongodb": {
|
|
19
|
-
"adapter": "adapters/prisma-mongodb.ts",
|
|
20
|
-
"schema": "files/schemas/prisma-mongodb-schema.prisma",
|
|
21
|
-
"schemaDestination": "prisma/schema.prisma",
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"better-auth": "^1.1.4",
|
|
24
|
-
"@better-auth/prisma": "^1.1.4"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"mongoose-mongodb": {
|
|
28
|
-
"adapter": "adapters/mongoose-mongodb.ts",
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"better-auth": "^1.1.4"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"envVars": [
|
|
35
|
-
{
|
|
36
|
-
"key": "BETTER_AUTH_SECRET",
|
|
37
|
-
"value": "",
|
|
38
|
-
"description": "Secret key for Better Auth. Generate with: openssl rand -base64 32",
|
|
39
|
-
"required": true
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"key": "BETTER_AUTH_URL",
|
|
43
|
-
"value": "http://localhost:3000",
|
|
44
|
-
"description": "Base URL of your application (change in production)",
|
|
45
|
-
"required": true
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
"patches": [
|
|
49
|
-
{
|
|
50
|
-
"type": "create-file",
|
|
51
|
-
"description": "Create Better Auth configuration",
|
|
52
|
-
"source": "lib/auth.ts",
|
|
53
|
-
"destination": "{{lib}}/auth.ts"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"type": "create-file",
|
|
57
|
-
"description": "Create Better Auth API route handler",
|
|
58
|
-
"source": "app/api/auth/[...all]/route.ts",
|
|
59
|
-
"destination": "{{router}}/api/auth/[...all]/route.ts"
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
}
|
|
@@ -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,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "better-auth-react",
|
|
3
|
-
"displayName": "Better Auth (React)",
|
|
4
|
-
"description": "Client-side authentication with Better Auth for React",
|
|
5
|
-
"category": "auth",
|
|
6
|
-
"provider": "better-auth",
|
|
7
|
-
"supportedFrameworks": ["react-vite"],
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"better-auth": "^1.1.4"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {},
|
|
12
|
-
"envVars": [
|
|
13
|
-
{
|
|
14
|
-
"key": "VITE_AUTH_URL",
|
|
15
|
-
"value": "http://localhost:3000",
|
|
16
|
-
"description": "Base URL of your auth server",
|
|
17
|
-
"required": true
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
"patches": [
|
|
21
|
-
{
|
|
22
|
-
"type": "create-file",
|
|
23
|
-
"description": "Create Better Auth client configuration",
|
|
24
|
-
"source": "lib/auth-client.ts",
|
|
25
|
-
"destination": "src/lib/auth-client.ts"
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "clerk-express",
|
|
3
|
-
"displayName": "Clerk (Express)",
|
|
4
|
-
"description": "Clerk Authentication for Express.js",
|
|
5
|
-
"category": "auth",
|
|
6
|
-
"provider": "clerk",
|
|
7
|
-
"supportedFrameworks": ["express"],
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"@clerk/express": "^1.4.5"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {},
|
|
12
|
-
"envVars": [
|
|
13
|
-
{
|
|
14
|
-
"key": "CLERK_PUBLISHABLE_KEY",
|
|
15
|
-
"value": "",
|
|
16
|
-
"description": "Clerk publishable key (from Clerk dashboard)",
|
|
17
|
-
"required": true
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"key": "CLERK_SECRET_KEY",
|
|
21
|
-
"value": "",
|
|
22
|
-
"description": "Clerk secret key (from Clerk dashboard)",
|
|
23
|
-
"required": true
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
"patches": [
|
|
27
|
-
{
|
|
28
|
-
"type": "create-file",
|
|
29
|
-
"description": "Create Clerk auth middleware",
|
|
30
|
-
"source": "lib/auth.ts",
|
|
31
|
-
"destination": "{{lib}}/auth.ts"
|
|
32
|
-
}
|
|
33
|
-
]
|
|
34
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "clerk-nextjs",
|
|
3
|
-
"displayName": "Clerk (Next.js)",
|
|
4
|
-
"description": "Clerk Authentication for Next.js App Router",
|
|
5
|
-
"category": "auth",
|
|
6
|
-
"provider": "clerk",
|
|
7
|
-
"supportedFrameworks": ["nextjs"],
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"@clerk/nextjs": "^6.10.2"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {},
|
|
12
|
-
"envVars": [
|
|
13
|
-
{
|
|
14
|
-
"key": "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY",
|
|
15
|
-
"value": "",
|
|
16
|
-
"description": "Clerk publishable key (from Clerk dashboard)",
|
|
17
|
-
"required": true
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"key": "CLERK_SECRET_KEY",
|
|
21
|
-
"value": "",
|
|
22
|
-
"description": "Clerk secret key (from Clerk dashboard)",
|
|
23
|
-
"required": true
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"key": "NEXT_PUBLIC_CLERK_SIGN_IN_URL",
|
|
27
|
-
"value": "/sign-in",
|
|
28
|
-
"description": "Sign in page URL",
|
|
29
|
-
"required": true
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"key": "NEXT_PUBLIC_CLERK_SIGN_UP_URL",
|
|
33
|
-
"value": "/sign-up",
|
|
34
|
-
"description": "Sign up page URL",
|
|
35
|
-
"required": true
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"key": "NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL",
|
|
39
|
-
"value": "/",
|
|
40
|
-
"description": "Redirect URL after sign in",
|
|
41
|
-
"required": true
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"key": "NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL",
|
|
45
|
-
"value": "/",
|
|
46
|
-
"description": "Redirect URL after sign up",
|
|
47
|
-
"required": true
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
"patches": [
|
|
51
|
-
{
|
|
52
|
-
"type": "create-file",
|
|
53
|
-
"description": "Create Clerk auth provider",
|
|
54
|
-
"source": "lib/auth-provider.tsx",
|
|
55
|
-
"destination": "{{lib}}/auth-provider.tsx"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"type": "create-file",
|
|
59
|
-
"description": "Create Clerk middleware",
|
|
60
|
-
"source": "middleware.ts",
|
|
61
|
-
"destination": "middleware.ts"
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ClerkProvider } from "@clerk/clerk-react";
|
|
2
|
-
|
|
3
|
-
const publishableKey = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY;
|
|
4
|
-
|
|
5
|
-
if (!publishableKey) {
|
|
6
|
-
throw new Error("Missing Publishable Key");
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function AuthProvider({ children }: { children: React.ReactNode }) {
|
|
10
|
-
return (
|
|
11
|
-
<ClerkProvider publishableKey={publishableKey} afterSignOutUrl="/">
|
|
12
|
-
{children}
|
|
13
|
-
</ClerkProvider>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "clerk-react",
|
|
3
|
-
"displayName": "Clerk (React)",
|
|
4
|
-
"description": "Clerk Authentication for React",
|
|
5
|
-
"category": "auth",
|
|
6
|
-
"provider": "clerk",
|
|
7
|
-
"supportedFrameworks": ["react-vite"],
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"@clerk/clerk-react": "^5.19.2"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {},
|
|
12
|
-
"envVars": [
|
|
13
|
-
{
|
|
14
|
-
"key": "VITE_CLERK_PUBLISHABLE_KEY",
|
|
15
|
-
"value": "",
|
|
16
|
-
"description": "Clerk publishable key (from Clerk dashboard)",
|
|
17
|
-
"required": true
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
"patches": [
|
|
21
|
-
{
|
|
22
|
-
"type": "create-file",
|
|
23
|
-
"description": "Create Clerk auth provider",
|
|
24
|
-
"source": "lib/auth-provider.tsx",
|
|
25
|
-
"destination": "src/lib/auth-provider.tsx"
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import mongoose from "mongoose";
|
|
2
|
-
|
|
3
|
-
const MONGODB_URI = process.env.MONGODB_URI || "mongodb://localhost:27017/myapp";
|
|
4
|
-
|
|
5
|
-
if (!MONGODB_URI) {
|
|
6
|
-
throw new Error("Please define the MONGODB_URI environment variable");
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
let cached = global.mongoose;
|
|
10
|
-
|
|
11
|
-
if (!cached) {
|
|
12
|
-
cached = global.mongoose = { conn: null, promise: null };
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async function connectDB() {
|
|
16
|
-
if (cached.conn) {
|
|
17
|
-
return cached.conn;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (!cached.promise) {
|
|
21
|
-
const opts = {
|
|
22
|
-
bufferCommands: false,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
cached.promise = mongoose.connect(MONGODB_URI, opts).then((mongoose) => {
|
|
26
|
-
return mongoose;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
cached.conn = await cached.promise;
|
|
32
|
-
} catch (e) {
|
|
33
|
-
cached.promise = null;
|
|
34
|
-
throw e;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return cached.conn;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default connectDB;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mongoose-mongodb",
|
|
3
|
-
"displayName": "Mongoose + MongoDB",
|
|
4
|
-
"description": "Mongoose ODM for MongoDB database",
|
|
5
|
-
"category": "database",
|
|
6
|
-
"provider": "mongoose",
|
|
7
|
-
"database": "mongodb",
|
|
8
|
-
"supportedFrameworks": ["nextjs", "express"],
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"mongoose": "^8.8.4"
|
|
11
|
-
},
|
|
12
|
-
"devDependencies": {},
|
|
13
|
-
"envVars": [
|
|
14
|
-
{
|
|
15
|
-
"key": "MONGODB_URI",
|
|
16
|
-
"value": "mongodb://localhost:27017/myapp",
|
|
17
|
-
"description": "MongoDB connection string",
|
|
18
|
-
"required": true
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"frameworkPatches": {
|
|
22
|
-
"express": {
|
|
23
|
-
"tsconfig.json": {
|
|
24
|
-
"merge": {
|
|
25
|
-
"compilerOptions": {
|
|
26
|
-
"paths": {
|
|
27
|
-
"@/*": ["./src/*"],
|
|
28
|
-
"@/models/*": ["./src/models/*"]
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"include": ["src/**/*", "src/models/**/*"]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"nextjs": {
|
|
36
|
-
"tsconfig.json": {
|
|
37
|
-
"merge": {
|
|
38
|
-
"compilerOptions": {
|
|
39
|
-
"paths": {
|
|
40
|
-
"@/models/*": ["./models/*"]
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"patches": [
|
|
48
|
-
{
|
|
49
|
-
"type": "create-file",
|
|
50
|
-
"description": "Create MongoDB connection with Mongoose",
|
|
51
|
-
"source": "lib/db.ts",
|
|
52
|
-
"destination": "{{lib}}/db.ts"
|
|
53
|
-
}
|
|
54
|
-
]
|
|
55
|
-
}
|
|
@@ -1,9 +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 db = globalForPrisma.prisma ?? new PrismaClient();
|
|
8
|
-
|
|
9
|
-
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = db;
|
|
@@ -1,17 +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
|
-
// Example model - customize based on your auth provider
|
|
11
|
-
model User {
|
|
12
|
-
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
13
|
-
email String @unique
|
|
14
|
-
name String?
|
|
15
|
-
createdAt DateTime @default(now())
|
|
16
|
-
updatedAt DateTime @updatedAt
|
|
17
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "prisma-mongodb",
|
|
3
|
-
"displayName": "Prisma + MongoDB",
|
|
4
|
-
"description": "Prisma ORM with MongoDB database",
|
|
5
|
-
"category": "database",
|
|
6
|
-
"provider": "prisma",
|
|
7
|
-
"database": "mongodb",
|
|
8
|
-
"supportedFrameworks": ["nextjs", "express"],
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"@prisma/client": "^6.1.0"
|
|
11
|
-
},
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"prisma": "^6.1.0"
|
|
14
|
-
},
|
|
15
|
-
"envVars": [
|
|
16
|
-
{
|
|
17
|
-
"key": "DATABASE_URL",
|
|
18
|
-
"value": "mongodb://localhost:27017/mydb",
|
|
19
|
-
"description": "MongoDB connection URL",
|
|
20
|
-
"required": true
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
"frameworkPatches": {
|
|
24
|
-
"express": {
|
|
25
|
-
"tsconfig.json": {
|
|
26
|
-
"merge": {
|
|
27
|
-
"compilerOptions": {
|
|
28
|
-
"paths": {
|
|
29
|
-
"@/*": ["./src/*"]
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"include": ["src/**/*"],
|
|
33
|
-
"exclude": ["node_modules", "dist", "prisma/migrations"]
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"nextjs": {
|
|
38
|
-
"tsconfig.json": {
|
|
39
|
-
"merge": {
|
|
40
|
-
"exclude": ["node_modules", ".next", "out", "prisma/migrations"]
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"patches": [
|
|
46
|
-
{
|
|
47
|
-
"type": "create-file",
|
|
48
|
-
"description": "Create Prisma schema for MongoDB",
|
|
49
|
-
"source": "files/prisma/schema.prisma",
|
|
50
|
-
"destination": "prisma/schema.prisma"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"type": "create-file",
|
|
54
|
-
"description": "Create Prisma client singleton",
|
|
55
|
-
"source": "files/lib/db.ts",
|
|
56
|
-
"destination": "{{lib}}/db.ts"
|
|
57
|
-
}
|
|
58
|
-
],
|
|
59
|
-
"postInstall": ["npx prisma generate"]
|
|
60
|
-
}
|
|
@@ -1,9 +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 db = globalForPrisma.prisma ?? new PrismaClient();
|
|
8
|
-
|
|
9
|
-
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = db;
|