create-stackkit-app 0.2.0 → 0.3.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.
- package/README.md +46 -31
- package/dist/lib/create-project.d.ts.map +1 -1
- package/dist/lib/create-project.js +179 -72
- package/dist/lib/create-project.js.map +1 -1
- package/dist/lib/template-composer.d.ts +17 -0
- package/dist/lib/template-composer.d.ts.map +1 -0
- package/dist/lib/template-composer.js +199 -0
- package/dist/lib/template-composer.js.map +1 -0
- package/package.json +5 -4
- package/templates/auth/authjs-express/config.json +20 -0
- package/templates/auth/authjs-express/files/lib/auth.ts +43 -0
- package/templates/auth/authjs-express/files/routes/auth.ts +12 -0
- package/templates/auth/authjs-express/lib/auth.ts +43 -0
- package/templates/auth/authjs-express/module.json +39 -0
- package/templates/auth/authjs-express/routes/auth.ts +12 -0
- package/templates/auth/authjs-nextjs/app/api/auth/[...nextauth]/route.ts +3 -0
- package/templates/auth/authjs-nextjs/config.json +19 -0
- package/templates/auth/authjs-nextjs/files/api/auth/[...nextauth]/route.ts +3 -0
- package/templates/auth/authjs-nextjs/files/lib/auth.ts +45 -0
- package/templates/auth/authjs-nextjs/lib/auth.ts +45 -0
- package/templates/auth/authjs-nextjs/module.json +38 -0
- 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/better-auth-react/config.json +15 -0
- package/templates/auth/better-auth-react/files/lib/auth-client.ts +9 -0
- package/templates/auth/better-auth-react/lib/auth-client.ts +9 -0
- package/templates/auth/better-auth-react/module.json +26 -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/{next-prisma-postgres-shadcn → bases/nextjs-base}/app/layout.tsx +3 -6
- package/templates/bases/nextjs-base/app/page.tsx +8 -0
- package/templates/{next-prisma-postgres-shadcn → bases/nextjs-base}/next.config.ts +1 -3
- package/templates/bases/nextjs-base/package.json +24 -0
- package/templates/bases/nextjs-base/template.json +7 -0
- package/templates/{next-prisma-postgres-shadcn → bases/nextjs-base}/tsconfig.json +1 -6
- package/templates/databases/prisma-mongodb/config.json +21 -0
- package/templates/{next-prisma-postgres-shadcn → databases/prisma-mongodb}/lib/db.ts +2 -3
- 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/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/page.tsx +0 -29
- package/templates/next-prisma-postgres-shadcn/lib/env.ts +0 -15
- 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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "better-auth-react",
|
|
3
|
+
"displayName": "Better Auth (React)",
|
|
4
|
+
"description": "Client-side authentication with Better Auth for React",
|
|
5
|
+
"frameworks": ["react", "react-vite"],
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"better-auth": "^1.0.0"
|
|
8
|
+
},
|
|
9
|
+
"envVars": {
|
|
10
|
+
"VITE_AUTH_URL": {
|
|
11
|
+
"value": "http://localhost:3000",
|
|
12
|
+
"description": "Base URL of your auth server (optional if same domain)"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -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,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,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
|
+
}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import type { Metadata } from 'next';
|
|
2
|
-
import { Inter } from 'next/font/google';
|
|
3
2
|
import './globals.css';
|
|
4
3
|
|
|
5
|
-
const inter = Inter({ subsets: ['latin'] });
|
|
6
|
-
|
|
7
4
|
export const metadata: Metadata = {
|
|
8
5
|
title: 'StackKit App',
|
|
9
|
-
description: '
|
|
6
|
+
description: 'Generated by create-stackkit-app',
|
|
10
7
|
};
|
|
11
8
|
|
|
12
9
|
export default function RootLayout({
|
|
13
10
|
children,
|
|
14
11
|
}: Readonly<{
|
|
15
|
-
children: React.
|
|
12
|
+
children: React.Node;
|
|
16
13
|
}>) {
|
|
17
14
|
return (
|
|
18
15
|
<html lang="en">
|
|
19
|
-
<body
|
|
16
|
+
<body>{children}</body>
|
|
20
17
|
</html>
|
|
21
18
|
);
|
|
22
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,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
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PrismaClient } from '@prisma/client';
|
|
2
|
-
import { env } from './env';
|
|
3
2
|
|
|
4
3
|
const globalForPrisma = globalThis as unknown as {
|
|
5
4
|
prisma: PrismaClient | undefined;
|
|
@@ -8,7 +7,7 @@ const globalForPrisma = globalThis as unknown as {
|
|
|
8
7
|
export const prisma =
|
|
9
8
|
globalForPrisma.prisma ??
|
|
10
9
|
new PrismaClient({
|
|
11
|
-
log: env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
|
|
10
|
+
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
|
|
12
11
|
});
|
|
13
12
|
|
|
14
|
-
if (env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
|
|
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
|
+
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
# Project
|
|
2
|
-
|
|
3
|
-
Created with [StackKit](https://github.com/tariqul420/stackkit).
|
|
4
|
-
|
|
5
|
-
## Setup
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# Install dependencies
|
|
9
|
-
pnpm install
|
|
10
|
-
|
|
11
|
-
# Configure environment
|
|
12
|
-
cp .env.example .env
|
|
13
|
-
# Update DATABASE_URL in .env
|
|
14
|
-
|
|
15
|
-
# Run migrations
|
|
16
|
-
pnpm prisma migrate dev
|
|
17
|
-
|
|
18
|
-
# Start dev server
|
|
19
|
-
pnpm dev
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Open [http://localhost:3000](http://localhost:3000)
|
|
23
|
-
|
|
24
|
-
## Stack
|
|
25
|
-
|
|
26
|
-
- Next.js 15 (App Router)
|
|
27
|
-
- TypeScript
|
|
28
|
-
- Prisma + PostgreSQL
|
|
29
|
-
- Tailwind CSS
|
|
30
|
-
- shadcn/ui
|
|
31
|
-
- Zod validation
|
|
32
|
-
|
|
33
|
-
## Structure
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
├── app/ # Next.js routes
|
|
37
|
-
├── lib/ # Utilities
|
|
38
|
-
├── prisma/ # Database schema
|
|
39
|
-
└── public/ # Static files
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Scripts
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
pnpm dev # Development server
|
|
46
|
-
pnpm build # Production build
|
|
47
|
-
pnpm start # Start production
|
|
48
|
-
pnpm lint # Run linter
|
|
49
|
-
pnpm prisma studio # Open Prisma Studio
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Add Features
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npx stackkit-cli add auth
|
|
56
|
-
```
|
|
57
|
-
├── lib/ # Shared utilities
|
|
58
|
-
│ ├── db.ts # Prisma client
|
|
59
|
-
│ └── env.ts # Environment validation
|
|
60
|
-
├── prisma/ # Database schema
|
|
61
|
-
│ └── schema.prisma
|
|
62
|
-
└── public/ # Static assets
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Available Commands
|
|
66
|
-
|
|
67
|
-
- `pnpm dev` - Start development server
|
|
68
|
-
- `pnpm build` - Build for production
|
|
69
|
-
- `pnpm start` - Start production server
|
|
70
|
-
- `pnpm lint` - Run ESLint
|
|
71
|
-
- `pnpm format` - Format code with Prettier
|
|
72
|
-
|
|
73
|
-
## Adding Features
|
|
74
|
-
|
|
75
|
-
Use StackKit to add more features to your project:
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
npx stackkit add auth
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## Learn More
|
|
82
|
-
|
|
83
|
-
- [Next.js Documentation](https://nextjs.org/docs)
|
|
84
|
-
- [Prisma Documentation](https://www.prisma.io/docs)
|
|
85
|
-
- [StackKit Documentation](https://github.com/yourusername/stackkit)
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { prisma } from '@/lib/db';
|
|
3
|
-
|
|
4
|
-
export async function GET() {
|
|
5
|
-
try {
|
|
6
|
-
// Test database connection
|
|
7
|
-
await prisma.$queryRaw`SELECT 1`;
|
|
8
|
-
|
|
9
|
-
return NextResponse.json({
|
|
10
|
-
status: 'ok',
|
|
11
|
-
timestamp: new Date().toISOString(),
|
|
12
|
-
database: 'connected',
|
|
13
|
-
});
|
|
14
|
-
} catch (error) {
|
|
15
|
-
return NextResponse.json(
|
|
16
|
-
{
|
|
17
|
-
status: 'error',
|
|
18
|
-
timestamp: new Date().toISOString(),
|
|
19
|
-
database: 'disconnected',
|
|
20
|
-
error: error instanceof Error ? error.message : 'Unknown error',
|
|
21
|
-
},
|
|
22
|
-
{ status: 500 }
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import 'tailwindcss';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export default function HomePage() {
|
|
2
|
-
return (
|
|
3
|
-
<main className="flex min-h-screen flex-col items-center justify-center p-24">
|
|
4
|
-
<div className="z-10 max-w-5xl w-full items-center justify-between font-mono text-sm">
|
|
5
|
-
<h1 className="text-4xl font-bold mb-4">Welcome to StackKit</h1>
|
|
6
|
-
<p className="text-lg text-gray-600 dark:text-gray-400">
|
|
7
|
-
Your production-ready Next.js starter
|
|
8
|
-
</p>
|
|
9
|
-
<div className="mt-8 space-y-2">
|
|
10
|
-
<p>✅ Next.js 15 App Router</p>
|
|
11
|
-
<p>✅ TypeScript</p>
|
|
12
|
-
<p>✅ Prisma + PostgreSQL</p>
|
|
13
|
-
<p>✅ Tailwind CSS</p>
|
|
14
|
-
<p>✅ Environment validation</p>
|
|
15
|
-
</div>
|
|
16
|
-
<div className="mt-8">
|
|
17
|
-
<a
|
|
18
|
-
href="/api/health"
|
|
19
|
-
className="text-blue-600 hover:underline"
|
|
20
|
-
target="_blank"
|
|
21
|
-
rel="noopener noreferrer"
|
|
22
|
-
>
|
|
23
|
-
Check API Health →
|
|
24
|
-
</a>
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
</main>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
const envSchema = z.object({
|
|
4
|
-
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
|
|
5
|
-
DATABASE_URL: z.string().url(),
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
const parsedEnv = envSchema.safeParse(process.env);
|
|
9
|
-
|
|
10
|
-
if (!parsedEnv.success) {
|
|
11
|
-
console.error('❌ Invalid environment variables:', parsedEnv.error.format());
|
|
12
|
-
throw new Error('Invalid environment variables');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const env = parsedEnv.data;
|
|
@@ -1,32 +0,0 @@
|
|
|
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": "eslint . --ext .ts,.tsx",
|
|
10
|
-
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
|
|
11
|
-
"postinstall": "prisma generate"
|
|
12
|
-
},
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"@prisma/client": "^5.8.0",
|
|
15
|
-
"next": "16.1.1",
|
|
16
|
-
"react": "19.2.3",
|
|
17
|
-
"react-dom": "19.2.3",
|
|
18
|
-
"zod": "^3.22.4"
|
|
19
|
-
},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@tailwindcss/postcss": "^4",
|
|
22
|
-
"@types/node": "^20",
|
|
23
|
-
"@types/react": "^19",
|
|
24
|
-
"@types/react-dom": "^19",
|
|
25
|
-
"eslint": "^9",
|
|
26
|
-
"eslint-config-next": "16.1.1",
|
|
27
|
-
"prettier": "^3.2.4",
|
|
28
|
-
"prisma": "^5.8.0",
|
|
29
|
-
"tailwindcss": "^4",
|
|
30
|
-
"typescript": "^5"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// This is your Prisma schema file
|
|
2
|
-
// Learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
3
|
-
|
|
4
|
-
generator client {
|
|
5
|
-
provider = "prisma-client-js"
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
datasource db {
|
|
9
|
-
provider = "postgresql"
|
|
10
|
-
url = env("DATABASE_URL")
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Example model - replace with your own
|
|
14
|
-
model User {
|
|
15
|
-
id String @id @default(cuid())
|
|
16
|
-
email String @unique
|
|
17
|
-
name String?
|
|
18
|
-
createdAt DateTime @default(now())
|
|
19
|
-
updatedAt DateTime @updatedAt
|
|
20
|
-
}
|