stackkit-cli 0.2.0 → 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.
- package/package.json +2 -2
- package/templates/auth/better-auth-express/config.json +18 -0
- package/templates/auth/better-auth-express/src/lib/auth.ts +12 -0
- package/templates/auth/better-auth-express/src/routes/auth.ts +10 -0
- package/templates/auth/better-auth-nextjs/app/api/auth/[...all]/route.ts +4 -0
- package/templates/auth/better-auth-nextjs/config.json +18 -0
- package/templates/auth/better-auth-nextjs/lib/auth.ts +14 -0
- package/templates/auth/nextauth/app/api/auth/[...nextauth]/route.ts +3 -0
- package/templates/auth/nextauth/config.json +18 -0
- package/templates/auth/nextauth/lib/auth.ts +31 -0
- package/templates/bases/express-base/.env.example +2 -0
- package/templates/bases/express-base/package.json +23 -0
- package/templates/bases/express-base/src/index.ts +27 -0
- package/templates/bases/express-base/template.json +7 -0
- package/templates/bases/express-base/tsconfig.json +17 -0
- package/templates/bases/nextjs-base/.eslintrc.json +3 -0
- package/templates/bases/nextjs-base/app/globals.css +3 -0
- package/templates/bases/nextjs-base/app/layout.tsx +19 -0
- package/templates/bases/nextjs-base/app/page.tsx +8 -0
- package/templates/bases/nextjs-base/next.config.ts +5 -0
- package/templates/bases/nextjs-base/package.json +24 -0
- package/templates/bases/nextjs-base/template.json +7 -0
- package/templates/bases/nextjs-base/tsconfig.json +27 -0
- package/templates/databases/prisma-mongodb/config.json +21 -0
- package/templates/databases/prisma-mongodb/lib/db.ts +13 -0
- package/templates/databases/prisma-mongodb/prisma/schema.prisma +16 -0
- package/templates/databases/prisma-postgresql/config.json +22 -0
- package/templates/databases/prisma-postgresql/lib/db.ts +13 -0
- package/templates/databases/prisma-postgresql/prisma/schema.prisma +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stackkit-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "CLI for StackKit - Production-ready project generator and module system",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -55,4 +55,4 @@
|
|
|
55
55
|
"@types/validate-npm-package-name": "^4.0.2",
|
|
56
56
|
"typescript": "^5.3.3"
|
|
57
57
|
}
|
|
58
|
-
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "better-auth-express",
|
|
3
|
+
"displayName": "Better Auth (Express)",
|
|
4
|
+
"auth": "better-auth",
|
|
5
|
+
"compatibleWith": {
|
|
6
|
+
"frameworks": ["express"],
|
|
7
|
+
"databases": ["prisma-postgresql", "prisma-mongodb"]
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"better-auth": "^1.1.4",
|
|
11
|
+
"@better-auth/prisma": "^1.1.4"
|
|
12
|
+
},
|
|
13
|
+
"env": {
|
|
14
|
+
"BETTER_AUTH_SECRET": "your-secret-here",
|
|
15
|
+
"BETTER_AUTH_URL": "http://localhost:3000"
|
|
16
|
+
},
|
|
17
|
+
"files": ["src/lib/auth.ts", "src/routes/auth.ts"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
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',
|
|
8
|
+
}),
|
|
9
|
+
emailAndPassword: {
|
|
10
|
+
enabled: true,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "better-auth-nextjs",
|
|
3
|
+
"displayName": "Better Auth (Next.js)",
|
|
4
|
+
"auth": "better-auth",
|
|
5
|
+
"compatibleWith": {
|
|
6
|
+
"frameworks": ["nextjs"],
|
|
7
|
+
"databases": ["prisma-postgresql", "prisma-mongodb"]
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"better-auth": "^1.1.4",
|
|
11
|
+
"@better-auth/prisma": "^1.1.4"
|
|
12
|
+
},
|
|
13
|
+
"env": {
|
|
14
|
+
"BETTER_AUTH_SECRET": "your-secret-here",
|
|
15
|
+
"BETTER_AUTH_URL": "http://localhost:3000"
|
|
16
|
+
},
|
|
17
|
+
"files": ["lib/auth.ts", "app/api/auth/[...all]/route.ts"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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',
|
|
8
|
+
}),
|
|
9
|
+
emailAndPassword: {
|
|
10
|
+
enabled: true,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type Session = typeof auth.$Infer.Session;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nextauth",
|
|
3
|
+
"displayName": "Auth.js (NextAuth)",
|
|
4
|
+
"auth": "nextauth",
|
|
5
|
+
"compatibleWith": {
|
|
6
|
+
"frameworks": ["nextjs"],
|
|
7
|
+
"databases": ["prisma-postgresql", "prisma-mongodb"]
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"next-auth": "^5.0.0-beta.25",
|
|
11
|
+
"@auth/prisma-adapter": "^2.7.4"
|
|
12
|
+
},
|
|
13
|
+
"env": {
|
|
14
|
+
"AUTH_SECRET": "your-secret-here",
|
|
15
|
+
"NEXTAUTH_URL": "http://localhost:3000"
|
|
16
|
+
},
|
|
17
|
+
"files": ["app/api/auth/[...nextauth]/route.ts", "lib/auth.ts", "middleware.ts"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { prisma } from '@/lib/db';
|
|
2
|
+
import { PrismaAdapter } from '@auth/prisma-adapter';
|
|
3
|
+
import NextAuth from 'next-auth';
|
|
4
|
+
import CredentialsProvider from 'next-auth/providers/credentials';
|
|
5
|
+
|
|
6
|
+
export const { handlers, auth, signIn, signOut } = NextAuth({
|
|
7
|
+
adapter: PrismaAdapter(prisma),
|
|
8
|
+
session: {
|
|
9
|
+
strategy: 'jwt',
|
|
10
|
+
},
|
|
11
|
+
providers: [
|
|
12
|
+
CredentialsProvider({
|
|
13
|
+
name: 'Credentials',
|
|
14
|
+
credentials: {
|
|
15
|
+
email: { label: 'Email', type: 'email' },
|
|
16
|
+
password: { label: 'Password', type: 'password' },
|
|
17
|
+
},
|
|
18
|
+
async authorize(credentials) {
|
|
19
|
+
// Add your authentication logic here
|
|
20
|
+
if (!credentials?.email || !credentials?.password) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
// Replace with your actual user lookup
|
|
24
|
+
return { id: '1', email: credentials.email as string };
|
|
25
|
+
},
|
|
26
|
+
}),
|
|
27
|
+
],
|
|
28
|
+
pages: {
|
|
29
|
+
signIn: '/auth/signin',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-app",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "tsx watch src/index.ts",
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"start": "node dist/index.js",
|
|
9
|
+
"lint": "eslint src"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"express": "^4.21.2",
|
|
13
|
+
"dotenv": "^16.4.7",
|
|
14
|
+
"cors": "^2.8.5"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/express": "^5.0.0",
|
|
18
|
+
"@types/node": "^22.10.5",
|
|
19
|
+
"@types/cors": "^2.8.17",
|
|
20
|
+
"tsx": "^4.19.2",
|
|
21
|
+
"typescript": "^5.7.2"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import express, { Request, Response } from 'express';
|
|
2
|
+
import dotenv from 'dotenv';
|
|
3
|
+
import cors from 'cors';
|
|
4
|
+
|
|
5
|
+
dotenv.config();
|
|
6
|
+
|
|
7
|
+
const app = express();
|
|
8
|
+
const PORT = process.env.PORT || 3000;
|
|
9
|
+
|
|
10
|
+
// Middleware
|
|
11
|
+
app.use(cors());
|
|
12
|
+
app.use(express.json());
|
|
13
|
+
app.use(express.urlencoded({ extended: true }));
|
|
14
|
+
|
|
15
|
+
// Routes
|
|
16
|
+
app.get('/health', (req: Request, res: Response) => {
|
|
17
|
+
res.json({ status: 'ok', timestamp: new Date().toISOString() });
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
app.get('/', (req: Request, res: Response) => {
|
|
21
|
+
res.json({ message: 'Welcome to StackKit API' });
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Start server
|
|
25
|
+
app.listen(PORT, () => {
|
|
26
|
+
console.log(`🚀 Server running on http://localhost:${PORT}`);
|
|
27
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ES2020"],
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"moduleResolution": "node"
|
|
14
|
+
},
|
|
15
|
+
"include": ["src/**/*"],
|
|
16
|
+
"exclude": ["node_modules", "dist"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Metadata } from 'next';
|
|
2
|
+
import './globals.css';
|
|
3
|
+
|
|
4
|
+
export const metadata: Metadata = {
|
|
5
|
+
title: 'StackKit App',
|
|
6
|
+
description: 'Generated by create-stackkit-app',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default function RootLayout({
|
|
10
|
+
children,
|
|
11
|
+
}: Readonly<{
|
|
12
|
+
children: React.Node;
|
|
13
|
+
}>) {
|
|
14
|
+
return (
|
|
15
|
+
<html lang="en">
|
|
16
|
+
<body>{children}</body>
|
|
17
|
+
</html>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default function Home() {
|
|
2
|
+
return (
|
|
3
|
+
<main className="flex min-h-screen flex-col items-center justify-center p-24">
|
|
4
|
+
<h1 className="text-4xl font-bold">Welcome to StackKit</h1>
|
|
5
|
+
<p className="mt-4 text-xl">Your project is ready to go!</p>
|
|
6
|
+
</main>
|
|
7
|
+
);
|
|
8
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-app",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "next dev",
|
|
7
|
+
"build": "next build",
|
|
8
|
+
"start": "next start",
|
|
9
|
+
"lint": "next lint"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"next": "^15.1.6",
|
|
13
|
+
"react": "^19.0.0",
|
|
14
|
+
"react-dom": "^19.0.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/node": "^22.10.5",
|
|
18
|
+
"@types/react": "^19.0.6",
|
|
19
|
+
"@types/react-dom": "^19.0.2",
|
|
20
|
+
"eslint": "^9",
|
|
21
|
+
"eslint-config-next": "^15.1.6",
|
|
22
|
+
"typescript": "^5.7.2"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2017",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"jsx": "preserve",
|
|
15
|
+
"incremental": true,
|
|
16
|
+
"plugins": [
|
|
17
|
+
{
|
|
18
|
+
"name": "next"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"paths": {
|
|
22
|
+
"@/*": ["./*"]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
26
|
+
"exclude": ["node_modules"]
|
|
27
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "prisma-mongodb",
|
|
3
|
+
"displayName": "Prisma + MongoDB",
|
|
4
|
+
"database": "prisma-mongodb",
|
|
5
|
+
"compatibleWith": ["nextjs", "express"],
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@prisma/client": "^6.2.0"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"prisma": "^6.2.0"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"db:generate": "prisma generate",
|
|
14
|
+
"db:push": "prisma db push",
|
|
15
|
+
"db:studio": "prisma studio"
|
|
16
|
+
},
|
|
17
|
+
"env": {
|
|
18
|
+
"DATABASE_URL": "mongodb://localhost:27017/mydb"
|
|
19
|
+
},
|
|
20
|
+
"files": ["prisma/schema.prisma", "lib/db.ts"]
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PrismaClient } from '@prisma/client';
|
|
2
|
+
|
|
3
|
+
const globalForPrisma = globalThis as unknown as {
|
|
4
|
+
prisma: PrismaClient | undefined;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export const prisma =
|
|
8
|
+
globalForPrisma.prisma ??
|
|
9
|
+
new PrismaClient({
|
|
10
|
+
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
generator client {
|
|
2
|
+
provider = "prisma-client-js"
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
datasource db {
|
|
6
|
+
provider = "mongodb"
|
|
7
|
+
url = env("DATABASE_URL")
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
model User {
|
|
11
|
+
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
12
|
+
email String @unique
|
|
13
|
+
name String?
|
|
14
|
+
createdAt DateTime @default(now())
|
|
15
|
+
updatedAt DateTime @updatedAt
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "prisma-postgresql",
|
|
3
|
+
"displayName": "Prisma + PostgreSQL",
|
|
4
|
+
"database": "prisma-postgresql",
|
|
5
|
+
"compatibleWith": ["nextjs", "express"],
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@prisma/client": "^6.2.0"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"prisma": "^6.2.0"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"db:generate": "prisma generate",
|
|
14
|
+
"db:push": "prisma db push",
|
|
15
|
+
"db:migrate": "prisma migrate dev",
|
|
16
|
+
"db:studio": "prisma studio"
|
|
17
|
+
},
|
|
18
|
+
"env": {
|
|
19
|
+
"DATABASE_URL": "postgresql://user:password@localhost:5432/mydb"
|
|
20
|
+
},
|
|
21
|
+
"files": ["prisma/schema.prisma", "lib/db.ts"]
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PrismaClient } from '@prisma/client';
|
|
2
|
+
|
|
3
|
+
const globalForPrisma = globalThis as unknown as {
|
|
4
|
+
prisma: PrismaClient | undefined;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export const prisma =
|
|
8
|
+
globalForPrisma.prisma ??
|
|
9
|
+
new PrismaClient({
|
|
10
|
+
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
generator client {
|
|
2
|
+
provider = "prisma-client-js"
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
datasource db {
|
|
6
|
+
provider = "postgresql"
|
|
7
|
+
url = env("DATABASE_URL")
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
model User {
|
|
11
|
+
id String @id @default(cuid())
|
|
12
|
+
email String @unique
|
|
13
|
+
name String?
|
|
14
|
+
createdAt DateTime @default(now())
|
|
15
|
+
updatedAt DateTime @updatedAt
|
|
16
|
+
}
|