stackkit-cli 0.3.0 → 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.
- package/README.md +25 -17
- package/dist/commands/add.d.ts +0 -1
- package/dist/commands/add.js +12 -5
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.js +0 -1
- package/dist/commands/list.d.ts +0 -1
- package/dist/commands/list.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +0 -1
- package/dist/utils/code-inject.d.ts +0 -1
- package/dist/utils/code-inject.js +1 -2
- package/dist/utils/detect.d.ts +0 -1
- package/dist/utils/detect.js +45 -17
- package/dist/utils/env-editor.d.ts +0 -1
- package/dist/utils/env-editor.js +2 -3
- package/dist/utils/files.d.ts +0 -1
- package/dist/utils/files.js +1 -2
- package/dist/utils/json-editor.d.ts +0 -1
- package/dist/utils/json-editor.js +0 -1
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/logger.js +3 -2
- package/dist/utils/package-manager.d.ts +0 -1
- package/dist/utils/package-manager.js +0 -1
- package/modules/auth/authjs-express/files/lib/auth.ts +40 -0
- package/modules/auth/authjs-express/files/routes/auth.ts +12 -0
- package/modules/auth/authjs-express/module.json +39 -0
- package/modules/auth/authjs-nextjs/files/lib/auth.ts +43 -0
- package/modules/auth/authjs-nextjs/module.json +38 -0
- package/modules/auth/better-auth-express/files/lib/auth.ts +16 -0
- package/modules/auth/better-auth-express/files/routes/auth.ts +12 -0
- package/modules/auth/better-auth-express/module.json +38 -0
- package/{templates/auth/better-auth-nextjs/app → modules/auth/better-auth-nextjs/files}/api/auth/[...all]/route.ts +1 -0
- package/modules/auth/better-auth-nextjs/files/lib/auth.ts +26 -0
- package/modules/auth/better-auth-nextjs/module.json +41 -0
- package/modules/auth/better-auth-react/files/lib/auth-client.ts +9 -0
- package/modules/auth/better-auth-react/module.json +26 -0
- package/modules/auth/clerk-express/files/lib/auth.ts +7 -0
- package/modules/auth/clerk-express/module.json +19 -0
- package/modules/auth/clerk-nextjs/files/lib/auth-provider.tsx +5 -0
- package/modules/auth/clerk-nextjs/files/middleware.ts +9 -0
- package/modules/auth/clerk-nextjs/module.json +27 -0
- package/modules/auth/clerk-react/files/lib/auth-provider.tsx +15 -0
- package/modules/auth/clerk-react/module.json +18 -0
- package/modules/database/drizzle-postgresql/files/drizzle.config.ts +10 -0
- package/modules/database/drizzle-postgresql/files/lib/db.ts +7 -0
- package/modules/database/drizzle-postgresql/files/lib/schema.ts +8 -0
- package/modules/database/drizzle-postgresql/module.json +34 -0
- package/modules/database/mongoose-mongodb/files/lib/db.ts +40 -0
- package/modules/database/mongoose-mongodb/module.json +17 -0
- package/{templates/databases/prisma-mongodb → modules/database/prisma-mongodb/files}/lib/db.ts +2 -6
- package/{templates/databases/prisma-mongodb → modules/database/prisma-mongodb/files}/prisma/schema.prisma +1 -0
- package/modules/database/prisma-mongodb/module.json +36 -0
- package/{templates/databases/prisma-postgresql → modules/database/prisma-postgresql/files}/lib/db.ts +2 -6
- package/{templates/databases/prisma-postgresql → modules/database/prisma-postgresql/files}/prisma/schema.prisma +1 -0
- package/modules/database/prisma-postgresql/module.json +36 -0
- package/package.json +4 -3
- package/templates/bases/nextjs-base/README.md +36 -0
- package/templates/bases/nextjs-base/app/favicon.ico +0 -0
- package/templates/bases/nextjs-base/app/globals.css +26 -3
- package/templates/bases/nextjs-base/app/layout.tsx +21 -6
- package/templates/bases/nextjs-base/app/page.tsx +61 -4
- package/templates/bases/nextjs-base/eslint.config.mjs +18 -0
- package/templates/bases/nextjs-base/next.config.ts +4 -2
- package/templates/bases/nextjs-base/package-lock.json +6538 -0
- package/templates/bases/nextjs-base/package.json +12 -10
- package/templates/bases/nextjs-base/postcss.config.mjs +7 -0
- package/templates/bases/nextjs-base/public/file.svg +1 -0
- package/templates/bases/nextjs-base/public/globe.svg +1 -0
- package/templates/bases/nextjs-base/public/next.svg +1 -0
- package/templates/bases/nextjs-base/public/vercel.svg +1 -0
- package/templates/bases/nextjs-base/public/window.svg +1 -0
- package/templates/bases/nextjs-base/template.json +12 -1
- package/templates/bases/nextjs-base/tsconfig.json +9 -2
- package/templates/bases/react-vite-base/index.html +13 -0
- package/templates/bases/react-vite-base/package.json +27 -0
- package/templates/bases/react-vite-base/src/App.css +14 -0
- package/templates/bases/react-vite-base/src/App.tsx +23 -0
- package/templates/bases/react-vite-base/src/index.css +68 -0
- package/templates/bases/react-vite-base/src/main.tsx +10 -0
- package/templates/bases/react-vite-base/src/vite-env.d.ts +1 -0
- package/templates/bases/react-vite-base/template.json +5 -0
- package/templates/bases/react-vite-base/tsconfig.json +21 -0
- package/templates/bases/react-vite-base/vite.config.ts +7 -0
- package/dist/commands/add.d.ts.map +0 -1
- package/dist/commands/add.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/list.d.ts.map +0 -1
- package/dist/commands/list.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/utils/code-inject.d.ts.map +0 -1
- package/dist/utils/code-inject.js.map +0 -1
- package/dist/utils/detect.d.ts.map +0 -1
- package/dist/utils/detect.js.map +0 -1
- package/dist/utils/env-editor.d.ts.map +0 -1
- package/dist/utils/env-editor.js.map +0 -1
- package/dist/utils/files.d.ts.map +0 -1
- package/dist/utils/files.js.map +0 -1
- package/dist/utils/json-editor.d.ts.map +0 -1
- package/dist/utils/json-editor.js.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/package-manager.d.ts.map +0 -1
- package/dist/utils/package-manager.js.map +0 -1
- package/templates/auth/better-auth-express/config.json +0 -18
- package/templates/auth/better-auth-express/src/lib/auth.ts +0 -12
- package/templates/auth/better-auth-express/src/routes/auth.ts +0 -10
- package/templates/auth/better-auth-nextjs/config.json +0 -18
- package/templates/auth/better-auth-nextjs/lib/auth.ts +0 -14
- package/templates/auth/nextauth/config.json +0 -18
- package/templates/auth/nextauth/lib/auth.ts +0 -31
- package/templates/bases/nextjs-base/.eslintrc.json +0 -3
- package/templates/databases/prisma-mongodb/config.json +0 -21
- package/templates/databases/prisma-postgresql/config.json +0 -22
- package/templates/next-prisma-postgres-shadcn/.env.example +0 -5
- package/templates/next-prisma-postgres-shadcn/.eslintrc.json +0 -7
- package/templates/next-prisma-postgres-shadcn/.prettierrc +0 -8
- package/templates/next-prisma-postgres-shadcn/README.md +0 -85
- package/templates/next-prisma-postgres-shadcn/app/api/health/route.ts +0 -25
- package/templates/next-prisma-postgres-shadcn/app/globals.css +0 -1
- package/templates/next-prisma-postgres-shadcn/app/layout.tsx +0 -22
- package/templates/next-prisma-postgres-shadcn/app/page.tsx +0 -29
- package/templates/next-prisma-postgres-shadcn/lib/db.ts +0 -14
- package/templates/next-prisma-postgres-shadcn/lib/env.ts +0 -15
- package/templates/next-prisma-postgres-shadcn/next.config.ts +0 -7
- package/templates/next-prisma-postgres-shadcn/package.json +0 -32
- package/templates/next-prisma-postgres-shadcn/prisma/schema.prisma +0 -20
- package/templates/next-prisma-postgres-shadcn/public/.gitkeep +0 -1
- package/templates/next-prisma-postgres-shadcn/template.json +0 -18
- package/templates/next-prisma-postgres-shadcn/tsconfig.json +0 -32
- /package/{templates/auth/nextauth/app → modules/auth/authjs-nextjs/files}/api/auth/[...nextauth]/route.ts +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "auth",
|
|
3
|
+
"displayName": "Better Auth (Express)",
|
|
4
|
+
"description": "Modern authentication with Better Auth for Express",
|
|
5
|
+
"category": "auth",
|
|
6
|
+
"supportedFrameworks": ["express"],
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"better-auth": "^1.0.0"
|
|
9
|
+
},
|
|
10
|
+
"envVars": [
|
|
11
|
+
{
|
|
12
|
+
"key": "BETTER_AUTH_SECRET",
|
|
13
|
+
"value": "",
|
|
14
|
+
"description": "Secret key for Better Auth. Generate with: openssl rand -base64 32",
|
|
15
|
+
"required": true
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"key": "BETTER_AUTH_URL",
|
|
19
|
+
"value": "http://localhost:3000",
|
|
20
|
+
"description": "Base URL of your application (change in production)",
|
|
21
|
+
"required": true
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"patches": [
|
|
25
|
+
{
|
|
26
|
+
"type": "create-file",
|
|
27
|
+
"description": "Create Better Auth configuration",
|
|
28
|
+
"source": "lib/auth.ts",
|
|
29
|
+
"destination": "src/lib/auth.ts"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "create-file",
|
|
33
|
+
"description": "Create auth routes",
|
|
34
|
+
"source": "routes/auth.ts",
|
|
35
|
+
"destination": "src/routes/auth.ts"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { prismaAdapter } from '@better-auth/prisma';
|
|
2
|
+
import { betterAuth } from 'better-auth';
|
|
3
|
+
import { prisma } from './db';
|
|
4
|
+
|
|
5
|
+
export const auth = betterAuth({
|
|
6
|
+
database: prismaAdapter(prisma, {
|
|
7
|
+
provider: 'postgresql', // Change to 'mongodb' if using MongoDB
|
|
8
|
+
}),
|
|
9
|
+
emailAndPassword: {
|
|
10
|
+
enabled: true,
|
|
11
|
+
},
|
|
12
|
+
socialProviders: {
|
|
13
|
+
// Uncomment to add OAuth providers
|
|
14
|
+
// google: {
|
|
15
|
+
// clientId: process.env.GOOGLE_CLIENT_ID!,
|
|
16
|
+
// clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
|
|
17
|
+
// },
|
|
18
|
+
// github: {
|
|
19
|
+
// clientId: process.env.GITHUB_CLIENT_ID!,
|
|
20
|
+
// clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
21
|
+
// },
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export type Session = typeof auth.$Infer.Session;
|
|
26
|
+
export type User = typeof auth.$Infer.User;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "auth",
|
|
3
|
+
"displayName": "Better Auth (Next.js)",
|
|
4
|
+
"description": "Modern authentication with Better Auth for Next.js App Router",
|
|
5
|
+
"category": "auth",
|
|
6
|
+
"provider": "better-auth",
|
|
7
|
+
"supportedFrameworks": ["nextjs"],
|
|
8
|
+
"compatibleDatabases": ["prisma-postgresql", "prisma-mongodb"],
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"better-auth": "^1.1.4",
|
|
11
|
+
"@better-auth/prisma": "^1.1.4"
|
|
12
|
+
},
|
|
13
|
+
"envVars": [
|
|
14
|
+
{
|
|
15
|
+
"key": "BETTER_AUTH_SECRET",
|
|
16
|
+
"value": "",
|
|
17
|
+
"description": "Secret key for Better Auth. Generate with: openssl rand -base64 32",
|
|
18
|
+
"required": true
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"key": "BETTER_AUTH_URL",
|
|
22
|
+
"value": "http://localhost:3000",
|
|
23
|
+
"description": "Base URL of your application (change in production)",
|
|
24
|
+
"required": true
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"patches": [
|
|
28
|
+
{
|
|
29
|
+
"type": "create-file",
|
|
30
|
+
"description": "Create Better Auth configuration",
|
|
31
|
+
"source": "lib/auth.ts",
|
|
32
|
+
"destination": "{{lib}}/auth.ts"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"type": "create-file",
|
|
36
|
+
"description": "Create Better Auth API route handler",
|
|
37
|
+
"source": "app/api/auth/[...all]/route.ts",
|
|
38
|
+
"destination": "{{router}}/api/auth/[...all]/route.ts"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createAuthClient } from 'better-auth/react';
|
|
2
|
+
|
|
3
|
+
export const authClient = createAuthClient({
|
|
4
|
+
/** The base URL of the server (optional if you're using the same domain) */
|
|
5
|
+
baseURL: import.meta.env.VITE_AUTH_URL || 'http://localhost:3000',
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// Export specific methods for convenience
|
|
9
|
+
export const { signIn, signUp, signOut, useSession } = authClient;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "auth",
|
|
3
|
+
"displayName": "Better Auth (React)",
|
|
4
|
+
"description": "Client-side authentication with Better Auth for React",
|
|
5
|
+
"category": "auth",
|
|
6
|
+
"supportedFrameworks": ["react", "react-vite"],
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"better-auth": "^1.0.0"
|
|
9
|
+
},
|
|
10
|
+
"envVars": [
|
|
11
|
+
{
|
|
12
|
+
"key": "VITE_AUTH_URL",
|
|
13
|
+
"value": "http://localhost:3000",
|
|
14
|
+
"description": "Base URL of your auth server (optional if same domain)",
|
|
15
|
+
"required": false
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"patches": [
|
|
19
|
+
{
|
|
20
|
+
"type": "create-file",
|
|
21
|
+
"description": "Create Better Auth client configuration",
|
|
22
|
+
"source": "lib/auth-client.ts",
|
|
23
|
+
"destination": "src/lib/auth-client.ts"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -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,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,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/{templates/databases/prisma-mongodb → modules/database/prisma-mongodb/files}/lib/db.ts
RENAMED
|
@@ -4,10 +4,6 @@ const globalForPrisma = globalThis as unknown as {
|
|
|
4
4
|
prisma: PrismaClient | undefined;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
export const prisma
|
|
8
|
-
globalForPrisma.prisma ??
|
|
9
|
-
new PrismaClient({
|
|
10
|
-
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
|
|
11
|
-
});
|
|
7
|
+
export const db = globalForPrisma.prisma ?? new PrismaClient();
|
|
12
8
|
|
|
13
|
-
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma =
|
|
9
|
+
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = db;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "database",
|
|
3
|
+
"displayName": "Prisma + MongoDB",
|
|
4
|
+
"description": "Add Prisma ORM with MongoDB database",
|
|
5
|
+
"category": "database",
|
|
6
|
+
"supportedFrameworks": ["nextjs", "express"],
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@prisma/client": "^6.1.0"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"prisma": "^6.1.0"
|
|
12
|
+
},
|
|
13
|
+
"envVars": [
|
|
14
|
+
{
|
|
15
|
+
"key": "DATABASE_URL",
|
|
16
|
+
"value": "mongodb://localhost:27017/mydb",
|
|
17
|
+
"description": "MongoDB connection URL",
|
|
18
|
+
"required": true
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"patches": [
|
|
22
|
+
{
|
|
23
|
+
"type": "create-file",
|
|
24
|
+
"description": "Create Prisma schema for MongoDB",
|
|
25
|
+
"source": "prisma/schema.prisma",
|
|
26
|
+
"destination": "prisma/schema.prisma"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"type": "create-file",
|
|
30
|
+
"description": "Create Prisma client singleton",
|
|
31
|
+
"source": "lib/db.ts",
|
|
32
|
+
"destination": "{{lib}}/db.ts"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"postInstall": ["npx prisma generate"]
|
|
36
|
+
}
|
package/{templates/databases/prisma-postgresql → modules/database/prisma-postgresql/files}/lib/db.ts
RENAMED
|
@@ -4,10 +4,6 @@ const globalForPrisma = globalThis as unknown as {
|
|
|
4
4
|
prisma: PrismaClient | undefined;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
export const prisma
|
|
8
|
-
globalForPrisma.prisma ??
|
|
9
|
-
new PrismaClient({
|
|
10
|
-
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
|
|
11
|
-
});
|
|
7
|
+
export const db = globalForPrisma.prisma ?? new PrismaClient();
|
|
12
8
|
|
|
13
|
-
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma =
|
|
9
|
+
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = db;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "database",
|
|
3
|
+
"displayName": "Prisma + PostgreSQL",
|
|
4
|
+
"description": "Add Prisma ORM with PostgreSQL database",
|
|
5
|
+
"category": "database",
|
|
6
|
+
"supportedFrameworks": ["nextjs", "express"],
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@prisma/client": "^6.1.0"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"prisma": "^6.1.0"
|
|
12
|
+
},
|
|
13
|
+
"envVars": [
|
|
14
|
+
{
|
|
15
|
+
"key": "DATABASE_URL",
|
|
16
|
+
"value": "postgresql://user:password@localhost:5432/mydb?schema=public",
|
|
17
|
+
"description": "PostgreSQL database connection URL",
|
|
18
|
+
"required": true
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"patches": [
|
|
22
|
+
{
|
|
23
|
+
"type": "create-file",
|
|
24
|
+
"description": "Create Prisma schema",
|
|
25
|
+
"source": "prisma/schema.prisma",
|
|
26
|
+
"destination": "prisma/schema.prisma"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"type": "create-file",
|
|
30
|
+
"description": "Create Prisma client singleton",
|
|
31
|
+
"source": "lib/db.ts",
|
|
32
|
+
"destination": "{{lib}}/db.ts"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"postInstall": ["npx prisma generate"]
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stackkit-cli",
|
|
3
|
-
"version": "0.
|
|
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,11 +18,12 @@
|
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"dev": "tsc --watch",
|
|
21
|
-
"build": "tsc",
|
|
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",
|
|
25
|
-
"prepublishOnly": "npm run build
|
|
26
|
+
"prepublishOnly": "npm run build"
|
|
26
27
|
},
|
|
27
28
|
"keywords": [
|
|
28
29
|
"cli",
|
|
@@ -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.
|
|
Binary file
|
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
@
|
|
2
|
-
|
|
3
|
-
|
|
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
|
+
}
|
|
@@ -1,19 +1,34 @@
|
|
|
1
|
-
import type { Metadata } from
|
|
2
|
-
import
|
|
1
|
+
import type { Metadata } from "next";
|
|
2
|
+
import { Geist, Geist_Mono } from "next/font/google";
|
|
3
|
+
import "./globals.css";
|
|
4
|
+
|
|
5
|
+
const geistSans = Geist({
|
|
6
|
+
variable: "--font-geist-sans",
|
|
7
|
+
subsets: ["latin"],
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const geistMono = Geist_Mono({
|
|
11
|
+
variable: "--font-geist-mono",
|
|
12
|
+
subsets: ["latin"],
|
|
13
|
+
});
|
|
3
14
|
|
|
4
15
|
export const metadata: Metadata = {
|
|
5
|
-
title:
|
|
6
|
-
description:
|
|
16
|
+
title: "Create Next App",
|
|
17
|
+
description: "Generated by create next app",
|
|
7
18
|
};
|
|
8
19
|
|
|
9
20
|
export default function RootLayout({
|
|
10
21
|
children,
|
|
11
22
|
}: Readonly<{
|
|
12
|
-
children: React.
|
|
23
|
+
children: React.ReactNode;
|
|
13
24
|
}>) {
|
|
14
25
|
return (
|
|
15
26
|
<html lang="en">
|
|
16
|
-
<body
|
|
27
|
+
<body
|
|
28
|
+
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
|
29
|
+
>
|
|
30
|
+
{children}
|
|
31
|
+
</body>
|
|
17
32
|
</html>
|
|
18
33
|
);
|
|
19
34
|
}
|