stackkit-cli 0.3.1 → 0.4.1

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 (147) hide show
  1. package/README.md +12 -99
  2. package/dist/commands/add.d.ts +0 -1
  3. package/dist/commands/add.js +0 -1
  4. package/dist/commands/init.d.ts +0 -1
  5. package/dist/commands/init.js +0 -1
  6. package/dist/commands/list.d.ts +0 -1
  7. package/dist/commands/list.js +0 -1
  8. package/dist/index.d.ts +0 -1
  9. package/dist/index.js +1 -2
  10. package/dist/types/index.d.ts +0 -1
  11. package/dist/types/index.js +0 -1
  12. package/dist/utils/code-inject.d.ts +0 -1
  13. package/dist/utils/code-inject.js +0 -1
  14. package/dist/utils/detect.d.ts +0 -1
  15. package/dist/utils/detect.js +0 -1
  16. package/dist/utils/env-editor.d.ts +0 -1
  17. package/dist/utils/env-editor.js +0 -1
  18. package/dist/utils/files.d.ts +0 -1
  19. package/dist/utils/files.js +0 -1
  20. package/dist/utils/json-editor.d.ts +0 -1
  21. package/dist/utils/json-editor.js +0 -1
  22. package/dist/utils/logger.d.ts +0 -1
  23. package/dist/utils/logger.js +3 -2
  24. package/dist/utils/package-manager.d.ts +0 -1
  25. package/dist/utils/package-manager.js +0 -1
  26. package/modules/auth/better-auth-nextjs/files/api/auth/[...all]/route.ts +3 -1
  27. package/modules/auth/better-auth-nextjs/files/lib/auth.ts +19 -11
  28. package/modules/auth/better-auth-nextjs/module.json +7 -4
  29. package/modules/auth/clerk-express/files/lib/auth.ts +7 -0
  30. package/modules/auth/clerk-express/module.json +19 -0
  31. package/modules/auth/clerk-nextjs/files/lib/auth-provider.tsx +5 -0
  32. package/modules/auth/clerk-nextjs/files/middleware.ts +9 -0
  33. package/modules/auth/clerk-nextjs/module.json +27 -0
  34. package/modules/auth/clerk-react/files/lib/auth-provider.tsx +15 -0
  35. package/modules/auth/clerk-react/module.json +18 -0
  36. package/modules/database/drizzle-postgresql/files/drizzle.config.ts +10 -0
  37. package/modules/database/drizzle-postgresql/files/lib/db.ts +7 -0
  38. package/modules/database/drizzle-postgresql/files/lib/schema.ts +8 -0
  39. package/modules/database/drizzle-postgresql/module.json +34 -0
  40. package/modules/database/mongoose-mongodb/files/lib/db.ts +40 -0
  41. package/modules/database/mongoose-mongodb/module.json +17 -0
  42. package/package.json +4 -3
  43. package/templates/bases/express-base/package.json +3 -3
  44. package/templates/bases/express-base/src/app.ts +34 -0
  45. package/templates/bases/express-base/src/config/env.ts +14 -0
  46. package/templates/bases/express-base/src/middlewares/error.middleware.ts +12 -0
  47. package/templates/bases/express-base/src/server.ts +8 -0
  48. package/templates/bases/express-base/template.json +1 -1
  49. package/templates/bases/express-base/tsconfig.json +5 -8
  50. package/templates/bases/nextjs-base/README.md +36 -0
  51. package/templates/bases/nextjs-base/app/favicon.ico +0 -0
  52. package/templates/bases/nextjs-base/app/globals.css +26 -3
  53. package/templates/bases/nextjs-base/app/layout.tsx +21 -6
  54. package/templates/bases/nextjs-base/app/page.tsx +61 -4
  55. package/templates/bases/nextjs-base/eslint.config.mjs +18 -0
  56. package/templates/bases/nextjs-base/next.config.ts +4 -2
  57. package/templates/bases/nextjs-base/package.json +12 -10
  58. package/templates/bases/nextjs-base/postcss.config.mjs +7 -0
  59. package/templates/bases/nextjs-base/public/file.svg +1 -0
  60. package/templates/bases/nextjs-base/public/globe.svg +1 -0
  61. package/templates/bases/nextjs-base/public/next.svg +1 -0
  62. package/templates/bases/nextjs-base/public/vercel.svg +1 -0
  63. package/templates/bases/nextjs-base/public/window.svg +1 -0
  64. package/templates/bases/nextjs-base/template.json +13 -2
  65. package/templates/bases/nextjs-base/tsconfig.json +9 -2
  66. package/templates/bases/react-vite-base/README.md +73 -0
  67. package/templates/bases/react-vite-base/eslint.config.js +23 -0
  68. package/templates/bases/react-vite-base/index.html +13 -0
  69. package/templates/bases/react-vite-base/package.json +30 -0
  70. package/templates/bases/react-vite-base/public/vite.svg +1 -0
  71. package/templates/bases/react-vite-base/src/App.css +42 -0
  72. package/templates/bases/react-vite-base/src/App.tsx +35 -0
  73. package/templates/bases/react-vite-base/src/assets/react.svg +1 -0
  74. package/templates/bases/react-vite-base/src/index.css +68 -0
  75. package/templates/bases/react-vite-base/src/main.tsx +10 -0
  76. package/templates/bases/react-vite-base/template.json +19 -0
  77. package/templates/bases/react-vite-base/tsconfig.app.json +28 -0
  78. package/templates/bases/react-vite-base/tsconfig.json +7 -0
  79. package/templates/bases/react-vite-base/tsconfig.node.json +26 -0
  80. package/templates/bases/react-vite-base/vite.config.ts +7 -0
  81. package/dist/commands/add.d.ts.map +0 -1
  82. package/dist/commands/add.js.map +0 -1
  83. package/dist/commands/init.d.ts.map +0 -1
  84. package/dist/commands/init.js.map +0 -1
  85. package/dist/commands/list.d.ts.map +0 -1
  86. package/dist/commands/list.js.map +0 -1
  87. package/dist/index.d.ts.map +0 -1
  88. package/dist/index.js.map +0 -1
  89. package/dist/types/index.d.ts.map +0 -1
  90. package/dist/types/index.js.map +0 -1
  91. package/dist/utils/code-inject.d.ts.map +0 -1
  92. package/dist/utils/code-inject.js.map +0 -1
  93. package/dist/utils/detect.d.ts.map +0 -1
  94. package/dist/utils/detect.js.map +0 -1
  95. package/dist/utils/env-editor.d.ts.map +0 -1
  96. package/dist/utils/env-editor.js.map +0 -1
  97. package/dist/utils/files.d.ts.map +0 -1
  98. package/dist/utils/files.js.map +0 -1
  99. package/dist/utils/json-editor.d.ts.map +0 -1
  100. package/dist/utils/json-editor.js.map +0 -1
  101. package/dist/utils/logger.d.ts.map +0 -1
  102. package/dist/utils/logger.js.map +0 -1
  103. package/dist/utils/package-manager.d.ts.map +0 -1
  104. package/dist/utils/package-manager.js.map +0 -1
  105. package/modules/auth/authjs-express/files/lib/auth.ts +0 -40
  106. package/modules/auth/authjs-express/files/routes/auth.ts +0 -12
  107. package/modules/auth/authjs-express/module.json +0 -39
  108. package/modules/auth/authjs-nextjs/files/api/auth/[...nextauth]/route.ts +0 -3
  109. package/modules/auth/authjs-nextjs/files/lib/auth.ts +0 -43
  110. package/modules/auth/authjs-nextjs/module.json +0 -38
  111. package/modules/auth/nextauth/files/app-router/api/auth/[...nextauth]/route.ts +0 -6
  112. package/modules/auth/nextauth/files/lib/auth.ts +0 -82
  113. package/modules/auth/nextauth/files/pages-router/api/auth/[...nextauth].ts +0 -4
  114. package/modules/auth/nextauth/module.json +0 -50
  115. package/templates/auth/authjs-express/config.json +0 -20
  116. package/templates/auth/authjs-express/files/lib/auth.ts +0 -43
  117. package/templates/auth/authjs-express/files/routes/auth.ts +0 -12
  118. package/templates/auth/authjs-express/lib/auth.ts +0 -43
  119. package/templates/auth/authjs-express/module.json +0 -39
  120. package/templates/auth/authjs-express/routes/auth.ts +0 -12
  121. package/templates/auth/authjs-nextjs/app/api/auth/[...nextauth]/route.ts +0 -3
  122. package/templates/auth/authjs-nextjs/config.json +0 -19
  123. package/templates/auth/authjs-nextjs/files/api/auth/[...nextauth]/route.ts +0 -3
  124. package/templates/auth/authjs-nextjs/files/lib/auth.ts +0 -45
  125. package/templates/auth/authjs-nextjs/lib/auth.ts +0 -45
  126. package/templates/auth/authjs-nextjs/module.json +0 -38
  127. package/templates/auth/better-auth-express/config.json +0 -18
  128. package/templates/auth/better-auth-express/src/lib/auth.ts +0 -12
  129. package/templates/auth/better-auth-express/src/routes/auth.ts +0 -10
  130. package/templates/auth/better-auth-nextjs/app/api/auth/[...all]/route.ts +0 -4
  131. package/templates/auth/better-auth-nextjs/config.json +0 -18
  132. package/templates/auth/better-auth-nextjs/lib/auth.ts +0 -14
  133. package/templates/auth/better-auth-react/config.json +0 -15
  134. package/templates/auth/better-auth-react/files/lib/auth-client.ts +0 -9
  135. package/templates/auth/better-auth-react/lib/auth-client.ts +0 -9
  136. package/templates/auth/better-auth-react/module.json +0 -26
  137. package/templates/auth/nextauth/app/api/auth/[...nextauth]/route.ts +0 -3
  138. package/templates/auth/nextauth/config.json +0 -18
  139. package/templates/auth/nextauth/lib/auth.ts +0 -31
  140. package/templates/bases/express-base/src/index.ts +0 -27
  141. package/templates/bases/nextjs-base/.eslintrc.json +0 -3
  142. package/templates/databases/prisma-mongodb/config.json +0 -21
  143. package/templates/databases/prisma-mongodb/lib/db.ts +0 -13
  144. package/templates/databases/prisma-mongodb/prisma/schema.prisma +0 -16
  145. package/templates/databases/prisma-postgresql/config.json +0 -22
  146. package/templates/databases/prisma-postgresql/lib/db.ts +0 -13
  147. package/templates/databases/prisma-postgresql/prisma/schema.prisma +0 -16
package/README.md CHANGED
@@ -1,118 +1,31 @@
1
1
  # stackkit-cli
2
2
 
3
- Main CLI package for StackKit - production-ready project generator with modular architecture.
4
-
5
- [![npm](https://img.shields.io/npm/v/stackkit-cli)](https://www.npmjs.com/package/stackkit-cli)
6
-
7
- ## Installation
8
-
9
- ```bash
10
- # Global installation
11
- npm install -g stackkit-cli
12
-
13
- # Or use directly with npx
14
- npx stackkit-cli@latest init my-app
15
- ```
3
+ Add modules to existing projects.
16
4
 
17
5
  ## Usage
18
6
 
19
7
  ```bash
20
- # Create new project
21
- npx stackkit-cli init my-app
22
-
23
- # List available resources
24
- npx stackkit-cli list
25
-
26
- # Add modules to existing project
8
+ # Add authentication
27
9
  npx stackkit-cli add auth
28
- ```
29
-
30
- ## Commands
31
-
32
- ### `init [project-name]`
33
-
34
- Create a new project from a template.
35
-
36
- **Options:**
37
-
38
- - `--template <name>` - Template to use
39
- - `--pm <npm|yarn|pnpm>` - Package manager (default: auto-detect)
40
- - `--no-install` - Skip dependency installation
41
- - `--no-git` - Skip git initialization
42
- - `--yes` - Skip all prompts
43
-
44
- **Examples:**
45
-
46
- ```bash
47
- npx stackkit-cli init my-app
48
- npx stackkit-cli init my-app --template next-prisma-postgres-shadcn --pm pnpm
49
- npx stackkit-cli init my-app --no-install --no-git --yes
50
- ```
51
-
52
- ### `list`
53
-
54
- List available templates and modules.
55
-
56
- **Options:**
57
10
 
58
- - `--templates` - Show templates only
59
- - `--modules` - Show modules only
11
+ # Add database
12
+ npx stackkit-cli add database
60
13
 
61
- **Examples:**
62
-
63
- ```bash
14
+ # List available modules
64
15
  npx stackkit-cli list
65
- npx stackkit-cli list --templates
66
- npx stackkit-cli list --modules
67
- ```
68
-
69
- ### `add <module>`
70
-
71
- Add a module to your existing project.
72
-
73
- **Options:**
74
-
75
- - `--dry-run` - Preview changes without applying
76
- - `--force` - Overwrite existing files
77
- - `--no-install` - Skip dependency installation
78
-
79
- **Examples:**
80
-
81
- ```bash
82
- npx stackkit-cli add auth
83
- npx stackkit-cli add auth --dry-run
84
- npx stackkit-cli add auth --force
85
16
  ```
86
17
 
87
- ## Development
18
+ ## Available Commands
88
19
 
89
- ```bash
90
- # Install dependencies
91
- pnpm install
92
-
93
- # Build package
94
- pnpm build
95
-
96
- # Link globally for testing
97
- pnpm link --global
98
-
99
- # Test locally
100
- stackkit init test-app
101
- ```
102
-
103
- ## Publishing
104
-
105
- The package uses automated build process:
20
+ ### `add <module>`
21
+ Add authentication or database module to your project. Interactive wizard guides you through options.
106
22
 
107
- ```bash
108
- # Version bump
109
- npm version patch|minor|major
23
+ ### `list`
24
+ List all available modules.
110
25
 
111
- # Publish (prepublishOnly will auto-build and copy templates/modules)
112
- npm publish --access public
113
- ```
26
+ ## Documentation
114
27
 
115
- See main [README](../../README.md) for more details.
28
+ See [main repository](https://github.com/tariqul420/stackkit) for full documentation.
116
29
 
117
30
  ## License
118
31
 
@@ -6,4 +6,3 @@ interface AddOptions {
6
6
  }
7
7
  export declare function addCommand(module: string, options: AddOptions): Promise<void>;
8
8
  export {};
9
- //# sourceMappingURL=add.d.ts.map
@@ -206,4 +206,3 @@ async function findModulePath(modulesDir, moduleName, provider) {
206
206
  }
207
207
  return null;
208
208
  }
209
- //# sourceMappingURL=add.js.map
@@ -8,4 +8,3 @@ interface InitOptions {
8
8
  }
9
9
  export declare function initCommand(projectName: string | undefined, options: InitOptions): Promise<void>;
10
10
  export {};
11
- //# sourceMappingURL=init.d.ts.map
@@ -150,4 +150,3 @@ async function getAvailableTemplates(templatesDir) {
150
150
  }
151
151
  return templates;
152
152
  }
153
- //# sourceMappingURL=init.js.map
@@ -4,4 +4,3 @@ interface ListOptions {
4
4
  }
5
5
  export declare function listCommand(options: ListOptions): Promise<void>;
6
6
  export {};
7
- //# sourceMappingURL=list.d.ts.map
@@ -98,4 +98,3 @@ async function getAvailableModules(modulesDir) {
98
98
  }
99
99
  return modules;
100
100
  }
101
- //# sourceMappingURL=list.js.map
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  #!/usr/bin/env node
2
2
  export {};
3
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ const program = new commander_1.Command();
13
13
  program
14
14
  .name('stackkit')
15
15
  .description('Production-ready project generator and module CLI')
16
- .version('0.3.1');
16
+ .version('0.3.2');
17
17
  // Init command
18
18
  program
19
19
  .command('init [project-name]')
@@ -47,4 +47,3 @@ program.on('command:*', () => {
47
47
  process.exit(1);
48
48
  });
49
49
  program.parse();
50
- //# sourceMappingURL=index.js.map
@@ -63,4 +63,3 @@ export interface CLIOptions {
63
63
  noInstall?: boolean;
64
64
  pm?: 'npm' | 'yarn' | 'pnpm';
65
65
  }
66
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=index.js.map
@@ -12,4 +12,3 @@ export declare function injectCode(filePath: string, injection: CodeInjection, p
12
12
  }): Promise<void>;
13
13
  export declare function removeInjection(content: string, id: string): string;
14
14
  export declare function hasInjection(content: string, id: string): boolean;
15
- //# sourceMappingURL=code-inject.d.ts.map
@@ -68,4 +68,3 @@ function removeInjection(content, id) {
68
68
  function hasInjection(content, id) {
69
69
  return content.includes(CODE_MARKER_START(id));
70
70
  }
71
- //# sourceMappingURL=code-inject.js.map
@@ -2,4 +2,3 @@ import { ProjectInfo } from '../types';
2
2
  export declare function detectProjectInfo(targetDir: string): Promise<ProjectInfo>;
3
3
  export declare function getRouterBasePath(projectInfo: ProjectInfo): string;
4
4
  export declare function getLibPath(projectInfo: ProjectInfo): string;
5
- //# sourceMappingURL=detect.d.ts.map
@@ -105,4 +105,3 @@ function getLibPath(projectInfo) {
105
105
  const srcExists = fs_extra_1.default.existsSync(path_1.default.join(projectInfo.rootDir, 'src'));
106
106
  return srcExists ? 'src/lib' : 'lib';
107
107
  }
108
- //# sourceMappingURL=detect.js.map
@@ -8,4 +8,3 @@ export declare function addEnvVariables(projectRoot: string, variables: EnvVaria
8
8
  force?: boolean;
9
9
  }): Promise<void>;
10
10
  export declare function removeEnvVariables(projectRoot: string, keys: string[]): Promise<void>;
11
- //# sourceMappingURL=env-editor.d.ts.map
@@ -89,4 +89,3 @@ async function removeFromEnvFile(filePath, keys) {
89
89
  }
90
90
  await fs_extra_1.default.writeFile(filePath, newLines.join('\n'), 'utf-8');
91
91
  }
92
- //# sourceMappingURL=env-editor.js.map
@@ -4,4 +4,3 @@ export declare function createFile(targetPath: string, content: string, options?
4
4
  }): Promise<void>;
5
5
  export declare function readFile(filePath: string): Promise<string>;
6
6
  export declare function fileExists(filePath: string): Promise<boolean>;
7
- //# sourceMappingURL=files.d.ts.map
@@ -48,4 +48,3 @@ async function readFile(filePath) {
48
48
  async function fileExists(filePath) {
49
49
  return fs_extra_1.default.pathExists(filePath);
50
50
  }
51
- //# sourceMappingURL=files.js.map
@@ -6,4 +6,3 @@ export declare function addToPackageJson(filePath: string, section: 'dependencie
6
6
  export declare function setJsonValue(filePath: string, path: string, value: any, options?: {
7
7
  merge?: boolean;
8
8
  }): Promise<void>;
9
- //# sourceMappingURL=json-editor.d.ts.map
@@ -47,4 +47,3 @@ async function setJsonValue(filePath, path, value, options = {}) {
47
47
  return json;
48
48
  });
49
49
  }
50
- //# sourceMappingURL=json-editor.js.map
@@ -14,4 +14,3 @@ export declare class Logger {
14
14
  footer(): void;
15
15
  }
16
16
  export declare const logger: Logger;
17
- //# sourceMappingURL=logger.d.ts.map
@@ -7,7 +7,9 @@ exports.logger = exports.Logger = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const ora_1 = __importDefault(require("ora"));
9
9
  class Logger {
10
- spinner = null;
10
+ constructor() {
11
+ this.spinner = null;
12
+ }
11
13
  info(message) {
12
14
  console.log(chalk_1.default.blue('ℹ'), message);
13
15
  }
@@ -55,4 +57,3 @@ class Logger {
55
57
  }
56
58
  exports.Logger = Logger;
57
59
  exports.logger = new Logger();
58
- //# sourceMappingURL=logger.js.map
@@ -3,4 +3,3 @@ export declare function detectPackageManager(cwd: string): Promise<PackageManage
3
3
  export declare function installDependencies(cwd: string, pm: PackageManager, dev?: boolean): Promise<void>;
4
4
  export declare function addDependencies(cwd: string, pm: PackageManager, packages: string[], dev?: boolean): Promise<void>;
5
5
  export declare function initGit(cwd: string): Promise<void>;
6
- //# sourceMappingURL=package-manager.d.ts.map
@@ -76,4 +76,3 @@ async function initGit(cwd) {
76
76
  // Don't throw - git init is optional
77
77
  }
78
78
  }
79
- //# sourceMappingURL=package-manager.js.map
@@ -1,3 +1,5 @@
1
1
  import { auth } from '@/lib/auth';
2
+ import { toNextJsHandler } from 'better-auth/next-js';
3
+
4
+ export const { GET, POST } = toNextJsHandler(auth);
2
5
 
3
- export const { GET, POST } = auth.handler;
@@ -1,18 +1,26 @@
1
+ import { prismaAdapter } from '@better-auth/prisma';
1
2
  import { betterAuth } from 'better-auth';
3
+ import { prisma } from './db';
2
4
 
3
5
  export const auth = betterAuth({
4
- secret: process.env.BETTER_AUTH_SECRET!,
5
- baseURL: process.env.BETTER_AUTH_URL!,
6
-
7
- // Add your authentication providers here
8
- // Example: email/password, OAuth (Google, GitHub, etc.)
6
+ database: prismaAdapter(prisma, {
7
+ provider: 'postgresql', // Change to 'mongodb' if using MongoDB
8
+ }),
9
9
  emailAndPassword: {
10
10
  enabled: true,
11
11
  },
12
-
13
- // Uncomment to add database adapter
14
- // database: {
15
- // provider: "pg", // or "mongodb", "mysql"
16
- // url: process.env.DATABASE_URL!,
17
- // },
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
+ },
18
23
  });
24
+
25
+ export type Session = typeof auth.$Infer.Session;
26
+ export type User = typeof auth.$Infer.User;
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "auth",
3
3
  "displayName": "Better Auth (Next.js)",
4
- "description": "Modern authentication with Better Auth for Next.js",
4
+ "description": "Modern authentication with Better Auth for Next.js App Router",
5
5
  "category": "auth",
6
+ "provider": "better-auth",
6
7
  "supportedFrameworks": ["nextjs"],
8
+ "compatibleDatabases": ["prisma-postgresql", "prisma-mongodb"],
7
9
  "dependencies": {
8
- "better-auth": "^1.0.0"
10
+ "better-auth": "^1.1.4",
11
+ "@better-auth/prisma": "^1.1.4"
9
12
  },
10
13
  "envVars": [
11
14
  {
@@ -30,8 +33,8 @@
30
33
  },
31
34
  {
32
35
  "type": "create-file",
33
- "description": "Create Better Auth API route",
34
- "source": "api/auth/[...all]/route.ts",
36
+ "description": "Create Better Auth API route handler",
37
+ "source": "app/api/auth/[...all]/route.ts",
35
38
  "destination": "{{router}}/api/auth/[...all]/route.ts"
36
39
  }
37
40
  ]
@@ -0,0 +1,7 @@
1
+ import { clerkClient, clerkMiddleware, requireAuth } from '@clerk/express';
2
+
3
+ export { clerkMiddleware, requireAuth };
4
+
5
+ export async function getCurrentUser(userId: string) {
6
+ return await clerkClient.users.getUser(userId);
7
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "clerk-express",
3
+ "description": "Clerk Authentication for Express.js",
4
+ "category": "auth",
5
+ "framework": "express",
6
+ "dependencies": {
7
+ "@clerk/express": "^1.4.5"
8
+ },
9
+ "env": {
10
+ "CLERK_PUBLISHABLE_KEY": "pk_test_your_key_here",
11
+ "CLERK_SECRET_KEY": "sk_test_your_key_here"
12
+ },
13
+ "files": [
14
+ {
15
+ "source": "files/lib/auth.ts",
16
+ "destination": "lib/auth.ts"
17
+ }
18
+ ]
19
+ }
@@ -0,0 +1,5 @@
1
+ import { ClerkProvider } from '@clerk/nextjs';
2
+
3
+ export function AuthProvider({ children }: { children: React.ReactNode }) {
4
+ return <ClerkProvider>{children}</ClerkProvider>;
5
+ }
@@ -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
+ };
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "clerk-nextjs",
3
+ "description": "Clerk Authentication for Next.js",
4
+ "category": "auth",
5
+ "framework": "nextjs",
6
+ "dependencies": {
7
+ "@clerk/nextjs": "^6.10.2"
8
+ },
9
+ "env": {
10
+ "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY": "pk_test_your_key_here",
11
+ "CLERK_SECRET_KEY": "sk_test_your_key_here",
12
+ "NEXT_PUBLIC_CLERK_SIGN_IN_URL": "/sign-in",
13
+ "NEXT_PUBLIC_CLERK_SIGN_UP_URL": "/sign-up",
14
+ "NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL": "/",
15
+ "NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL": "/"
16
+ },
17
+ "files": [
18
+ {
19
+ "source": "files/lib/auth-provider.tsx",
20
+ "destination": "lib/auth-provider.tsx"
21
+ },
22
+ {
23
+ "source": "files/middleware.ts",
24
+ "destination": "middleware.ts"
25
+ }
26
+ ]
27
+ }
@@ -0,0 +1,15 @@
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
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "clerk-react",
3
+ "description": "Clerk Authentication for React",
4
+ "category": "auth",
5
+ "framework": "react-vite",
6
+ "dependencies": {
7
+ "@clerk/clerk-react": "^5.19.2"
8
+ },
9
+ "env": {
10
+ "VITE_CLERK_PUBLISHABLE_KEY": "pk_test_your_key_here"
11
+ },
12
+ "files": [
13
+ {
14
+ "source": "files/lib/auth-provider.tsx",
15
+ "destination": "lib/auth-provider.tsx"
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from 'drizzle-kit';
2
+
3
+ export default defineConfig({
4
+ schema: './lib/schema.ts',
5
+ out: './drizzle',
6
+ dialect: 'postgresql',
7
+ dbCredentials: {
8
+ url: process.env.DATABASE_URL!,
9
+ },
10
+ });
@@ -0,0 +1,7 @@
1
+ import { drizzle } from 'drizzle-orm/postgres-js';
2
+ import postgres from 'postgres';
3
+
4
+ const connectionString = process.env.DATABASE_URL!;
5
+
6
+ export const client = postgres(connectionString, { prepare: false });
7
+ export const db = drizzle(client);
@@ -0,0 +1,8 @@
1
+ import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';
2
+
3
+ export const users = pgTable('users', {
4
+ id: serial('id').primaryKey(),
5
+ name: text('name').notNull(),
6
+ email: text('email').notNull().unique(),
7
+ createdAt: timestamp('created_at').defaultNow(),
8
+ });
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "drizzle-postgresql",
3
+ "description": "Drizzle ORM with PostgreSQL",
4
+ "category": "database",
5
+ "dependencies": {
6
+ "drizzle-orm": "^0.36.4",
7
+ "postgres": "^3.4.5"
8
+ },
9
+ "devDependencies": {
10
+ "drizzle-kit": "^0.28.1"
11
+ },
12
+ "scripts": {
13
+ "db:generate": "drizzle-kit generate",
14
+ "db:migrate": "drizzle-kit migrate",
15
+ "db:studio": "drizzle-kit studio"
16
+ },
17
+ "env": {
18
+ "DATABASE_URL": "postgresql://postgres:password@localhost:5432/myapp"
19
+ },
20
+ "files": [
21
+ {
22
+ "source": "files/lib/db.ts",
23
+ "destination": "lib/db.ts"
24
+ },
25
+ {
26
+ "source": "files/lib/schema.ts",
27
+ "destination": "lib/schema.ts"
28
+ },
29
+ {
30
+ "source": "files/drizzle.config.ts",
31
+ "destination": "drizzle.config.ts"
32
+ }
33
+ ]
34
+ }
@@ -0,0 +1,40 @@
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;
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "mongoose-mongodb",
3
+ "description": "Mongoose ODM for MongoDB",
4
+ "category": "database",
5
+ "dependencies": {
6
+ "mongoose": "^8.8.4"
7
+ },
8
+ "env": {
9
+ "MONGODB_URI": "mongodb://localhost:27017/myapp"
10
+ },
11
+ "files": [
12
+ {
13
+ "source": "files/lib/db.ts",
14
+ "destination": "lib/db.ts"
15
+ }
16
+ ]
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stackkit-cli",
3
- "version": "0.3.1",
3
+ "version": "0.4.1",
4
4
  "description": "CLI for StackKit - Production-ready project generator and module system",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -18,7 +18,8 @@
18
18
  },
19
19
  "scripts": {
20
20
  "dev": "tsc --watch",
21
- "build": "tsc && cp -r ../../templates . && cp -r ../../modules .",
21
+ "build": "npm run clean && tsc && npm run copy-assets",
22
+ "copy-assets": "cp -r ../../templates . && cp -r ../../modules .",
22
23
  "clean": "rm -rf dist templates modules",
23
24
  "typecheck": "tsc --noEmit",
24
25
  "lint": "eslint src --ext .ts",
@@ -36,7 +37,7 @@
36
37
  "templates",
37
38
  "modules"
38
39
  ],
39
- "author": "Your Name",
40
+ "author": "Tariqul Islam",
40
41
  "license": "MIT",
41
42
  "dependencies": {
42
43
  "commander": "^12.0.0",
@@ -3,9 +3,9 @@
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
5
  "scripts": {
6
- "dev": "tsx watch src/index.ts",
6
+ "dev": "tsx watch src/server.ts",
7
7
  "build": "tsc",
8
- "start": "node dist/index.js",
8
+ "start": "node dist/server.js",
9
9
  "lint": "eslint src"
10
10
  },
11
11
  "dependencies": {
@@ -20,4 +20,4 @@
20
20
  "tsx": "^4.19.2",
21
21
  "typescript": "^5.7.2"
22
22
  }
23
- }
23
+ }