stackkit-cli 0.4.2 → 0.4.4

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 (137) hide show
  1. package/README.md +17 -10
  2. package/bin/stackkit.js +10 -1
  3. package/dist/commands/add.js +164 -25
  4. package/dist/commands/init.d.ts +1 -1
  5. package/dist/commands/init.js +34 -29
  6. package/dist/commands/list.js +12 -12
  7. package/dist/index.js +25 -23
  8. package/dist/types/index.d.ts +28 -16
  9. package/dist/utils/code-inject.d.ts +1 -1
  10. package/dist/utils/code-inject.js +6 -6
  11. package/dist/utils/detect.d.ts +1 -1
  12. package/dist/utils/detect.js +48 -44
  13. package/dist/utils/env-editor.js +20 -20
  14. package/dist/utils/files.js +4 -4
  15. package/dist/utils/json-editor.d.ts +3 -3
  16. package/dist/utils/json-editor.js +10 -14
  17. package/dist/utils/logger.d.ts +1 -1
  18. package/dist/utils/logger.js +8 -8
  19. package/dist/utils/package-manager.d.ts +2 -2
  20. package/dist/utils/package-manager.js +33 -26
  21. package/modules/auth/better-auth/files/api/auth/[...all]/route.ts +4 -0
  22. package/modules/auth/better-auth/files/lib/auth.ts +13 -0
  23. package/modules/auth/better-auth/files/schemas/prisma-schema.prisma +63 -0
  24. package/modules/auth/better-auth/module.json +54 -0
  25. package/modules/auth/{clerk-express/files/lib → clerk/files/express}/auth.ts +1 -1
  26. package/modules/auth/{clerk-nextjs/files/lib → clerk/files/nextjs}/auth-provider.tsx +1 -1
  27. package/modules/auth/clerk/files/nextjs/middleware.ts +9 -0
  28. package/modules/auth/{clerk-react/files/lib → clerk/files/react}/auth-provider.tsx +2 -2
  29. package/modules/auth/clerk/module.json +115 -0
  30. package/modules/database/mongoose-mongodb/files/lib/db.ts +45 -7
  31. package/modules/database/mongoose-mongodb/files/models/User.ts +39 -0
  32. package/modules/database/mongoose-mongodb/module.json +59 -7
  33. package/modules/database/prisma/files/lib/prisma.ts +6 -0
  34. package/modules/database/prisma/files/prisma/schema.prisma +8 -0
  35. package/modules/database/prisma/files/prisma.config.ts +12 -0
  36. package/modules/database/prisma/module.json +140 -0
  37. package/package.json +1 -1
  38. package/templates/express/.env.example +3 -0
  39. package/templates/express/eslint.config.cjs +42 -0
  40. package/templates/express/package.json +33 -0
  41. package/templates/express/src/app.ts +51 -0
  42. package/templates/express/src/config/env.ts +12 -0
  43. package/templates/express/src/features/auth/auth.controller.ts +48 -0
  44. package/templates/express/src/features/auth/auth.route.ts +10 -0
  45. package/templates/express/src/features/auth/auth.service.ts +21 -0
  46. package/templates/express/src/middlewares/error.middleware.ts +18 -0
  47. package/templates/{bases/express-base → express}/src/server.ts +3 -3
  48. package/templates/express/template.json +40 -0
  49. package/templates/express/tsconfig.json +30 -0
  50. package/templates/{bases/nextjs-base → nextjs}/app/layout.tsx +1 -5
  51. package/templates/nextjs/app/page.tsx +57 -0
  52. package/templates/{bases/nextjs-base → nextjs}/package.json +2 -1
  53. package/templates/{bases/nextjs-base → nextjs}/template.json +13 -1
  54. package/templates/react-vite/.env.example +2 -0
  55. package/templates/react-vite/README.md +85 -0
  56. package/templates/react-vite/eslint.config.js +23 -0
  57. package/templates/{bases/react-vite-base → react-vite}/index.html +1 -0
  58. package/templates/{bases/react-vite-base → react-vite}/package.json +16 -2
  59. package/templates/react-vite/src/api/client.ts +47 -0
  60. package/templates/react-vite/src/api/services/user.service.ts +18 -0
  61. package/templates/react-vite/src/components/ErrorBoundary.tsx +51 -0
  62. package/templates/react-vite/src/components/Layout.tsx +13 -0
  63. package/templates/react-vite/src/components/Loading.tsx +8 -0
  64. package/templates/react-vite/src/components/SEO.tsx +49 -0
  65. package/templates/react-vite/src/config/constants.ts +5 -0
  66. package/templates/react-vite/src/hooks/index.ts +64 -0
  67. package/templates/react-vite/src/index.css +1 -0
  68. package/templates/react-vite/src/lib/queryClient.ts +12 -0
  69. package/templates/react-vite/src/main.tsx +22 -0
  70. package/templates/react-vite/src/pages/About.tsx +78 -0
  71. package/templates/react-vite/src/pages/Home.tsx +49 -0
  72. package/templates/react-vite/src/pages/NotFound.tsx +24 -0
  73. package/templates/react-vite/src/pages/UserProfile.tsx +40 -0
  74. package/templates/react-vite/src/router.tsx +33 -0
  75. package/templates/react-vite/src/types/api.d.ts +20 -0
  76. package/templates/react-vite/src/types/user.d.ts +6 -0
  77. package/templates/react-vite/src/utils/helpers.ts +51 -0
  78. package/templates/react-vite/src/utils/storage.ts +35 -0
  79. package/templates/react-vite/src/vite-env.d.ts +11 -0
  80. package/templates/react-vite/template.json +46 -0
  81. package/templates/react-vite/tsconfig.json +4 -0
  82. package/templates/react-vite/vite.config.ts +13 -0
  83. package/modules/auth/better-auth-express/files/lib/auth.ts +0 -16
  84. package/modules/auth/better-auth-express/files/routes/auth.ts +0 -12
  85. package/modules/auth/better-auth-express/module.json +0 -38
  86. package/modules/auth/better-auth-nextjs/files/api/auth/[...all]/route.ts +0 -5
  87. package/modules/auth/better-auth-nextjs/files/lib/auth.ts +0 -26
  88. package/modules/auth/better-auth-nextjs/module.json +0 -41
  89. package/modules/auth/better-auth-react/files/lib/auth-client.ts +0 -9
  90. package/modules/auth/better-auth-react/module.json +0 -26
  91. package/modules/auth/clerk-express/module.json +0 -20
  92. package/modules/auth/clerk-nextjs/files/middleware.ts +0 -9
  93. package/modules/auth/clerk-nextjs/module.json +0 -28
  94. package/modules/auth/clerk-react/module.json +0 -19
  95. package/modules/database/drizzle-postgresql/files/drizzle.config.ts +0 -10
  96. package/modules/database/drizzle-postgresql/files/lib/db.ts +0 -7
  97. package/modules/database/drizzle-postgresql/files/lib/schema.ts +0 -8
  98. package/modules/database/drizzle-postgresql/module.json +0 -35
  99. package/modules/database/prisma-mongodb/files/lib/db.ts +0 -9
  100. package/modules/database/prisma-mongodb/files/prisma/schema.prisma +0 -17
  101. package/modules/database/prisma-mongodb/module.json +0 -36
  102. package/modules/database/prisma-postgresql/files/lib/db.ts +0 -9
  103. package/modules/database/prisma-postgresql/files/prisma/schema.prisma +0 -17
  104. package/modules/database/prisma-postgresql/module.json +0 -36
  105. package/templates/bases/express-base/.env.example +0 -2
  106. package/templates/bases/express-base/package.json +0 -23
  107. package/templates/bases/express-base/src/app.ts +0 -34
  108. package/templates/bases/express-base/src/config/env.ts +0 -14
  109. package/templates/bases/express-base/src/middlewares/error.middleware.ts +0 -12
  110. package/templates/bases/express-base/template.json +0 -7
  111. package/templates/bases/express-base/tsconfig.json +0 -14
  112. package/templates/bases/nextjs-base/app/page.tsx +0 -65
  113. package/templates/bases/react-vite-base/README.md +0 -73
  114. package/templates/bases/react-vite-base/eslint.config.js +0 -23
  115. package/templates/bases/react-vite-base/src/App.css +0 -42
  116. package/templates/bases/react-vite-base/src/App.tsx +0 -35
  117. package/templates/bases/react-vite-base/src/index.css +0 -68
  118. package/templates/bases/react-vite-base/src/main.tsx +0 -10
  119. package/templates/bases/react-vite-base/template.json +0 -19
  120. package/templates/bases/react-vite-base/tsconfig.json +0 -7
  121. package/templates/bases/react-vite-base/vite.config.ts +0 -7
  122. /package/templates/{bases/nextjs-base → nextjs}/README.md +0 -0
  123. /package/templates/{bases/nextjs-base → nextjs}/app/favicon.ico +0 -0
  124. /package/templates/{bases/nextjs-base → nextjs}/app/globals.css +0 -0
  125. /package/templates/{bases/nextjs-base → nextjs}/eslint.config.mjs +0 -0
  126. /package/templates/{bases/nextjs-base → nextjs}/next.config.ts +0 -0
  127. /package/templates/{bases/nextjs-base → nextjs}/postcss.config.mjs +0 -0
  128. /package/templates/{bases/nextjs-base → nextjs}/public/file.svg +0 -0
  129. /package/templates/{bases/nextjs-base → nextjs}/public/globe.svg +0 -0
  130. /package/templates/{bases/nextjs-base → nextjs}/public/next.svg +0 -0
  131. /package/templates/{bases/nextjs-base → nextjs}/public/vercel.svg +0 -0
  132. /package/templates/{bases/nextjs-base → nextjs}/public/window.svg +0 -0
  133. /package/templates/{bases/nextjs-base → nextjs}/tsconfig.json +0 -0
  134. /package/templates/{bases/react-vite-base → react-vite}/public/vite.svg +0 -0
  135. /package/templates/{bases/react-vite-base → react-vite}/src/assets/react.svg +0 -0
  136. /package/templates/{bases/react-vite-base → react-vite}/tsconfig.app.json +0 -0
  137. /package/templates/{bases/react-vite-base → react-vite}/tsconfig.node.json +0 -0
@@ -0,0 +1,13 @@
1
+ import { betterAuth } from "better-auth";
2
+
3
+ {{databaseAdapter}}
4
+ emailAndPassword: {
5
+ enabled: true,
6
+ },
7
+ socialProviders: {
8
+ google: {
9
+ clientId: process.env.GOOGLE_CLIENT_ID!,
10
+ clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
11
+ },
12
+ },
13
+ });
@@ -0,0 +1,63 @@
1
+ // Better Auth models
2
+ model User {
3
+ id String @id {{idDefault}}
4
+ name String
5
+ email String
6
+ emailVerified Boolean @default(false)
7
+ image String?
8
+ createdAt DateTime @default(now())
9
+ updatedAt DateTime @updatedAt
10
+ sessions Session[]
11
+ accounts Account[]
12
+ role String @default("USER")
13
+
14
+ @@unique([email])
15
+ @@map("user")
16
+ }
17
+
18
+ model Session {
19
+ id String @id {{idDefault}}
20
+ expiresAt DateTime
21
+ token String @unique
22
+ createdAt DateTime @default(now())
23
+ updatedAt DateTime @updatedAt
24
+ ipAddress String?
25
+ userAgent String?
26
+ userId String {{userIdType}}
27
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
28
+
29
+ @@index([userId])
30
+ @@map("session")
31
+ }
32
+
33
+ model Account {
34
+ id String @id {{idDefault}}
35
+ accountId String
36
+ providerId String
37
+ userId String {{userIdType}}
38
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
39
+ accessToken String?
40
+ refreshToken String?
41
+ idToken String?
42
+ accessTokenExpiresAt DateTime?
43
+ refreshTokenExpiresAt DateTime?
44
+ scope String?
45
+ password String?
46
+ createdAt DateTime @default(now())
47
+ updatedAt DateTime @updatedAt
48
+
49
+ @@index([userId])
50
+ @@map("account")
51
+ }
52
+
53
+ model Verification {
54
+ id String @id {{idDefault}}
55
+ identifier String
56
+ value String
57
+ expiresAt DateTime
58
+ createdAt DateTime @default(now())
59
+ updatedAt DateTime @updatedAt
60
+
61
+ @@index([identifier])
62
+ @@map("verification")
63
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "better-auth",
3
+ "displayName": "Better Auth",
4
+ "description": "Modern authentication with Better Auth",
5
+ "category": "auth",
6
+ "provider": "better-auth",
7
+ "supportedFrameworks": ["nextjs", "express", "react-vite"],
8
+ "databaseAdapters": {
9
+ "prisma-postgresql": {
10
+ "adapterCode": "import { prisma } from \"{{dbImport}}\";\nimport { prismaAdapter } from \"@better-auth/prisma\";\n\nexport const auth = betterAuth({\n database: prismaAdapter(prisma, {\n provider: \"postgresql\",\n }),",
11
+ "schema": "files/schemas/prisma-schema.prisma",
12
+ "schemaDestination": "prisma/schema.prisma",
13
+ "dependencies": {
14
+ "better-auth": "^1.1.4"
15
+ }
16
+ },
17
+ "prisma-mongodb": {
18
+ "adapterCode": "import { prisma } from \"{{dbImport}}\";\nimport { prismaAdapter } from \"@better-auth/prisma\";\n\nexport const auth = betterAuth({\n database: prismaAdapter(prisma, {\n provider: \"mongodb\",\n }),",
19
+ "schema": "files/schemas/prisma-schema.prisma",
20
+ "schemaDestination": "prisma/schema.prisma",
21
+ "dependencies": {
22
+ "better-auth": "^1.1.4"
23
+ }
24
+ },
25
+ "mongoose-mongodb": {
26
+ "adapterCode": "import { client } from \"{{dbImport}}\";\nimport { mongodbAdapter } from \"better-auth/adapters/mongodb\";\n\nexport const auth = betterAuth({\n database: mongodbAdapter(client),",
27
+ "dependencies": {
28
+ "better-auth": "^1.1.4"
29
+ }
30
+ }
31
+ },
32
+ "envVars": [
33
+ {
34
+ "key": "BETTER_AUTH_SECRET",
35
+ "value": "",
36
+ "description": "Secret key for Better Auth. Generate with: openssl rand -base64 32",
37
+ "required": true
38
+ },
39
+ {
40
+ "key": "BETTER_AUTH_URL",
41
+ "value": "http://localhost:3000",
42
+ "description": "Base URL of your application (change in production)",
43
+ "required": true
44
+ }
45
+ ],
46
+ "patches": [
47
+ {
48
+ "type": "create-file",
49
+ "description": "Create Better Auth configuration",
50
+ "source": "files/lib/auth.ts",
51
+ "destination": "{{lib}}/auth.ts"
52
+ }
53
+ ]
54
+ }
@@ -1,4 +1,4 @@
1
- import { clerkClient, clerkMiddleware, requireAuth } from '@clerk/express';
1
+ import { clerkClient, clerkMiddleware, requireAuth } from "@clerk/express";
2
2
 
3
3
  export { clerkMiddleware, requireAuth };
4
4
 
@@ -1,4 +1,4 @@
1
- import { ClerkProvider } from '@clerk/nextjs';
1
+ import { ClerkProvider } from "@clerk/nextjs";
2
2
 
3
3
  export function AuthProvider({ children }: { children: React.ReactNode }) {
4
4
  return <ClerkProvider>{children}</ClerkProvider>;
@@ -0,0 +1,9 @@
1
+ import { authMiddleware } from "@clerk/nextjs";
2
+
3
+ export default authMiddleware({
4
+ publicRoutes: ["/"],
5
+ });
6
+
7
+ export const config = {
8
+ matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
9
+ };
@@ -1,9 +1,9 @@
1
- import { ClerkProvider } from '@clerk/clerk-react';
1
+ import { ClerkProvider } from "@clerk/clerk-react";
2
2
 
3
3
  const publishableKey = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY;
4
4
 
5
5
  if (!publishableKey) {
6
- throw new Error('Missing Publishable Key');
6
+ throw new Error("Missing Publishable Key");
7
7
  }
8
8
 
9
9
  export function AuthProvider({ children }: { children: React.ReactNode }) {
@@ -0,0 +1,115 @@
1
+ {
2
+ "name": "clerk",
3
+ "displayName": "Clerk",
4
+ "description": "Clerk Authentication",
5
+ "category": "auth",
6
+ "provider": "clerk",
7
+ "supportedFrameworks": ["nextjs", "express", "react-vite"],
8
+ "frameworkConfigs": {
9
+ "nextjs": {
10
+ "dependencies": {
11
+ "@clerk/nextjs": "^6.10.2"
12
+ },
13
+ "envVars": [
14
+ {
15
+ "key": "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY",
16
+ "value": "",
17
+ "description": "Clerk publishable key (from Clerk dashboard)",
18
+ "required": true
19
+ },
20
+ {
21
+ "key": "CLERK_SECRET_KEY",
22
+ "value": "",
23
+ "description": "Clerk secret key (from Clerk dashboard)",
24
+ "required": true
25
+ },
26
+ {
27
+ "key": "NEXT_PUBLIC_CLERK_SIGN_IN_URL",
28
+ "value": "/sign-in",
29
+ "description": "Sign in page URL",
30
+ "required": true
31
+ },
32
+ {
33
+ "key": "NEXT_PUBLIC_CLERK_SIGN_UP_URL",
34
+ "value": "/sign-up",
35
+ "description": "Sign up page URL",
36
+ "required": true
37
+ },
38
+ {
39
+ "key": "NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL",
40
+ "value": "/",
41
+ "description": "Redirect URL after sign in",
42
+ "required": true
43
+ },
44
+ {
45
+ "key": "NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL",
46
+ "value": "/",
47
+ "description": "Redirect URL after sign up",
48
+ "required": true
49
+ }
50
+ ],
51
+ "patches": [
52
+ {
53
+ "type": "create-file",
54
+ "description": "Create Clerk auth provider",
55
+ "source": "nextjs/auth-provider.tsx",
56
+ "destination": "{{lib}}/auth-provider.tsx"
57
+ },
58
+ {
59
+ "type": "create-file",
60
+ "description": "Create Clerk middleware",
61
+ "source": "nextjs/middleware.ts",
62
+ "destination": "middleware.ts"
63
+ }
64
+ ]
65
+ },
66
+ "express": {
67
+ "dependencies": {
68
+ "@clerk/express": "^1.3.0"
69
+ },
70
+ "envVars": [
71
+ {
72
+ "key": "CLERK_PUBLISHABLE_KEY",
73
+ "value": "",
74
+ "description": "Clerk publishable key (from Clerk dashboard)",
75
+ "required": true
76
+ },
77
+ {
78
+ "key": "CLERK_SECRET_KEY",
79
+ "value": "",
80
+ "description": "Clerk secret key (from Clerk dashboard)",
81
+ "required": true
82
+ }
83
+ ],
84
+ "patches": [
85
+ {
86
+ "type": "create-file",
87
+ "description": "Create Clerk auth utilities",
88
+ "source": "express/auth.ts",
89
+ "destination": "{{lib}}/auth.ts"
90
+ }
91
+ ]
92
+ },
93
+ "react-vite": {
94
+ "dependencies": {
95
+ "@clerk/clerk-react": "^5.15.0"
96
+ },
97
+ "envVars": [
98
+ {
99
+ "key": "VITE_CLERK_PUBLISHABLE_KEY",
100
+ "value": "",
101
+ "description": "Clerk publishable key (from Clerk dashboard)",
102
+ "required": true
103
+ }
104
+ ],
105
+ "patches": [
106
+ {
107
+ "type": "create-file",
108
+ "description": "Create Clerk auth provider",
109
+ "source": "react/auth-provider.tsx",
110
+ "destination": "{{lib}}/auth-provider.tsx"
111
+ }
112
+ ]
113
+ }
114
+ }
115
+ }
@@ -1,28 +1,45 @@
1
- import mongoose from 'mongoose';
1
+ import "dotenv/config";
2
+ import mongoose from "mongoose";
2
3
 
3
- const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017/myapp';
4
+ const MONGODB_URI = process.env.DATABASE_URL || "mongodb://localhost:27017/myapp";
4
5
 
5
6
  if (!MONGODB_URI) {
6
- throw new Error('Please define the MONGODB_URI environment variable');
7
+ throw new Error("Please define the DATABASE_URL environment variable");
7
8
  }
8
9
 
9
- let cached = global.mongoose;
10
+ interface MongooseCache {
11
+ conn: typeof mongoose | null;
12
+ promise: Promise<typeof mongoose> | null;
13
+ }
14
+
15
+ declare global {
16
+ var mongoose: MongooseCache | undefined;
17
+ }
18
+
19
+ const cached: MongooseCache = global.mongoose || { conn: null, promise: null };
10
20
 
11
- if (!cached) {
12
- cached = global.mongoose = { conn: null, promise: null };
21
+ if (!global.mongoose) {
22
+ global.mongoose = cached;
13
23
  }
14
24
 
15
- async function connectDB() {
25
+ async function connectDB(): Promise<typeof mongoose> {
16
26
  if (cached.conn) {
27
+ console.log("Using existing MongoDB connection");
17
28
  return cached.conn;
18
29
  }
19
30
 
20
31
  if (!cached.promise) {
21
32
  const opts = {
22
33
  bufferCommands: false,
34
+ maxPoolSize: 10, // Maintain up to 10 socket connections
35
+ serverSelectionTimeoutMS: 5000, // Keep trying to send operations for 5 seconds
36
+ socketTimeoutMS: 45000, // Close sockets after 45 seconds of inactivity
37
+ family: 4, // Use IPv4, skip trying IPv6
23
38
  };
24
39
 
40
+ console.log("Creating new MongoDB connection");
25
41
  cached.promise = mongoose.connect(MONGODB_URI, opts).then((mongoose) => {
42
+ console.log("MongoDB connected successfully");
26
43
  return mongoose;
27
44
  });
28
45
  }
@@ -31,10 +48,31 @@ async function connectDB() {
31
48
  cached.conn = await cached.promise;
32
49
  } catch (e) {
33
50
  cached.promise = null;
51
+ console.error("MongoDB connection error:", e);
34
52
  throw e;
35
53
  }
36
54
 
37
55
  return cached.conn;
38
56
  }
39
57
 
58
+ // Handle connection events
59
+ mongoose.connection.on("connected", () => {
60
+ console.log("Mongoose connected to MongoDB");
61
+ });
62
+
63
+ mongoose.connection.on("error", (err) => {
64
+ console.error("Mongoose connection error:", err);
65
+ });
66
+
67
+ mongoose.connection.on("disconnected", () => {
68
+ console.log("Mongoose disconnected");
69
+ });
70
+
71
+ // Close connection on app termination
72
+ process.on("SIGINT", async () => {
73
+ await mongoose.connection.close();
74
+ console.log("MongoDB connection closed due to app termination");
75
+ process.exit(0);
76
+ });
77
+
40
78
  export default connectDB;
@@ -0,0 +1,39 @@
1
+ import mongoose, { Document, Schema } from "mongoose";
2
+
3
+ export interface IUser extends Document {
4
+ name: string;
5
+ email: string;
6
+ password: string;
7
+ createdAt: Date;
8
+ updatedAt: Date;
9
+ }
10
+
11
+ const UserSchema: Schema = new Schema(
12
+ {
13
+ name: {
14
+ type: String,
15
+ required: true,
16
+ trim: true,
17
+ },
18
+ email: {
19
+ type: String,
20
+ required: true,
21
+ unique: true,
22
+ lowercase: true,
23
+ trim: true,
24
+ },
25
+ password: {
26
+ type: String,
27
+ required: true,
28
+ },
29
+ },
30
+ {
31
+ timestamps: true,
32
+ },
33
+ );
34
+
35
+ // Add indexes for better performance
36
+ UserSchema.index({ email: 1 });
37
+ UserSchema.index({ createdAt: -1 });
38
+
39
+ export default mongoose.models.User || mongoose.model<IUser>("User", UserSchema);
@@ -1,18 +1,70 @@
1
1
  {
2
2
  "name": "mongoose-mongodb",
3
3
  "displayName": "Mongoose + MongoDB",
4
- "description": "Mongoose ODM for MongoDB",
4
+ "description": "Mongoose ODM for MongoDB database",
5
5
  "category": "database",
6
+ "provider": "mongoose",
7
+ "database": "mongodb",
8
+ "supportedFrameworks": ["nextjs", "express"],
6
9
  "dependencies": {
7
- "mongoose": "^8.8.4"
10
+ "mongoose": "^8.8.4",
11
+ "dotenv": "^17.2.3"
8
12
  },
9
- "env": {
10
- "MONGODB_URI": "mongodb://localhost:27017/myapp"
13
+ "devDependencies": {
14
+ "@types/mongoose": "^5.11.97"
11
15
  },
12
- "files": [
16
+ "envVars": {
17
+ "common": [
18
+ {
19
+ "key": "DATABASE_URL",
20
+ "value": "mongodb://localhost:27017/myapp",
21
+ "description": "MongoDB connection string",
22
+ "required": true
23
+ }
24
+ ]
25
+ },
26
+ "frameworkPatches": {
27
+ "express": {
28
+ "tsconfig.json": {
29
+ "merge": {
30
+ "compilerOptions": {
31
+ "baseUrl": ".",
32
+ "paths": {
33
+ "@/*": ["./src/*"],
34
+ "@/models/*": ["./src/models/*"]
35
+ }
36
+ },
37
+ "include": ["src/**/*", "src/models/**/*"],
38
+ "exclude": ["node_modules", "dist"]
39
+ }
40
+ }
41
+ },
42
+ "nextjs": {
43
+ "tsconfig.json": {
44
+ "merge": {
45
+ "compilerOptions": {
46
+ "baseUrl": ".",
47
+ "paths": {
48
+ "@/models/*": ["./models/*"]
49
+ }
50
+ },
51
+ "exclude": ["node_modules", ".next", "out"]
52
+ }
53
+ }
54
+ }
55
+ },
56
+ "patches": [
57
+ {
58
+ "type": "create-file",
59
+ "description": "Create MongoDB connection with Mongoose",
60
+ "source": "lib/db.ts",
61
+ "destination": "{{lib}}/db.ts"
62
+ },
13
63
  {
14
- "source": "files/lib/db.ts",
15
- "destination": "lib/db.ts"
64
+ "type": "create-file",
65
+ "description": "Create sample User model",
66
+ "source": "models/User.ts",
67
+ "destination": "{{models}}/User.ts"
16
68
  }
17
69
  ]
18
70
  }
@@ -0,0 +1,6 @@
1
+ import "dotenv/config";
2
+ import { PrismaClient } from "@/generated/prisma/client";
3
+
4
+ {{prismaClientInit}}
5
+
6
+ export { prisma };
@@ -0,0 +1,8 @@
1
+ generator client {
2
+ provider = "prisma-client"
3
+ output = "../generated/prisma"
4
+ }
5
+
6
+ datasource db {
7
+ provider = "{{provider}}"
8
+ }
@@ -0,0 +1,12 @@
1
+ import "dotenv/config";
2
+ import { defineConfig } from "prisma/config";
3
+
4
+ export default defineConfig({
5
+ schema: "prisma/schema.prisma",
6
+ migrations: {
7
+ path: "prisma/migrations",
8
+ },
9
+ datasource: {
10
+ url: process.env["DATABASE_URL"],
11
+ },
12
+ });
@@ -0,0 +1,140 @@
1
+ {
2
+ "name": "prisma",
3
+ "displayName": "Prisma",
4
+ "description": "Prisma ORM",
5
+ "category": "database",
6
+ "provider": "prisma",
7
+ "supportedFrameworks": ["nextjs", "express"],
8
+ "dependencies": {
9
+ "common": {
10
+ "@prisma/client": "^7.2.0",
11
+ "dotenv": "^17.2.3"
12
+ },
13
+ "providers": {
14
+ "postgresql": {
15
+ "@prisma/adapter-pg": "^7.2.0",
16
+ "pg": "^8.16.3"
17
+ },
18
+ "mongodb": {
19
+ "@prisma/client": "6.19"
20
+ },
21
+ "mysql": {
22
+ "@prisma/adapter-mariadb": "^7.2.0"
23
+ },
24
+ "sqlite": {
25
+ "@prisma/adapter-better-sqlite3": "^7.2.0"
26
+ }
27
+ }
28
+ },
29
+ "devDependencies": {
30
+ "common": {
31
+ "prisma": "^7.2.0",
32
+ "tsx": "^4.21.0"
33
+ },
34
+ "providers": {
35
+ "postgresql": {
36
+ "@types/pg": "^8.16.0"
37
+ },
38
+ "mongodb": {
39
+ "prisma": "6.19"
40
+ },
41
+ "mysql": {},
42
+ "sqlite": {
43
+ "@types/better-sqlite3": "^7.6.13"
44
+ }
45
+ }
46
+ },
47
+ "envVars": {
48
+ "common": [
49
+ {
50
+ "key": "DATABASE_URL",
51
+ "value": "{{connectionString}}",
52
+ "description": "Database connection URL",
53
+ "required": true
54
+ }
55
+ ],
56
+ "providers": {
57
+ "mysql": [
58
+ {
59
+ "key": "DATABASE_HOST",
60
+ "value": "localhost",
61
+ "description": "MySQL host",
62
+ "required": true
63
+ },
64
+ {
65
+ "key": "DATABASE_USER",
66
+ "value": "",
67
+ "description": "MySQL username",
68
+ "required": true
69
+ },
70
+ {
71
+ "key": "DATABASE_PASSWORD",
72
+ "value": "",
73
+ "description": "MySQL password",
74
+ "required": true
75
+ },
76
+ {
77
+ "key": "DATABASE_NAME",
78
+ "value": "mydb",
79
+ "description": "MySQL database name",
80
+ "required": true
81
+ },
82
+ {
83
+ "key": "DATABASE_PORT",
84
+ "value": "3306",
85
+ "description": "MySQL port",
86
+ "required": false
87
+ }
88
+ ]
89
+ }
90
+ },
91
+ "frameworkPatches": {
92
+ "express": {
93
+ "tsconfig.json": {
94
+ "merge": {
95
+ "compilerOptions": {
96
+ "baseUrl": ".",
97
+ "paths": {
98
+ "@/*": ["./src/*"]
99
+ }
100
+ },
101
+ "include": ["src/**/*"],
102
+ "exclude": ["node_modules", "dist", "prisma/migrations"]
103
+ }
104
+ }
105
+ },
106
+ "nextjs": {
107
+ "tsconfig.json": {
108
+ "merge": {
109
+ "compilerOptions": {
110
+ "paths": {
111
+ "@/*": ["./*"]
112
+ }
113
+ },
114
+ "exclude": ["node_modules", ".next", "out", "prisma/migrations"]
115
+ }
116
+ }
117
+ }
118
+ },
119
+ "patches": [
120
+ {
121
+ "type": "create-file",
122
+ "description": "Create Prisma schema",
123
+ "source": "prisma/schema.prisma",
124
+ "destination": "prisma/schema.prisma"
125
+ },
126
+ {
127
+ "type": "create-file",
128
+ "description": "Create Prisma config",
129
+ "source": "prisma.config.ts",
130
+ "destination": "prisma.config.ts"
131
+ },
132
+ {
133
+ "type": "create-file",
134
+ "description": "Create Prisma client singleton",
135
+ "source": "lib/prisma.ts",
136
+ "destination": "{{lib}}/prisma.ts"
137
+ }
138
+ ],
139
+ "postInstall": ["npx prisma generate"]
140
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stackkit-cli",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "CLI for StackKit - Production-ready project generator and module system",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -0,0 +1,3 @@
1
+ # APP CONFIGURATION
2
+ PORT=3000
3
+ NODE_ENV=development