stackkit-cli 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +19 -17
  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/nextjs-base/README.md +36 -0
  44. package/templates/bases/nextjs-base/app/favicon.ico +0 -0
  45. package/templates/bases/nextjs-base/app/globals.css +26 -3
  46. package/templates/bases/nextjs-base/app/layout.tsx +21 -6
  47. package/templates/bases/nextjs-base/app/page.tsx +61 -4
  48. package/templates/bases/nextjs-base/eslint.config.mjs +18 -0
  49. package/templates/bases/nextjs-base/next.config.ts +4 -2
  50. package/templates/bases/nextjs-base/package-lock.json +6538 -0
  51. package/templates/bases/nextjs-base/package.json +12 -10
  52. package/templates/bases/nextjs-base/postcss.config.mjs +7 -0
  53. package/templates/bases/nextjs-base/public/file.svg +1 -0
  54. package/templates/bases/nextjs-base/public/globe.svg +1 -0
  55. package/templates/bases/nextjs-base/public/next.svg +1 -0
  56. package/templates/bases/nextjs-base/public/vercel.svg +1 -0
  57. package/templates/bases/nextjs-base/public/window.svg +1 -0
  58. package/templates/bases/nextjs-base/template.json +12 -1
  59. package/templates/bases/nextjs-base/tsconfig.json +9 -2
  60. package/templates/bases/react-vite-base/index.html +13 -0
  61. package/templates/bases/react-vite-base/package.json +27 -0
  62. package/templates/bases/react-vite-base/src/App.css +14 -0
  63. package/templates/bases/react-vite-base/src/App.tsx +23 -0
  64. package/templates/bases/react-vite-base/src/index.css +68 -0
  65. package/templates/bases/react-vite-base/src/main.tsx +10 -0
  66. package/templates/bases/react-vite-base/src/vite-env.d.ts +1 -0
  67. package/templates/bases/react-vite-base/template.json +5 -0
  68. package/templates/bases/react-vite-base/tsconfig.json +21 -0
  69. package/templates/bases/react-vite-base/vite.config.ts +7 -0
  70. package/dist/commands/add.d.ts.map +0 -1
  71. package/dist/commands/add.js.map +0 -1
  72. package/dist/commands/init.d.ts.map +0 -1
  73. package/dist/commands/init.js.map +0 -1
  74. package/dist/commands/list.d.ts.map +0 -1
  75. package/dist/commands/list.js.map +0 -1
  76. package/dist/index.d.ts.map +0 -1
  77. package/dist/index.js.map +0 -1
  78. package/dist/types/index.d.ts.map +0 -1
  79. package/dist/types/index.js.map +0 -1
  80. package/dist/utils/code-inject.d.ts.map +0 -1
  81. package/dist/utils/code-inject.js.map +0 -1
  82. package/dist/utils/detect.d.ts.map +0 -1
  83. package/dist/utils/detect.js.map +0 -1
  84. package/dist/utils/env-editor.d.ts.map +0 -1
  85. package/dist/utils/env-editor.js.map +0 -1
  86. package/dist/utils/files.d.ts.map +0 -1
  87. package/dist/utils/files.js.map +0 -1
  88. package/dist/utils/json-editor.d.ts.map +0 -1
  89. package/dist/utils/json-editor.js.map +0 -1
  90. package/dist/utils/logger.d.ts.map +0 -1
  91. package/dist/utils/logger.js.map +0 -1
  92. package/dist/utils/package-manager.d.ts.map +0 -1
  93. package/dist/utils/package-manager.js.map +0 -1
  94. package/templates/auth/authjs-express/config.json +0 -20
  95. package/templates/auth/authjs-express/files/lib/auth.ts +0 -43
  96. package/templates/auth/authjs-express/files/routes/auth.ts +0 -12
  97. package/templates/auth/authjs-express/lib/auth.ts +0 -43
  98. package/templates/auth/authjs-express/module.json +0 -39
  99. package/templates/auth/authjs-express/routes/auth.ts +0 -12
  100. package/templates/auth/authjs-nextjs/app/api/auth/[...nextauth]/route.ts +0 -3
  101. package/templates/auth/authjs-nextjs/config.json +0 -19
  102. package/templates/auth/authjs-nextjs/files/api/auth/[...nextauth]/route.ts +0 -3
  103. package/templates/auth/authjs-nextjs/files/lib/auth.ts +0 -45
  104. package/templates/auth/authjs-nextjs/lib/auth.ts +0 -45
  105. package/templates/auth/authjs-nextjs/module.json +0 -38
  106. package/templates/auth/better-auth-express/config.json +0 -18
  107. package/templates/auth/better-auth-express/src/lib/auth.ts +0 -12
  108. package/templates/auth/better-auth-express/src/routes/auth.ts +0 -10
  109. package/templates/auth/better-auth-nextjs/app/api/auth/[...all]/route.ts +0 -4
  110. package/templates/auth/better-auth-nextjs/config.json +0 -18
  111. package/templates/auth/better-auth-nextjs/lib/auth.ts +0 -14
  112. package/templates/auth/better-auth-react/config.json +0 -15
  113. package/templates/auth/better-auth-react/files/lib/auth-client.ts +0 -9
  114. package/templates/auth/better-auth-react/lib/auth-client.ts +0 -9
  115. package/templates/auth/better-auth-react/module.json +0 -26
  116. package/templates/auth/nextauth/app/api/auth/[...nextauth]/route.ts +0 -3
  117. package/templates/auth/nextauth/config.json +0 -18
  118. package/templates/auth/nextauth/lib/auth.ts +0 -31
  119. package/templates/bases/nextjs-base/.eslintrc.json +0 -3
  120. package/templates/databases/prisma-mongodb/config.json +0 -21
  121. package/templates/databases/prisma-mongodb/lib/db.ts +0 -13
  122. package/templates/databases/prisma-mongodb/prisma/schema.prisma +0 -16
  123. package/templates/databases/prisma-postgresql/config.json +0 -22
  124. package/templates/databases/prisma-postgresql/lib/db.ts +0 -13
  125. package/templates/databases/prisma-postgresql/prisma/schema.prisma +0 -16
package/README.md CHANGED
@@ -1,33 +1,35 @@
1
1
  # stackkit-cli
2
2
 
3
- Main CLI package for StackKit - production-ready project generator with modular architecture.
3
+ Add modules to existing projects.
4
4
 
5
- [![npm](https://img.shields.io/npm/v/stackkit-cli)](https://www.npmjs.com/package/stackkit-cli)
6
-
7
- ## Installation
5
+ ## Usage
8
6
 
9
7
  ```bash
10
- # Global installation
11
- npm install -g stackkit-cli
8
+ # Add authentication
9
+ npx stackkit-cli add auth
10
+
11
+ # Add database
12
+ npx stackkit-cli add database --provider prisma-postgresql
12
13
 
13
- # Or use directly with npx
14
- npx stackkit-cli@latest init my-app
14
+ # List available modules
15
+ npx stackkit-cli list
15
16
  ```
16
17
 
17
- ## Usage
18
+ ## Commands
18
19
 
19
- ```bash
20
- # Create new project
21
- npx stackkit-cli init my-app
20
+ - `add <module>` - Add module to your project
21
+ - `list` - List available modules
22
+ - `init` - Create new project (same as create-stackkit-app)
22
23
 
23
- # List available resources
24
- npx stackkit-cli list
24
+ ## Development
25
25
 
26
- # Add modules to existing project
27
- npx stackkit-cli add auth
26
+ ```bash
27
+ pnpm install
28
+ pnpm build
29
+ npx . add auth
28
30
  ```
29
31
 
30
- ## Commands
32
+ See [main README](../../README.md) for full documentation.
31
33
 
32
34
  ### `init [project-name]`
33
35
 
@@ -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.0",
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",
@@ -55,4 +56,4 @@
55
56
  "@types/validate-npm-package-name": "^4.0.2",
56
57
  "typescript": "^5.3.3"
57
58
  }
58
- }
59
+ }
@@ -0,0 +1,36 @@
1
+ This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
2
+
3
+ ## Getting Started
4
+
5
+ First, run the development server:
6
+
7
+ ```bash
8
+ npm run dev
9
+ # or
10
+ yarn dev
11
+ # or
12
+ pnpm dev
13
+ # or
14
+ bun dev
15
+ ```
16
+
17
+ Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18
+
19
+ You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20
+
21
+ This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
22
+
23
+ ## Learn More
24
+
25
+ To learn more about Next.js, take a look at the following resources:
26
+
27
+ - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28
+ - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29
+
30
+ You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31
+
32
+ ## Deploy on Vercel
33
+
34
+ The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35
+
36
+ Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
@@ -1,3 +1,26 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
1
+ @import "tailwindcss";
2
+
3
+ :root {
4
+ --background: #ffffff;
5
+ --foreground: #171717;
6
+ }
7
+
8
+ @theme inline {
9
+ --color-background: var(--background);
10
+ --color-foreground: var(--foreground);
11
+ --font-sans: var(--font-geist-sans);
12
+ --font-mono: var(--font-geist-mono);
13
+ }
14
+
15
+ @media (prefers-color-scheme: dark) {
16
+ :root {
17
+ --background: #0a0a0a;
18
+ --foreground: #ededed;
19
+ }
20
+ }
21
+
22
+ body {
23
+ background: var(--background);
24
+ color: var(--foreground);
25
+ font-family: Arial, Helvetica, sans-serif;
26
+ }