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,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TemplateComposer = void 0;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
class TemplateComposer {
|
|
10
|
+
templatesDir;
|
|
11
|
+
constructor(templatesDir) {
|
|
12
|
+
this.templatesDir = templatesDir;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Compose a project from base + database + auth selections
|
|
16
|
+
*/
|
|
17
|
+
async compose(targetDir, framework, database, auth) {
|
|
18
|
+
const configs = [];
|
|
19
|
+
const filesToCopy = [];
|
|
20
|
+
// 1. Load base framework template
|
|
21
|
+
const baseConfig = await this.loadConfig(path_1.default.join(this.templatesDir, 'bases', `${framework}-base`));
|
|
22
|
+
configs.push(baseConfig);
|
|
23
|
+
// Copy base files
|
|
24
|
+
const baseFiles = await this.getBaseFiles(framework);
|
|
25
|
+
filesToCopy.push(...baseFiles);
|
|
26
|
+
// 2. Load database configuration if not "none"
|
|
27
|
+
if (database !== 'none') {
|
|
28
|
+
const dbConfig = await this.loadConfig(path_1.default.join(this.templatesDir, 'databases', database));
|
|
29
|
+
// Check compatibility
|
|
30
|
+
if (dbConfig.compatibleWith?.frameworks &&
|
|
31
|
+
!dbConfig.compatibleWith.frameworks.includes(framework)) {
|
|
32
|
+
throw new Error(`${dbConfig.displayName} is not compatible with ${framework}`);
|
|
33
|
+
}
|
|
34
|
+
configs.push(dbConfig);
|
|
35
|
+
// Copy database files
|
|
36
|
+
const dbDir = path_1.default.join(this.templatesDir, 'databases', database);
|
|
37
|
+
const dbFiles = await this.collectFiles(dbDir);
|
|
38
|
+
filesToCopy.push(...dbFiles.map((f) => ({
|
|
39
|
+
source: f,
|
|
40
|
+
dest: path_1.default.join(targetDir, f.replace(dbDir + path_1.default.sep, '')),
|
|
41
|
+
})));
|
|
42
|
+
}
|
|
43
|
+
// 3. Load auth configuration if not "none"
|
|
44
|
+
if (auth !== 'none') {
|
|
45
|
+
const authKey = this.getAuthKey(framework, auth);
|
|
46
|
+
const authDir = path_1.default.join(this.templatesDir, 'auth', authKey);
|
|
47
|
+
if (await fs_extra_1.default.pathExists(authDir)) {
|
|
48
|
+
const authConfig = await this.loadConfig(authDir);
|
|
49
|
+
// Check compatibility
|
|
50
|
+
if (authConfig.compatibleWith?.frameworks &&
|
|
51
|
+
!authConfig.compatibleWith.frameworks.includes(framework)) {
|
|
52
|
+
throw new Error(`${authConfig.displayName} is not compatible with ${framework}`);
|
|
53
|
+
}
|
|
54
|
+
if (authConfig.compatibleWith?.databases &&
|
|
55
|
+
!authConfig.compatibleWith.databases.includes(database)) {
|
|
56
|
+
throw new Error(`${authConfig.displayName} is not compatible with ${database}`);
|
|
57
|
+
}
|
|
58
|
+
configs.push(authConfig);
|
|
59
|
+
// Copy auth files
|
|
60
|
+
const authFiles = await this.collectFiles(authDir);
|
|
61
|
+
filesToCopy.push(...authFiles.map((f) => ({
|
|
62
|
+
source: f,
|
|
63
|
+
dest: path_1.default.join(targetDir, f.replace(authDir + path_1.default.sep, '')),
|
|
64
|
+
})));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// 4. Merge all configurations
|
|
68
|
+
const mergedConfig = this.mergeConfigs(configs);
|
|
69
|
+
// 5. Copy all files
|
|
70
|
+
await this.copyFiles(filesToCopy);
|
|
71
|
+
// 6. Create/update package.json
|
|
72
|
+
await this.writePackageJson(targetDir, mergedConfig);
|
|
73
|
+
// 7. Create/update .env
|
|
74
|
+
await this.writeEnvFile(targetDir, mergedConfig);
|
|
75
|
+
}
|
|
76
|
+
async loadConfig(dir) {
|
|
77
|
+
const configPath = path_1.default.join(dir, 'config.json');
|
|
78
|
+
const templatePath = path_1.default.join(dir, 'template.json');
|
|
79
|
+
if (await fs_extra_1.default.pathExists(configPath)) {
|
|
80
|
+
return await fs_extra_1.default.readJson(configPath);
|
|
81
|
+
}
|
|
82
|
+
else if (await fs_extra_1.default.pathExists(templatePath)) {
|
|
83
|
+
return await fs_extra_1.default.readJson(templatePath);
|
|
84
|
+
}
|
|
85
|
+
throw new Error(`No configuration found in ${dir}`);
|
|
86
|
+
}
|
|
87
|
+
async getBaseFiles(framework) {
|
|
88
|
+
// For now, use existing complete template
|
|
89
|
+
// In future, this will use minimal base templates
|
|
90
|
+
const baseDir = path_1.default.join(this.templatesDir, 'next-prisma-postgres-shadcn');
|
|
91
|
+
const files = await this.collectFiles(baseDir);
|
|
92
|
+
return files.map((source) => ({
|
|
93
|
+
source,
|
|
94
|
+
dest: source.replace(baseDir, ''),
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
async collectFiles(dir, exclude = ['config.json', 'template.json', 'node_modules']) {
|
|
98
|
+
const files = [];
|
|
99
|
+
if (!(await fs_extra_1.default.pathExists(dir))) {
|
|
100
|
+
return files;
|
|
101
|
+
}
|
|
102
|
+
const entries = await fs_extra_1.default.readdir(dir, { withFileTypes: true });
|
|
103
|
+
for (const entry of entries) {
|
|
104
|
+
if (exclude.includes(entry.name))
|
|
105
|
+
continue;
|
|
106
|
+
const fullPath = path_1.default.join(dir, entry.name);
|
|
107
|
+
if (entry.isDirectory()) {
|
|
108
|
+
const subFiles = await this.collectFiles(fullPath, exclude);
|
|
109
|
+
files.push(...subFiles);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
files.push(fullPath);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return files;
|
|
116
|
+
}
|
|
117
|
+
async copyFiles(files) {
|
|
118
|
+
for (const { source, dest } of files) {
|
|
119
|
+
await fs_extra_1.default.ensureDir(path_1.default.dirname(dest));
|
|
120
|
+
await fs_extra_1.default.copy(source, dest, { overwrite: true });
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
mergeConfigs(configs) {
|
|
124
|
+
return configs.reduce((merged, config) => {
|
|
125
|
+
return {
|
|
126
|
+
...merged,
|
|
127
|
+
dependencies: {
|
|
128
|
+
...merged.dependencies,
|
|
129
|
+
...config.dependencies,
|
|
130
|
+
},
|
|
131
|
+
devDependencies: {
|
|
132
|
+
...merged.devDependencies,
|
|
133
|
+
...config.devDependencies,
|
|
134
|
+
},
|
|
135
|
+
scripts: {
|
|
136
|
+
...merged.scripts,
|
|
137
|
+
...config.scripts,
|
|
138
|
+
},
|
|
139
|
+
env: {
|
|
140
|
+
...merged.env,
|
|
141
|
+
...config.env,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}, {});
|
|
145
|
+
}
|
|
146
|
+
async writePackageJson(targetDir, config) {
|
|
147
|
+
const pkgPath = path_1.default.join(targetDir, 'package.json');
|
|
148
|
+
let pkg = {};
|
|
149
|
+
if (await fs_extra_1.default.pathExists(pkgPath)) {
|
|
150
|
+
pkg = await fs_extra_1.default.readJson(pkgPath);
|
|
151
|
+
}
|
|
152
|
+
// Merge dependencies and scripts
|
|
153
|
+
if (config.dependencies) {
|
|
154
|
+
pkg.dependencies = { ...pkg.dependencies, ...config.dependencies };
|
|
155
|
+
}
|
|
156
|
+
if (config.devDependencies) {
|
|
157
|
+
pkg.devDependencies = { ...pkg.devDependencies, ...config.devDependencies };
|
|
158
|
+
}
|
|
159
|
+
if (config.scripts) {
|
|
160
|
+
pkg.scripts = { ...pkg.scripts, ...config.scripts };
|
|
161
|
+
}
|
|
162
|
+
await fs_extra_1.default.writeJson(pkgPath, pkg, { spaces: 2 });
|
|
163
|
+
}
|
|
164
|
+
async writeEnvFile(targetDir, config) {
|
|
165
|
+
if (!config.env || Object.keys(config.env).length === 0) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const envPath = path_1.default.join(targetDir, '.env');
|
|
169
|
+
const envExamplePath = path_1.default.join(targetDir, '.env.example');
|
|
170
|
+
const envContent = Object.entries(config.env)
|
|
171
|
+
.map(([key, value]) => `${key}="${value}"`)
|
|
172
|
+
.join('\n') + '\n';
|
|
173
|
+
// Append or create .env.example
|
|
174
|
+
if (await fs_extra_1.default.pathExists(envExamplePath)) {
|
|
175
|
+
const existing = await fs_extra_1.default.readFile(envExamplePath, 'utf-8');
|
|
176
|
+
if (!existing.includes(envContent)) {
|
|
177
|
+
await fs_extra_1.default.appendFile(envExamplePath, '\n' + envContent);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
await fs_extra_1.default.writeFile(envExamplePath, envContent);
|
|
182
|
+
}
|
|
183
|
+
// Don't overwrite existing .env, but create if missing
|
|
184
|
+
if (!(await fs_extra_1.default.pathExists(envPath))) {
|
|
185
|
+
await fs_extra_1.default.writeFile(envPath, envContent);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
getAuthKey(framework, auth) {
|
|
189
|
+
// Map framework + auth to specific implementation
|
|
190
|
+
const mapping = {
|
|
191
|
+
'nextjs-nextauth': 'nextauth',
|
|
192
|
+
'nextjs-better-auth': 'better-auth-nextjs',
|
|
193
|
+
'express-better-auth': 'better-auth-express',
|
|
194
|
+
};
|
|
195
|
+
return mapping[`${framework}-${auth}`] || auth;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
exports.TemplateComposer = TemplateComposer;
|
|
199
|
+
//# sourceMappingURL=template-composer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-composer.js","sourceRoot":"","sources":["../../src/lib/template-composer.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA0B;AAC1B,gDAAwB;AAmBxB,MAAa,gBAAgB;IACnB,YAAY,CAAS;IAE7B,YAAY,YAAoB;QAC9B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CACX,SAAiB,EACjB,SAAiB,EACjB,QAAgB,EAChB,IAAY;QAE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AAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;YAC5D,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBACnC,MAAM,kBAAE,CAAC,UAAU,CAAC,cAAc,EAAE,IAAI,GAAG,UAAU,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,kBAAE,CAAC,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QACjD,CAAC;QAED,uDAAuD;QACvD,IAAI,CAAC,CAAC,MAAM,kBAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;YACpC,MAAM,kBAAE,CAAC,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IAEO,UAAU,CAAC,SAAiB,EAAE,IAAY;QAChD,kDAAkD;QAClD,MAAM,OAAO,GAA2B;YACtC,iBAAiB,EAAE,UAAU;YAC7B,oBAAoB,EAAE,oBAAoB;YAC1C,qBAAqB,EAAE,qBAAqB;SAC7C,CAAC;QAEF,OAAO,OAAO,CAAC,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC;IACjD,CAAC;CACF;AA1PD,4CA0PC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-stackkit-app",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Create a new StackKit project with
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Create a new StackKit project with modular composition",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"create-stackkit": "./bin/create-stackkit.js"
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"dev": "tsc --watch",
|
|
26
26
|
"build": "tsc",
|
|
27
27
|
"clean": "rm -rf dist",
|
|
28
|
-
"typecheck": "tsc --noEmit"
|
|
28
|
+
"typecheck": "tsc --noEmit",
|
|
29
|
+
"prepublishOnly": "npm run build && cp -r ../../templates ."
|
|
29
30
|
},
|
|
30
31
|
"keywords": [
|
|
31
32
|
"create",
|
|
@@ -50,4 +51,4 @@
|
|
|
50
51
|
"@types/validate-npm-package-name": "^4.0.2",
|
|
51
52
|
"typescript": "^5.3.3"
|
|
52
53
|
}
|
|
53
|
-
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "authjs-express",
|
|
3
|
+
"displayName": "Auth.js (Express)",
|
|
4
|
+
"description": "Authentication with Auth.js for Express",
|
|
5
|
+
"frameworks": ["express"],
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@auth/express": "^0.7.6",
|
|
8
|
+
"@auth/core": "^0.37.4"
|
|
9
|
+
},
|
|
10
|
+
"envVars": {
|
|
11
|
+
"AUTH_SECRET": {
|
|
12
|
+
"value": "",
|
|
13
|
+
"description": "Secret for encrypting tokens. Generate with: openssl rand -base64 32"
|
|
14
|
+
},
|
|
15
|
+
"AUTH_TRUST_HOST": {
|
|
16
|
+
"value": "true",
|
|
17
|
+
"description": "Trust the host header (required for Express)"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Auth } from '@auth/core';
|
|
2
|
+
import GitHub from '@auth/core/providers/github';
|
|
3
|
+
import Google from '@auth/core/providers/google';
|
|
4
|
+
import Credentials from '@auth/core/providers/credentials';
|
|
5
|
+
|
|
6
|
+
export const authConfig = {
|
|
7
|
+
secret: process.env.AUTH_SECRET,
|
|
8
|
+
trustHost: true,
|
|
9
|
+
providers: [
|
|
10
|
+
// GitHub OAuth Provider
|
|
11
|
+
// Uncomment and add GITHUB_ID and GITHUB_SECRET to .env
|
|
12
|
+
// GitHub({
|
|
13
|
+
// clientId: process.env.GITHUB_ID!,
|
|
14
|
+
// clientSecret: process.env.GITHUB_SECRET!,
|
|
15
|
+
// }),
|
|
16
|
+
|
|
17
|
+
// Google OAuth Provider
|
|
18
|
+
// Uncomment and add GOOGLE_ID and GOOGLE_SECRET to .env
|
|
19
|
+
// Google({
|
|
20
|
+
// clientId: process.env.GOOGLE_ID!,
|
|
21
|
+
// clientSecret: process.env.GOOGLE_SECRET!,
|
|
22
|
+
// }),
|
|
23
|
+
|
|
24
|
+
// Credentials Provider (email/password)
|
|
25
|
+
Credentials({
|
|
26
|
+
credentials: {
|
|
27
|
+
email: { label: 'Email', type: 'email' },
|
|
28
|
+
password: { label: 'Password', type: 'password' },
|
|
29
|
+
},
|
|
30
|
+
authorize: async (credentials) => {
|
|
31
|
+
// Add your own authentication logic here
|
|
32
|
+
if (credentials?.email === 'demo@example.com' && credentials?.password === 'demo') {
|
|
33
|
+
return {
|
|
34
|
+
id: '1',
|
|
35
|
+
name: 'Demo User',
|
|
36
|
+
email: 'demo@example.com',
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { Auth } from '@auth/core';
|
|
3
|
+
import { authConfig } from '../lib/auth';
|
|
4
|
+
|
|
5
|
+
const router = Router();
|
|
6
|
+
|
|
7
|
+
router.all('/auth/*', async (req, res) => {
|
|
8
|
+
const response = await Auth(req, authConfig);
|
|
9
|
+
return res.status(response.status).json(response.body);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export default router;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Auth } from '@auth/core';
|
|
2
|
+
import GitHub from '@auth/core/providers/github';
|
|
3
|
+
import Google from '@auth/core/providers/google';
|
|
4
|
+
import Credentials from '@auth/core/providers/credentials';
|
|
5
|
+
|
|
6
|
+
export const authConfig = {
|
|
7
|
+
secret: process.env.AUTH_SECRET,
|
|
8
|
+
trustHost: true,
|
|
9
|
+
providers: [
|
|
10
|
+
// GitHub OAuth Provider
|
|
11
|
+
// Uncomment and add GITHUB_ID and GITHUB_SECRET to .env
|
|
12
|
+
// GitHub({
|
|
13
|
+
// clientId: process.env.GITHUB_ID!,
|
|
14
|
+
// clientSecret: process.env.GITHUB_SECRET!,
|
|
15
|
+
// }),
|
|
16
|
+
|
|
17
|
+
// Google OAuth Provider
|
|
18
|
+
// Uncomment and add GOOGLE_ID and GOOGLE_SECRET to .env
|
|
19
|
+
// Google({
|
|
20
|
+
// clientId: process.env.GOOGLE_ID!,
|
|
21
|
+
// clientSecret: process.env.GOOGLE_SECRET!,
|
|
22
|
+
// }),
|
|
23
|
+
|
|
24
|
+
// Credentials Provider (email/password)
|
|
25
|
+
Credentials({
|
|
26
|
+
credentials: {
|
|
27
|
+
email: { label: 'Email', type: 'email' },
|
|
28
|
+
password: { label: 'Password', type: 'password' },
|
|
29
|
+
},
|
|
30
|
+
authorize: async (credentials) => {
|
|
31
|
+
// Add your own authentication logic here
|
|
32
|
+
if (credentials?.email === 'demo@example.com' && credentials?.password === 'demo') {
|
|
33
|
+
return {
|
|
34
|
+
id: '1',
|
|
35
|
+
name: 'Demo User',
|
|
36
|
+
email: 'demo@example.com',
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { Auth } from '@auth/core';
|
|
3
|
+
import { authConfig } from '../lib/auth';
|
|
4
|
+
|
|
5
|
+
const router = Router();
|
|
6
|
+
|
|
7
|
+
router.all('/auth/*', async (req, res) => {
|
|
8
|
+
const response = await Auth(req, authConfig);
|
|
9
|
+
return res.status(response.status).json(response.body);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export default router;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "authjs-nextjs",
|
|
3
|
+
"displayName": "Auth.js v5 (Next.js)",
|
|
4
|
+
"description": "Modern authentication with Auth.js v5 (NextAuth successor)",
|
|
5
|
+
"frameworks": ["nextjs"],
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"next-auth": "^5.0.0-beta.25"
|
|
8
|
+
},
|
|
9
|
+
"envVars": {
|
|
10
|
+
"AUTH_SECRET": {
|
|
11
|
+
"value": "",
|
|
12
|
+
"description": "Secret for encrypting tokens. Generate with: openssl rand -base64 32"
|
|
13
|
+
},
|
|
14
|
+
"AUTH_URL": {
|
|
15
|
+
"value": "http://localhost:3000",
|
|
16
|
+
"description": "Canonical URL of your site (change in production)"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import NextAuth from 'next-auth';
|
|
2
|
+
import GitHub from 'next-auth/providers/github';
|
|
3
|
+
import Google from 'next-auth/providers/google';
|
|
4
|
+
import Credentials from 'next-auth/providers/credentials';
|
|
5
|
+
|
|
6
|
+
export const { handlers, signIn, signOut, auth } = NextAuth({
|
|
7
|
+
providers: [
|
|
8
|
+
// GitHub OAuth Provider
|
|
9
|
+
// Uncomment and add GITHUB_ID and GITHUB_SECRET to .env
|
|
10
|
+
// GitHub({
|
|
11
|
+
// clientId: process.env.GITHUB_ID!,
|
|
12
|
+
// clientSecret: process.env.GITHUB_SECRET!,
|
|
13
|
+
// }),
|
|
14
|
+
|
|
15
|
+
// Google OAuth Provider
|
|
16
|
+
// Uncomment and add GOOGLE_ID and GOOGLE_SECRET to .env
|
|
17
|
+
// Google({
|
|
18
|
+
// clientId: process.env.GOOGLE_ID!,
|
|
19
|
+
// clientSecret: process.env.GOOGLE_SECRET!,
|
|
20
|
+
// }),
|
|
21
|
+
|
|
22
|
+
// Credentials Provider (email/password)
|
|
23
|
+
Credentials({
|
|
24
|
+
credentials: {
|
|
25
|
+
email: { label: 'Email', type: 'email' },
|
|
26
|
+
password: { label: 'Password', type: 'password' },
|
|
27
|
+
},
|
|
28
|
+
authorize: async (credentials) => {
|
|
29
|
+
// Add your own authentication logic here
|
|
30
|
+
// This is just a demo - DO NOT use in production
|
|
31
|
+
if (credentials?.email === 'demo@example.com' && credentials?.password === 'demo') {
|
|
32
|
+
return {
|
|
33
|
+
id: '1',
|
|
34
|
+
name: 'Demo User',
|
|
35
|
+
email: 'demo@example.com',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
],
|
|
42
|
+
pages: {
|
|
43
|
+
signIn: '/auth/signin',
|
|
44
|
+
},
|
|
45
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import NextAuth from 'next-auth';
|
|
2
|
+
import GitHub from 'next-auth/providers/github';
|
|
3
|
+
import Google from 'next-auth/providers/google';
|
|
4
|
+
import Credentials from 'next-auth/providers/credentials';
|
|
5
|
+
|
|
6
|
+
export const { handlers, signIn, signOut, auth } = NextAuth({
|
|
7
|
+
providers: [
|
|
8
|
+
// GitHub OAuth Provider
|
|
9
|
+
// Uncomment and add GITHUB_ID and GITHUB_SECRET to .env
|
|
10
|
+
// GitHub({
|
|
11
|
+
// clientId: process.env.GITHUB_ID!,
|
|
12
|
+
// clientSecret: process.env.GITHUB_SECRET!,
|
|
13
|
+
// }),
|
|
14
|
+
|
|
15
|
+
// Google OAuth Provider
|
|
16
|
+
// Uncomment and add GOOGLE_ID and GOOGLE_SECRET to .env
|
|
17
|
+
// Google({
|
|
18
|
+
// clientId: process.env.GOOGLE_ID!,
|
|
19
|
+
// clientSecret: process.env.GOOGLE_SECRET!,
|
|
20
|
+
// }),
|
|
21
|
+
|
|
22
|
+
// Credentials Provider (email/password)
|
|
23
|
+
Credentials({
|
|
24
|
+
credentials: {
|
|
25
|
+
email: { label: 'Email', type: 'email' },
|
|
26
|
+
password: { label: 'Password', type: 'password' },
|
|
27
|
+
},
|
|
28
|
+
authorize: async (credentials) => {
|
|
29
|
+
// Add your own authentication logic here
|
|
30
|
+
// This is just a demo - DO NOT use in production
|
|
31
|
+
if (credentials?.email === 'demo@example.com' && credentials?.password === 'demo') {
|
|
32
|
+
return {
|
|
33
|
+
id: '1',
|
|
34
|
+
name: 'Demo User',
|
|
35
|
+
email: 'demo@example.com',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
],
|
|
42
|
+
pages: {
|
|
43
|
+
signIn: '/auth/signin',
|
|
44
|
+
},
|
|
45
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
}
|
|
@@ -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;
|