stackkit 0.2.8 → 0.3.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.
Files changed (77) hide show
  1. package/README.md +4 -0
  2. package/bin/stackkit.js +8 -5
  3. package/dist/cli/add.js +4 -9
  4. package/dist/cli/create.js +4 -9
  5. package/dist/cli/doctor.js +11 -32
  6. package/dist/lib/constants.js +3 -4
  7. package/dist/lib/conversion/js-conversion.js +20 -16
  8. package/dist/lib/discovery/installed-detection.js +28 -38
  9. package/dist/lib/discovery/module-discovery.d.ts +0 -15
  10. package/dist/lib/discovery/module-discovery.js +15 -50
  11. package/dist/lib/framework/framework-utils.d.ts +4 -5
  12. package/dist/lib/framework/framework-utils.js +38 -49
  13. package/dist/lib/fs/files.js +1 -1
  14. package/dist/lib/generation/code-generator.d.ts +13 -19
  15. package/dist/lib/generation/code-generator.js +159 -175
  16. package/dist/lib/generation/generator-utils.js +3 -15
  17. package/dist/lib/project/detect.js +11 -19
  18. package/dist/lib/utils/fs-helpers.d.ts +1 -1
  19. package/modules/auth/authjs/generator.json +16 -16
  20. package/modules/auth/better-auth/files/express/middlewares/authorize.ts +178 -40
  21. package/modules/auth/better-auth/files/express/modules/auth/auth.controller.ts +264 -0
  22. package/modules/auth/better-auth/files/express/modules/auth/auth.route.ts +27 -0
  23. package/modules/auth/better-auth/files/express/modules/auth/auth.service.ts +537 -0
  24. package/modules/auth/better-auth/files/express/modules/auth/auth.type.ts +33 -0
  25. package/modules/auth/better-auth/files/express/templates/google-redirect.ejs +91 -0
  26. package/modules/auth/better-auth/files/express/templates/otp.ejs +87 -0
  27. package/modules/auth/better-auth/files/express/types/express.d.ts +6 -8
  28. package/modules/auth/better-auth/files/express/utils/cookie.ts +19 -0
  29. package/modules/auth/better-auth/files/express/utils/jwt.ts +34 -0
  30. package/modules/auth/better-auth/files/express/utils/token.ts +66 -0
  31. package/modules/auth/better-auth/files/nextjs/api/auth/[...all]/route.ts +1 -1
  32. package/modules/auth/better-auth/files/nextjs/lib/auth/auth-guards.ts +11 -1
  33. package/modules/auth/better-auth/files/nextjs/templates/email-otp.tsx +74 -0
  34. package/modules/auth/better-auth/files/shared/config/env.ts +117 -0
  35. package/modules/auth/better-auth/files/shared/lib/auth-client.ts +1 -1
  36. package/modules/auth/better-auth/files/shared/lib/auth.ts +167 -79
  37. package/modules/auth/better-auth/files/shared/mongoose/auth/constants.ts +11 -0
  38. package/modules/auth/better-auth/files/shared/mongoose/auth/helper.ts +51 -0
  39. package/modules/auth/better-auth/files/shared/prisma/schema.prisma +22 -11
  40. package/modules/auth/better-auth/files/shared/utils/email.ts +70 -0
  41. package/modules/auth/better-auth/generator.json +162 -80
  42. package/modules/database/mongoose/files/lib/mongoose.ts +28 -3
  43. package/modules/database/mongoose/generator.json +18 -18
  44. package/modules/database/prisma/generator.json +44 -44
  45. package/package.json +2 -2
  46. package/templates/express/env.example +3 -2
  47. package/templates/express/eslint.config.mjs +7 -0
  48. package/templates/express/node_modules/.bin/acorn +17 -0
  49. package/templates/express/node_modules/.bin/eslint +17 -0
  50. package/templates/express/node_modules/.bin/tsc +17 -0
  51. package/templates/express/node_modules/.bin/tsserver +17 -0
  52. package/templates/express/node_modules/.bin/tsx +17 -0
  53. package/templates/express/package.json +12 -6
  54. package/templates/express/src/app.ts +15 -7
  55. package/templates/express/src/config/cors.ts +8 -7
  56. package/templates/express/src/config/env.ts +28 -5
  57. package/templates/express/src/config/logger.ts +2 -2
  58. package/templates/express/src/config/rate-limit.ts +2 -2
  59. package/templates/express/src/modules/health/health.controller.ts +13 -11
  60. package/templates/express/src/routes/index.ts +1 -6
  61. package/templates/express/src/server.ts +12 -12
  62. package/templates/express/src/shared/errors/app-error.ts +16 -0
  63. package/templates/express/src/shared/middlewares/error.middleware.ts +154 -12
  64. package/templates/express/src/shared/middlewares/not-found.middleware.ts +2 -1
  65. package/templates/express/src/shared/utils/catch-async.ts +11 -0
  66. package/templates/express/src/shared/utils/pagination.ts +6 -1
  67. package/templates/express/src/shared/utils/send-response.ts +25 -0
  68. package/templates/nextjs/lib/env.ts +19 -8
  69. package/modules/auth/better-auth/files/shared/lib/email/email-service.ts +0 -33
  70. package/modules/auth/better-auth/files/shared/lib/email/email-templates.ts +0 -89
  71. package/templates/express/eslint.config.cjs +0 -42
  72. package/templates/express/src/config/helmet.ts +0 -5
  73. package/templates/express/src/modules/health/health.service.ts +0 -6
  74. package/templates/express/src/shared/errors/error-codes.ts +0 -9
  75. package/templates/express/src/shared/logger/logger.ts +0 -20
  76. package/templates/express/src/shared/utils/async-handler.ts +0 -9
  77. package/templates/express/src/shared/utils/response.ts +0 -9
@@ -6,56 +6,38 @@
6
6
  {
7
7
  "type": "create-file",
8
8
  "source": "shared/lib/auth.ts",
9
- "destination": "server/auth/auth.ts",
10
- "condition": { "framework": ["nextjs"] }
11
- },
12
- {
13
- "type": "create-file",
14
- "source": "shared/lib/auth.ts",
15
- "destination": "src/modules/auth/auth.ts",
9
+ "destination": "src/lib/auth.ts",
16
10
  "condition": { "framework": ["express"] }
17
11
  },
18
12
  {
19
13
  "type": "create-file",
20
- "source": "shared/lib/email/email-service.ts",
21
- "destination": "server/service/email/email-service.ts",
22
- "condition": { "framework": ["nextjs"] }
23
- },
24
- {
25
- "type": "create-file",
26
- "source": "shared/lib/email/email-service.ts",
27
- "destination": "src/shared/email/email-service.ts",
28
- "condition": { "framework": ["express"] }
29
- },
30
- {
31
- "type": "create-file",
32
- "source": "shared/lib/email/email-templates.ts",
33
- "destination": "server/service/email/email-templates.ts",
34
- "condition": { "framework": ["nextjs"] }
14
+ "source": "express/types/express.d.ts",
15
+ "destination": "src/types/express.d.ts",
16
+ "condition": { "framework": "express" }
35
17
  },
36
18
  {
37
19
  "type": "create-file",
38
- "source": "shared/lib/email/email-templates.ts",
39
- "destination": "src/shared/email/email-templates.ts",
40
- "condition": { "framework": ["express"] }
20
+ "source": "shared/config/env.ts",
21
+ "destination": "src/config/env.ts",
22
+ "condition": { "framework": "express" }
41
23
  },
42
24
  {
43
25
  "type": "create-file",
44
- "source": "nextjs/api/auth/[...all]/route.ts",
45
- "destination": "app/api/auth/[...all]/route.ts",
46
- "condition": { "framework": "nextjs" }
26
+ "source": "express/modules/auth/*",
27
+ "destination": "src/modules/auth/*",
28
+ "condition": { "framework": "express" }
47
29
  },
48
30
  {
49
31
  "type": "create-file",
50
- "source": "nextjs/proxy.ts",
51
- "destination": "proxy.ts",
52
- "condition": { "framework": "nextjs" }
32
+ "source": "shared/mongoose/auth/helper.ts",
33
+ "destination": "src/modules/auth/auth.helper.ts",
34
+ "condition": { "framework": "express", "database": "mongoose" }
53
35
  },
54
36
  {
55
37
  "type": "create-file",
56
- "source": "nextjs/lib/auth/auth-guards.ts",
57
- "destination": "server/auth/guards.ts",
58
- "condition": { "framework": "nextjs" }
38
+ "source": "shared/mongoose/auth/constants.ts",
39
+ "destination": "src/modules/auth/auth.constants.ts",
40
+ "condition": { "framework": "express", "database": "mongoose" }
59
41
  },
60
42
  {
61
43
  "type": "create-file",
@@ -65,99 +47,199 @@
65
47
  },
66
48
  {
67
49
  "type": "create-file",
68
- "source": "express/types/express.d.ts",
69
- "destination": "src/types/express.d.ts",
50
+ "source": "express/templates/*",
51
+ "destination": "src/templates/*",
70
52
  "condition": { "framework": "express" }
71
53
  },
72
54
  {
73
55
  "type": "create-file",
74
- "source": "shared/lib/auth-client.ts",
75
- "destination": "lib/auth/auth-client.ts",
76
- "condition": { "framework": ["nextjs"] }
56
+ "source": "express/utils/*",
57
+ "destination": "src/shared/utils/*",
58
+ "condition": { "framework": "express" }
77
59
  },
78
60
  {
79
61
  "type": "create-file",
80
- "source": "shared/lib/auth-client.ts",
81
- "destination": "src/shared/lib/auth-client.ts",
82
- "condition": { "framework": ["react"] }
83
- },
84
- {
85
- "type": "patch-file",
86
- "destination": "prisma/schema.prisma",
87
- "condition": { "database": "prisma" },
88
- "operations": [
89
- {
90
- "type": "add-to-bottom",
91
- "source": "shared/prisma/schema.prisma"
92
- }
93
- ]
62
+ "source": "shared/utils/email.ts",
63
+ "destination": "src/shared/utils/email.ts",
64
+ "condition": { "framework": "express" }
94
65
  },
95
66
  {
96
67
  "type": "patch-file",
97
- "destination": "src/server.ts",
68
+ "destination": "src/app.ts",
98
69
  "condition": { "framework": "express" },
99
70
  "operations": [
100
71
  {
101
72
  "type": "add-import",
102
- "imports": ["import { setupAuth } from \"./modules/auth/auth\";"]
73
+ "imports": [
74
+ "import { auth } from \"./lib/auth\";",
75
+ "import { toNodeHandler } from \"better-auth/node\";",
76
+ "import path from \"path\";"
77
+ ]
78
+ },
79
+ {
80
+ "type": "add-code",
81
+ "after": "// API routes",
82
+ "code": ["app.use(\"/api/auth\", (req, res) => {", " return toNodeHandler(auth)(req, res);", "});"]
103
83
  },
104
84
  {
105
85
  "type": "add-code",
106
- "before": "const port = env.port;",
107
- "code": "await setupAuth();"
86
+ "after": "app.set(\"query parser\", (str: string) => qs.parse(str));",
87
+ "code": [
88
+ "app.set(\"view engine\", \"ejs\");",
89
+ "app.set(\"views\", path.resolve(process.cwd(), `src/templates`));"
90
+ ]
108
91
  }
109
92
  ]
110
93
  },
111
94
  {
112
95
  "type": "patch-file",
113
- "destination": "src/app.ts",
96
+ "destination": "src/routes/index.ts",
114
97
  "condition": { "framework": "express" },
115
98
  "operations": [
116
99
  {
117
100
  "type": "add-import",
118
- "imports": ["import { auth } from \"./modules/auth/auth\";",
119
- "import { toNodeHandler } from \"better-auth/node\";"]
101
+ "imports": ["import { authRoutes } from \"../modules/auth/auth.route\";"]
120
102
  },
121
103
  {
122
104
  "type": "add-code",
123
- "after": "// API routes",
124
- "code": [
125
- "app.all(\"/api/auth/*splat\", (req: Request, res: Response) => {",
126
- " if (!auth) {",
127
- " return res.status(503).json({ success: false, message: \"Auth not ready\" });",
128
- " }",
129
- " return toNodeHandler(auth)(req, res);",
130
- "});"
131
- ]
105
+ "after": "router.use(\"/health\", healthRoutes);",
106
+ "code": ["router.use(\"/auth\", authRoutes);"]
132
107
  }
133
108
  ]
134
109
  },
135
110
  {
136
111
  "type": "add-dependency",
137
- "condition": { "framework": ["nextjs", "express"] },
112
+ "condition": { "framework": "express" },
138
113
  "dependencies": {
139
- "nodemailer": "^7.0.12"
114
+ "ejs": "^4.0.1",
115
+ "jsonwebtoken": "^9.0.3"
140
116
  },
141
117
  "devDependencies": {
142
- "@types/nodemailer": "^7.0.5"
118
+ "@types/ejs": "^3.1.5",
119
+ "@types/jsonwebtoken": "^9.0.10"
143
120
  }
144
121
  },
145
122
  {
146
123
  "type": "add-env",
124
+ "condition": { "framework": "express" },
147
125
  "envVars": {
148
- "BETTER_AUTH_SECRET": "",
149
126
  "BETTER_AUTH_URL": "http://localhost:3000",
150
- "EMAIL_HOST": "smtp.gmail.com",
151
- "EMAIL_PORT": "587",
152
- "EMAIL_USER": "",
153
- "EMAIL_PASS": "",
154
- "EMAIL_FROM": "noreply@yourapp.com"
127
+ "BETTER_AUTH_SECRET": "your_better_auth_secret",
128
+ "BETTER_AUTH_SESSION_TOKEN_EXPIRES_IN": "1d",
129
+ "BETTER_AUTH_SESSION_TOKEN_UPDATE_AGE": "1d",
130
+ "ACCESS_TOKEN_SECRET": "your_access_token_secret",
131
+ "ACCESS_TOKEN_EXPIRES_IN": "1d",
132
+ "REFRESH_TOKEN_SECRET": "your_refresh_token_secret",
133
+ "REFRESH_TOKEN_EXPIRES_IN": "7d",
134
+ "GOOGLE_CLIENT_ID": "your_google_client_id",
135
+ "GOOGLE_CLIENT_SECRET": "your_google_client_secret",
136
+ "GOOGLE_CALLBACK_URL": "http://localhost:5000/api/auth/callback/google",
137
+ "EMAIL_SENDER_SMTP_USER": "your_email@gmail.com",
138
+ "EMAIL_SENDER_SMTP_PASS": "your_email_password",
139
+ "EMAIL_SENDER_SMTP_HOST": "smtp.gmail.com",
140
+ "EMAIL_SENDER_SMTP_PORT": "465",
141
+ "EMAIL_SENDER_SMTP_FROM": "your_email@gmail.com",
142
+ "SUPER_ADMIN_EMAIL": "your_email@gmail.com",
143
+ "SUPER_ADMIN_PASSWORD": "your_super_admin_password"
144
+ }
145
+ },
146
+ {
147
+ "type": "create-file",
148
+ "source": "shared/lib/auth.ts",
149
+ "destination": "server/auth/auth.ts",
150
+ "condition": { "framework": "nextjs" }
151
+ },
152
+ {
153
+ "type": "create-file",
154
+ "source": "nextjs/api/auth/[...all]/route.ts",
155
+ "destination": "app/api/auth/[...all]/route.ts",
156
+ "condition": { "framework": "nextjs" }
157
+ },
158
+ {
159
+ "type": "create-file",
160
+ "source": "nextjs/lib/auth/auth-guards.ts",
161
+ "destination": "server/auth/guards.ts",
162
+ "condition": { "framework": "nextjs" }
163
+ },
164
+ {
165
+ "type": "create-file",
166
+ "source": "nextjs/proxy.ts",
167
+ "destination": "proxy.ts",
168
+ "condition": { "framework": "nextjs" }
169
+ },
170
+ {
171
+ "type": "create-file",
172
+ "source": "shared/lib/auth-client.ts",
173
+ "destination": "lib/auth/auth-client.ts",
174
+ "condition": { "framework": "nextjs" }
175
+ },
176
+ {
177
+ "type": "create-file",
178
+ "source": "shared/mongoose/auth/constants.ts",
179
+ "destination": "lib/auth/auth-constants.ts",
180
+ "condition": { "framework": "nextjs" }
181
+ },
182
+ {
183
+ "type": "create-file",
184
+ "source": "shared/utils/email.ts",
185
+ "destination": "lib/utils/email.ts",
186
+ "condition": { "framework": "nextjs" }
187
+ },
188
+ {
189
+ "type": "create-file",
190
+ "source": "nextjs/templates/email-otp.tsx",
191
+ "destination": "lib/email/otp-template.tsx",
192
+ "condition": { "framework": "nextjs" }
193
+ },
194
+ {
195
+ "type": "create-file",
196
+ "source": "shared/config/env.ts",
197
+ "destination": "lib/env.ts",
198
+ "condition": { "framework": "nextjs" }
199
+ },
200
+ {
201
+ "type": "add-env",
202
+ "condition": { "framework": "nextjs" },
203
+ "envVars": {
204
+ "NEXT_PUBLIC_APP_URL": "http://localhost:3000",
205
+ "NEXT_PUBLIC_FRONTEND_URL": "http://localhost:3000",
206
+ "NEXT_PUBLIC_BETTER_AUTH_URL": "http://localhost:3000",
207
+ "BETTER_AUTH_SECRET": "your_better_auth_secret",
208
+ "GOOGLE_CLIENT_ID": "your_google_client_id",
209
+ "GOOGLE_CLIENT_SECRET": "your_google_client_secret",
210
+ "NEXT_PUBLIC_GOOGLE_CALLBACK_URL": "http://localhost:3000/api/auth/callback/google",
211
+ "EMAIL_SENDER_SMTP_USER": "your_email@gmail.com",
212
+ "EMAIL_SENDER_SMTP_PASS": "your_email_password",
213
+ "EMAIL_SENDER_SMTP_HOST": "smtp.gmail.com",
214
+ "EMAIL_SENDER_SMTP_PORT": "465",
215
+ "EMAIL_SENDER_SMTP_FROM": "your_email@gmail.com"
216
+ }
217
+ },
218
+ {
219
+ "type": "create-file",
220
+ "source": "shared/lib/auth-client.ts",
221
+ "destination": "src/shared/lib/auth-client.ts",
222
+ "condition": { "framework": "react" }
223
+ },
224
+ {
225
+ "type": "patch-file",
226
+ "destination": "prisma/schema.prisma",
227
+ "condition": { "database": "prisma" },
228
+ "operations": [
229
+ {
230
+ "type": "add-to-bottom",
231
+ "source": "shared/prisma/schema.prisma"
155
232
  }
156
- },
233
+ ]
234
+ },
157
235
  {
158
236
  "type": "add-dependency",
159
237
  "dependencies": {
160
- "better-auth": "^1.4.12"
238
+ "better-auth": "^1.4.12",
239
+ "nodemailer": "^7.0.12"
240
+ },
241
+ "devDependencies": {
242
+ "@types/nodemailer": "^7.0.5"
161
243
  }
162
244
  }
163
245
  ]
@@ -1,4 +1,5 @@
1
1
  import mongoose from "mongoose";
2
+ import { envVars } from "../config/env";
2
3
 
3
4
  type MongooseCache = {
4
5
  conn: typeof mongoose | null;
@@ -24,14 +25,13 @@ async function dbConnect(): Promise<typeof mongoose> {
24
25
  return cached.conn;
25
26
  }
26
27
 
27
- const uri = process.env.DATABASE_URL as string;
28
+ const uri = envVars.DATABASE_URL;
28
29
 
29
30
  if (!cached.promise) {
30
31
  const opts = {
31
32
  bufferCommands: false,
32
33
  connectTimeoutMS: 10000,
33
34
  serverSelectionTimeoutMS: 10000,
34
- // serverApi removed: not needed for mongoose-only connection
35
35
  };
36
36
 
37
37
  cached.promise = mongoose
@@ -60,4 +60,29 @@ async function dbConnect(): Promise<typeof mongoose> {
60
60
  return cached.conn;
61
61
  }
62
62
 
63
- export { dbConnect as mongoose, dbConnect as connectMongoose };
63
+ const getMongoClient = () => {
64
+ if (!mongoose.connection.readyState) {
65
+ throw new Error("MongoDB is not connected. Call mongoose() first.");
66
+ }
67
+
68
+ return mongoose.connection.getClient();
69
+ };
70
+
71
+ const getMongoDb = () => {
72
+ const db = mongoose.connection.db;
73
+
74
+ if (!db) {
75
+ throw new Error("MongoDB is not connected. Call mongoose() first.");
76
+ }
77
+
78
+ return db;
79
+ };
80
+
81
+ export {
82
+ dbConnect as connectMongoose,
83
+ getMongoClient,
84
+ getMongoDb,
85
+ dbConnect as mongoose,
86
+ dbConnect,
87
+ };
88
+
@@ -3,12 +3,6 @@
3
3
  "type": "database",
4
4
  "priority": 5,
5
5
  "operations": [
6
- {
7
- "type": "create-file",
8
- "source": "lib/mongoose.ts",
9
- "destination": "server/database/mongoose.ts",
10
- "condition": { "framework": ["nextjs"] }
11
- },
12
6
  {
13
7
  "type": "create-file",
14
8
  "source": "lib/mongoose.ts",
@@ -21,12 +15,6 @@
21
15
  "destination": "src/modules/health/health.model.ts",
22
16
  "condition": { "framework": ["express"] }
23
17
  },
24
- {
25
- "type": "create-file",
26
- "source": "models/health.ts",
27
- "destination": "server/database/models/health.model.ts",
28
- "condition": { "framework": ["nextjs"] }
29
- },
30
18
  {
31
19
  "type": "patch-file",
32
20
  "destination": "src/server.ts",
@@ -34,26 +22,38 @@
34
22
  "operations": [
35
23
  {
36
24
  "type": "add-import",
37
- "imports": ["import { mongoose } from \"../lib/mongoose\";"]
25
+ "imports": ["import { mongoose } from \"./database/mongoose\";"]
38
26
  },
39
27
  {
40
28
  "type": "add-code",
41
- "after": "async function startServer() {",
29
+ "after": "try {",
42
30
  "code": "await mongoose();"
43
31
  }
44
32
  ]
45
33
  },
46
34
  {
47
- "type": "add-env",
48
- "envVars": {
49
- "MONGODB_URI": "mongodb://localhost:27017/database_name"
50
- }
35
+ "type": "create-file",
36
+ "source": "lib/mongoose.ts",
37
+ "destination": "server/database/mongoose.ts",
38
+ "condition": { "framework": ["nextjs"] }
39
+ },
40
+ {
41
+ "type": "create-file",
42
+ "source": "models/health.ts",
43
+ "destination": "server/database/models/health.model.ts",
44
+ "condition": { "framework": ["nextjs"] }
51
45
  },
52
46
  {
53
47
  "type": "add-dependency",
54
48
  "dependencies": {
55
49
  "mongoose": "^8.8.0"
56
50
  }
51
+ },
52
+ {
53
+ "type": "add-env",
54
+ "envVars": {
55
+ "DATABASE_URL": "mongodb://username:password@localhost:27017/database_name?authSource=admin"
56
+ }
57
57
  }
58
58
  ]
59
59
  }
@@ -16,51 +16,88 @@
16
16
  {
17
17
  "type": "create-file",
18
18
  "source": "lib/prisma.ts",
19
- "destination": "server/database/prisma.ts",
20
- "condition": { "framework": ["nextjs"] }
19
+ "destination": "src/database/prisma.ts",
20
+ "condition": { "framework": ["express"] }
21
21
  },
22
22
  {
23
23
  "type": "create-file",
24
24
  "source": "lib/prisma.ts",
25
- "destination": "src/database/prisma.ts",
26
- "condition": { "framework": ["express"] }
25
+ "destination": "server/database/prisma.ts",
26
+ "condition": { "framework": ["nextjs"] }
27
+ },
28
+ {
29
+ "type": "add-dependency",
30
+ "dependencies": {
31
+ "dotenv": "^17.2.3"
32
+ }
33
+ },
34
+ {
35
+ "type": "add-script",
36
+ "scripts": {
37
+ "db:generate": "npx prisma generate",
38
+ "db:push": "npx prisma db push",
39
+ "db:seed": "tsx prisma/seed.ts",
40
+ "db:migrate": "npx prisma migrate dev",
41
+ "db:studio": "npx prisma studio"
42
+ }
27
43
  },
28
44
  {
29
45
  "type": "add-dependency",
30
46
  "condition": { "prismaProvider": "postgresql" },
31
47
  "dependencies": {
32
- "@prisma/adapter-pg": "^7.0.0",
33
48
  "@prisma/client": "^7.2.0",
49
+ "@prisma/adapter-pg": "^7.0.0",
34
50
  "pg": "^8.0.0"
35
51
  },
36
52
  "devDependencies": {
37
53
  "prisma": "^7.2.0"
38
54
  }
39
55
  },
56
+ {
57
+ "type": "add-env",
58
+ "condition": { "prismaProvider": "postgresql" },
59
+ "envVars": {
60
+ "DATABASE_URL": "postgresql://username:password@localhost:5432/database_name"
61
+ }
62
+ },
40
63
  {
41
64
  "type": "add-dependency",
42
65
  "condition": { "prismaProvider": "mysql" },
43
66
  "dependencies": {
44
- "@prisma/adapter-mariadb": "^7.0.0",
45
67
  "@prisma/client": "^7.2.0",
68
+ "@prisma/adapter-mariadb": "^7.0.0",
46
69
  "mysql2": "^3.0.0"
47
70
  },
48
71
  "devDependencies": {
49
72
  "prisma": "^7.2.0"
50
73
  }
51
74
  },
75
+ {
76
+ "type": "add-env",
77
+ "condition": { "prismaProvider": "mysql" },
78
+ "envVars": {
79
+ "DATABASE_URL": "mysql://username:password@localhost:3306/database_name"
80
+ }
81
+ },
52
82
  {
53
83
  "type": "add-dependency",
54
84
  "condition": { "prismaProvider": "sqlite" },
55
85
  "dependencies": {
56
- "@prisma/adapter-better-sqlite3": "^7.0.0",
57
86
  "@prisma/client": "^7.2.0",
87
+ "@prisma/adapter-better-sqlite3": "^7.0.0",
58
88
  "better-sqlite3": "^9.0.0"
59
89
  },
60
90
  "devDependencies": {
61
91
  "prisma": "^7.2.0"
62
92
  }
63
93
  },
94
+ {
95
+ "type": "add-env",
96
+ "condition": { "prismaProvider": "sqlite" },
97
+ "envVars": {
98
+ "DATABASE_URL": "file:./dev.db"
99
+ }
100
+ },
64
101
  {
65
102
  "type": "add-dependency",
66
103
  "condition": { "prismaProvider": "mongodb" },
@@ -71,49 +108,12 @@
71
108
  "prisma": "^6.19.0"
72
109
  }
73
110
  },
74
- {
75
- "type": "add-env",
76
- "condition": { "prismaProvider": "postgresql" },
77
- "envVars": {
78
- "DATABASE_URL": "postgresql://username:password@localhost:5432/database_name"
79
- }
80
- },
81
- {
82
- "type": "add-env",
83
- "condition": { "prismaProvider": "mysql" },
84
- "envVars": {
85
- "DATABASE_URL": "mysql://username:password@localhost:3306/database_name"
86
- }
87
- },
88
- {
89
- "type": "add-env",
90
- "condition": { "prismaProvider": "sqlite" },
91
- "envVars": {
92
- "DATABASE_URL": "file:./dev.db"
93
- }
94
- },
95
111
  {
96
112
  "type": "add-env",
97
113
  "condition": { "prismaProvider": "mongodb" },
98
114
  "envVars": {
99
115
  "DATABASE_URL": "mongodb://localhost:27017/database_name"
100
116
  }
101
- },
102
- {
103
- "type": "add-dependency",
104
- "dependencies": {
105
- "dotenv": "^17.2.3"
106
- }
107
- },
108
- {
109
- "type": "add-script",
110
- "scripts": {
111
- "db:generate": "npx prisma generate",
112
- "db:push": "npx prisma db push",
113
- "db:seed": "tsx prisma/seed.ts",
114
- "db:migrate": "npx prisma migrate dev",
115
- "db:studio": "npx prisma studio"
116
- }
117
117
  }
118
118
  ]
119
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stackkit",
3
- "version": "0.2.8",
3
+ "version": "0.3.0",
4
4
  "description": "Production-ready CLI to create and extend JavaScript or TypeScript apps with modular stacks.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -80,4 +80,4 @@
80
80
  "@types/validate-npm-package-name": "^4.0.2",
81
81
  "typescript": "^5.3.3"
82
82
  }
83
- }
83
+ }
@@ -1,3 +1,4 @@
1
- PORT=3000
1
+ PORT=5000
2
2
  NODE_ENV=development
3
- CORS_ORIGIN="http://localhost:3000"
3
+ APP_URL=http://localhost:5000
4
+ FRONTEND_URL=http://localhost:3000
@@ -0,0 +1,7 @@
1
+ // @ts-check
2
+
3
+ import eslint from "@eslint/js";
4
+ import { defineConfig } from "eslint/config";
5
+ import tseslint from "typescript-eslint";
6
+
7
+ export default defineConfig(eslint.configs.recommended, tseslint.configs.recommended);
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6
+ esac
7
+
8
+ if [ -z "$NODE_PATH" ]; then
9
+ export NODE_PATH="/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/acorn@8.15.0/node_modules/acorn/bin/node_modules:/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/acorn@8.15.0/node_modules/acorn/node_modules:/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/acorn@8.15.0/node_modules:/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/node_modules"
10
+ else
11
+ export NODE_PATH="/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/acorn@8.15.0/node_modules/acorn/bin/node_modules:/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/acorn@8.15.0/node_modules/acorn/node_modules:/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/acorn@8.15.0/node_modules:/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/node_modules:$NODE_PATH"
12
+ fi
13
+ if [ -x "$basedir/node" ]; then
14
+ exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/acorn@8.15.0/node_modules/acorn/bin/acorn" "$@"
15
+ else
16
+ exec node "$basedir/../../../../node_modules/.pnpm/acorn@8.15.0/node_modules/acorn/bin/acorn" "$@"
17
+ fi
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+ basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
+
4
+ case `uname` in
5
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
6
+ esac
7
+
8
+ if [ -z "$NODE_PATH" ]; then
9
+ export NODE_PATH="/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/eslint@9.39.2/node_modules/eslint/bin/node_modules:/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/eslint@9.39.2/node_modules/eslint/node_modules:/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/eslint@9.39.2/node_modules:/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/node_modules"
10
+ else
11
+ export NODE_PATH="/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/eslint@9.39.2/node_modules/eslint/bin/node_modules:/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/eslint@9.39.2/node_modules/eslint/node_modules:/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/eslint@9.39.2/node_modules:/home/tariqul/Projects/open-source/stackkit/node_modules/.pnpm/node_modules:$NODE_PATH"
12
+ fi
13
+ if [ -x "$basedir/node" ]; then
14
+ exec "$basedir/node" "$basedir/../../../../node_modules/.pnpm/eslint@9.39.2/node_modules/eslint/bin/eslint.js" "$@"
15
+ else
16
+ exec node "$basedir/../../../../node_modules/.pnpm/eslint@9.39.2/node_modules/eslint/bin/eslint.js" "$@"
17
+ fi