create-stackkit-app 0.4.0 → 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.
- package/README.md +8 -13
- package/dist/lib/create-project.js +0 -3
- package/package.json +3 -3
- package/templates/bases/express-base/package.json +3 -3
- package/templates/bases/express-base/src/app.ts +34 -0
- package/templates/bases/express-base/src/config/env.ts +14 -0
- package/templates/bases/express-base/src/middlewares/error.middleware.ts +12 -0
- package/templates/bases/express-base/src/server.ts +8 -0
- package/templates/bases/express-base/template.json +1 -1
- package/templates/bases/express-base/tsconfig.json +5 -8
- package/templates/bases/nextjs-base/template.json +1 -1
- package/templates/bases/react-vite-base/README.md +73 -0
- package/templates/bases/react-vite-base/eslint.config.js +23 -0
- package/templates/bases/react-vite-base/index.html +1 -1
- package/templates/bases/react-vite-base/package.json +19 -16
- package/templates/bases/react-vite-base/public/vite.svg +1 -0
- package/templates/bases/react-vite-base/src/App.css +28 -0
- package/templates/bases/react-vite-base/src/App.tsx +20 -8
- package/templates/bases/react-vite-base/src/assets/react.svg +1 -0
- package/templates/bases/react-vite-base/src/index.css +1 -1
- package/templates/bases/react-vite-base/src/main.tsx +6 -6
- package/templates/bases/react-vite-base/template.json +16 -2
- package/templates/bases/react-vite-base/tsconfig.app.json +28 -0
- package/templates/bases/react-vite-base/tsconfig.json +5 -19
- package/templates/bases/react-vite-base/tsconfig.node.json +26 -0
- package/templates/bases/react-vite-base/vite.config.ts +3 -3
- package/modules/auth/authjs-express/files/lib/auth.ts +0 -40
- package/modules/auth/authjs-express/files/routes/auth.ts +0 -12
- package/modules/auth/authjs-express/module.json +0 -39
- package/modules/auth/authjs-nextjs/files/api/auth/[...nextauth]/route.ts +0 -3
- package/modules/auth/authjs-nextjs/files/lib/auth.ts +0 -43
- package/modules/auth/authjs-nextjs/module.json +0 -38
- package/modules/auth/nextauth/files/app-router/api/auth/[...nextauth]/route.ts +0 -6
- package/modules/auth/nextauth/files/lib/auth.ts +0 -82
- package/modules/auth/nextauth/files/pages-router/api/auth/[...nextauth].ts +0 -4
- package/modules/auth/nextauth/module.json +0 -50
- package/templates/bases/express-base/src/index.ts +0 -27
- package/templates/bases/nextjs-base/package-lock.json +0 -6538
- package/templates/bases/react-vite-base/src/vite-env.d.ts +0 -1
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "auth",
|
|
3
|
-
"displayName": "Auth.js (Express)",
|
|
4
|
-
"description": "Authentication with Auth.js for Express",
|
|
5
|
-
"category": "auth",
|
|
6
|
-
"supportedFrameworks": ["express"],
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"@auth/express": "^0.7.6",
|
|
9
|
-
"@auth/core": "^0.37.4"
|
|
10
|
-
},
|
|
11
|
-
"envVars": [
|
|
12
|
-
{
|
|
13
|
-
"key": "AUTH_SECRET",
|
|
14
|
-
"value": "",
|
|
15
|
-
"description": "Secret for encrypting tokens. Generate with: openssl rand -base64 32",
|
|
16
|
-
"required": true
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"key": "AUTH_TRUST_HOST",
|
|
20
|
-
"value": "true",
|
|
21
|
-
"description": "Trust the host header (required for Express)",
|
|
22
|
-
"required": true
|
|
23
|
-
}
|
|
24
|
-
],
|
|
25
|
-
"patches": [
|
|
26
|
-
{
|
|
27
|
-
"type": "create-file",
|
|
28
|
-
"description": "Create Auth.js configuration",
|
|
29
|
-
"source": "lib/auth.ts",
|
|
30
|
-
"destination": "src/lib/auth.ts"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"type": "create-file",
|
|
34
|
-
"description": "Create auth routes",
|
|
35
|
-
"source": "routes/auth.ts",
|
|
36
|
-
"destination": "src/routes/auth.ts"
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import NextAuth from 'next-auth';
|
|
2
|
-
import Credentials from 'next-auth/providers/credentials';
|
|
3
|
-
|
|
4
|
-
export const { handlers, signIn, signOut, auth } = NextAuth({
|
|
5
|
-
providers: [
|
|
6
|
-
// GitHub OAuth Provider
|
|
7
|
-
// Uncomment and add GITHUB_ID and GITHUB_SECRET to .env
|
|
8
|
-
// GitHub({
|
|
9
|
-
// clientId: process.env.GITHUB_ID!,
|
|
10
|
-
// clientSecret: process.env.GITHUB_SECRET!,
|
|
11
|
-
// }),
|
|
12
|
-
|
|
13
|
-
// Google OAuth Provider
|
|
14
|
-
// Uncomment and add GOOGLE_ID and GOOGLE_SECRET to .env
|
|
15
|
-
// Google({
|
|
16
|
-
// clientId: process.env.GOOGLE_ID!,
|
|
17
|
-
// clientSecret: process.env.GOOGLE_SECRET!,
|
|
18
|
-
// }),
|
|
19
|
-
|
|
20
|
-
// Credentials Provider (email/password)
|
|
21
|
-
Credentials({
|
|
22
|
-
credentials: {
|
|
23
|
-
email: { label: 'Email', type: 'email' },
|
|
24
|
-
password: { label: 'Password', type: 'password' },
|
|
25
|
-
},
|
|
26
|
-
authorize: async (credentials) => {
|
|
27
|
-
// Add your own authentication logic here
|
|
28
|
-
// This is just a demo - DO NOT use in production
|
|
29
|
-
if (credentials?.email === 'demo@example.com' && credentials?.password === 'demo') {
|
|
30
|
-
return {
|
|
31
|
-
id: '1',
|
|
32
|
-
name: 'Demo User',
|
|
33
|
-
email: 'demo@example.com',
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
return null;
|
|
37
|
-
},
|
|
38
|
-
}),
|
|
39
|
-
],
|
|
40
|
-
pages: {
|
|
41
|
-
signIn: '/auth/signin',
|
|
42
|
-
},
|
|
43
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "auth",
|
|
3
|
-
"displayName": "Auth.js v5 (Next.js)",
|
|
4
|
-
"description": "Modern authentication with Auth.js v5 (NextAuth successor)",
|
|
5
|
-
"category": "auth",
|
|
6
|
-
"supportedFrameworks": ["nextjs"],
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"next-auth": "^5.0.0-beta.25"
|
|
9
|
-
},
|
|
10
|
-
"envVars": [
|
|
11
|
-
{
|
|
12
|
-
"key": "AUTH_SECRET",
|
|
13
|
-
"value": "",
|
|
14
|
-
"description": "Secret for encrypting tokens. Generate with: openssl rand -base64 32",
|
|
15
|
-
"required": true
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"key": "AUTH_URL",
|
|
19
|
-
"value": "http://localhost:3000",
|
|
20
|
-
"description": "Canonical URL of your site (change in production)",
|
|
21
|
-
"required": false
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"patches": [
|
|
25
|
-
{
|
|
26
|
-
"type": "create-file",
|
|
27
|
-
"description": "Create Auth.js configuration",
|
|
28
|
-
"source": "lib/auth.ts",
|
|
29
|
-
"destination": "{{lib}}/auth.ts"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"type": "create-file",
|
|
33
|
-
"description": "Create Auth.js API route",
|
|
34
|
-
"source": "api/auth/[...nextauth]/route.ts",
|
|
35
|
-
"destination": "{{router}}/api/auth/[...nextauth]/route.ts"
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { AuthOptions } from 'next-auth';
|
|
2
|
-
import CredentialsProvider from 'next-auth/providers/credentials';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* NextAuth.js Configuration
|
|
6
|
-
*
|
|
7
|
-
* Configure authentication providers and options here.
|
|
8
|
-
* See: https://next-auth.js.org/configuration/options
|
|
9
|
-
*/
|
|
10
|
-
export const authOptions: AuthOptions = {
|
|
11
|
-
providers: [
|
|
12
|
-
// GitHub OAuth Provider
|
|
13
|
-
// Uncomment and add GITHUB_ID and GITHUB_SECRET to .env
|
|
14
|
-
// GithubProvider({
|
|
15
|
-
// clientId: process.env.GITHUB_ID!,
|
|
16
|
-
// clientSecret: process.env.GITHUB_SECRET!,
|
|
17
|
-
// }),
|
|
18
|
-
|
|
19
|
-
// Google OAuth Provider
|
|
20
|
-
// Uncomment and add GOOGLE_ID and GOOGLE_SECRET to .env
|
|
21
|
-
// GoogleProvider({
|
|
22
|
-
// clientId: process.env.GOOGLE_ID!,
|
|
23
|
-
// clientSecret: process.env.GOOGLE_SECRET!,
|
|
24
|
-
// }),
|
|
25
|
-
|
|
26
|
-
// Credentials Provider (email/password)
|
|
27
|
-
// Replace with your own authentication logic
|
|
28
|
-
CredentialsProvider({
|
|
29
|
-
name: 'Credentials',
|
|
30
|
-
credentials: {
|
|
31
|
-
email: { label: 'Email', type: 'email', placeholder: 'user@example.com' },
|
|
32
|
-
password: { label: 'Password', type: 'password' },
|
|
33
|
-
},
|
|
34
|
-
async authorize(credentials) {
|
|
35
|
-
// Add your own authentication logic here
|
|
36
|
-
// This is just a demo - DO NOT use in production
|
|
37
|
-
if (credentials?.email === 'demo@example.com' && credentials?.password === 'demo') {
|
|
38
|
-
return {
|
|
39
|
-
id: '1',
|
|
40
|
-
name: 'Demo User',
|
|
41
|
-
email: 'demo@example.com',
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
return null;
|
|
45
|
-
},
|
|
46
|
-
}),
|
|
47
|
-
],
|
|
48
|
-
|
|
49
|
-
// Database adapter (optional)
|
|
50
|
-
// Uncomment to persist sessions in database
|
|
51
|
-
// adapter: PrismaAdapter(prisma),
|
|
52
|
-
|
|
53
|
-
session: {
|
|
54
|
-
strategy: 'jwt',
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
pages: {
|
|
58
|
-
signIn: '/auth/signin',
|
|
59
|
-
// signOut: '/auth/signout',
|
|
60
|
-
// error: '/auth/error',
|
|
61
|
-
// verifyRequest: '/auth/verify-request',
|
|
62
|
-
// newUser: '/auth/new-user'
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
callbacks: {
|
|
66
|
-
async jwt({ token, user }) {
|
|
67
|
-
if (user) {
|
|
68
|
-
token.id = user.id;
|
|
69
|
-
}
|
|
70
|
-
return token;
|
|
71
|
-
},
|
|
72
|
-
async session({ session, token }) {
|
|
73
|
-
if (session.user) {
|
|
74
|
-
session.user.id = token.id as string;
|
|
75
|
-
}
|
|
76
|
-
return session;
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
// Enable debug messages in development
|
|
81
|
-
debug: process.env.NODE_ENV === 'development',
|
|
82
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "auth",
|
|
3
|
-
"displayName": "NextAuth.js Authentication",
|
|
4
|
-
"description": "Add authentication with NextAuth.js (supports multiple providers)",
|
|
5
|
-
"category": "auth",
|
|
6
|
-
"supportedFrameworks": ["nextjs"],
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"next-auth": "^4.24.5"
|
|
9
|
-
},
|
|
10
|
-
"envVars": [
|
|
11
|
-
{
|
|
12
|
-
"key": "NEXTAUTH_URL",
|
|
13
|
-
"value": "http://localhost:3000",
|
|
14
|
-
"description": "The URL of your application (change in production)",
|
|
15
|
-
"required": true
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"key": "NEXTAUTH_SECRET",
|
|
19
|
-
"value": "",
|
|
20
|
-
"description": "Secret for encrypting tokens. Generate with: openssl rand -base64 32",
|
|
21
|
-
"required": true
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"patches": [
|
|
25
|
-
{
|
|
26
|
-
"type": "create-file",
|
|
27
|
-
"description": "Create NextAuth API route for App Router",
|
|
28
|
-
"source": "app-router/api/auth/[...nextauth]/route.ts",
|
|
29
|
-
"destination": "{{router}}/api/auth/[...nextauth]/route.ts",
|
|
30
|
-
"condition": {
|
|
31
|
-
"router": "app"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"type": "create-file",
|
|
36
|
-
"description": "Create NextAuth API route for Pages Router",
|
|
37
|
-
"source": "pages-router/api/auth/[...nextauth].ts",
|
|
38
|
-
"destination": "{{router}}/api/auth/[...nextauth].ts",
|
|
39
|
-
"condition": {
|
|
40
|
-
"router": "pages"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"type": "create-file",
|
|
45
|
-
"description": "Create auth configuration",
|
|
46
|
-
"source": "lib/auth.ts",
|
|
47
|
-
"destination": "{{lib}}/auth.ts"
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
});
|