better-ts-stack 2.1.1 → 2.2.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/LICENSE +21 -21
- package/README.md +16 -8
- package/dist/args.js +7 -0
- package/dist/builder/buildPlanner.js +7 -1
- package/dist/builder/configGenerator.js +28 -3
- package/dist/builder/index.js +2 -1
- package/dist/builder/moduleSelector.js +6 -1
- package/dist/builder/readmeGenerator.js +8 -2
- package/dist/builder/templateContext.js +1 -0
- package/dist/output/nextSteps.js +2 -4
- package/dist/prompts/stack.js +6 -1
- package/dist/types/index.js +2 -0
- package/dist/ui/messages.js +2 -0
- package/package.json +71 -71
- package/templates/backend/express/.prettierignore +52 -52
- package/templates/backend/express/.prettierrc +16 -16
- package/templates/backend/express/gitignore +3 -1
- package/templates/backend/express/src/env.ts.hbs +13 -2
- package/templates/backend/express/src/index.ts.hbs +31 -2
- package/templates/backend/express/tsconfig.eslint.json +9 -9
- package/templates/backend/nestjs/.prettierignore +52 -52
- package/templates/backend/nestjs/gitignore +3 -1
- package/templates/backend/nestjs/src/app.module.ts.hbs +4 -1
- package/templates/backend/nestjs/src/env.ts.hbs +13 -2
- package/templates/backend/nestjs/src/health/health.controller.ts.hbs +7 -0
- package/templates/backend/nestjs/src/{main.ts → main.ts.hbs} +11 -0
- package/templates/backend/nestjs/tsconfig.eslint.json +9 -9
- package/templates/frontend/nextjs/app/globals.css +129 -89
- package/templates/frontend/nextjs/app/layout.tsx +36 -34
- package/templates/frontend/nextjs/app/page.tsx.hbs +63 -43
- package/templates/frontend/nextjs/components/ui/alert.tsx +75 -0
- package/templates/frontend/nextjs/components/ui/badge.tsx +51 -0
- package/templates/frontend/nextjs/components/ui/button.tsx +57 -51
- package/templates/frontend/nextjs/components/ui/card.tsx +102 -60
- package/templates/frontend/nextjs/components/ui/field.tsx +238 -67
- package/templates/frontend/nextjs/components/ui/input.tsx +19 -18
- package/templates/frontend/nextjs/components/ui/label.tsx +19 -0
- package/templates/frontend/nextjs/components/ui/separator.tsx +24 -0
- package/templates/frontend/nextjs/components/ui/skeleton.tsx +13 -0
- package/templates/frontend/nextjs/components/ui/spinner.tsx +10 -0
- package/templates/frontend/nextjs/components.json +11 -5
- package/templates/frontend/nextjs/config.json +36 -35
- package/templates/frontend/nextjs/eslint.config.mjs +11 -11
- package/templates/frontend/nextjs/lib/utils.ts +1 -6
- package/templates/frontend/nextjs/next.config.ts.hbs +12 -12
- package/templates/frontend/nextjs/postcss.config.mjs +7 -7
- package/templates/frontend/nextjs/public/file.svg +1 -1
- package/templates/frontend/nextjs/public/globe.svg +1 -1
- package/templates/frontend/nextjs/public/window.svg +1 -1
- package/templates/frontend/tanstack/components.json +25 -18
- package/templates/frontend/tanstack/config.json +5 -2
- package/templates/frontend/tanstack/eslint.config.mjs +23 -23
- package/templates/frontend/tanstack/gitignore +39 -39
- package/templates/frontend/tanstack/public/favicon.svg +7 -7
- package/templates/frontend/tanstack/src/components/ui/alert.tsx +75 -0
- package/templates/frontend/tanstack/src/components/ui/badge.tsx +51 -0
- package/templates/frontend/tanstack/src/components/ui/button.tsx +57 -51
- package/templates/frontend/tanstack/src/components/ui/card.tsx +102 -60
- package/templates/frontend/tanstack/src/components/ui/field.tsx +236 -67
- package/templates/frontend/tanstack/src/components/ui/input.tsx +19 -18
- package/templates/frontend/tanstack/src/components/ui/label.tsx +17 -0
- package/templates/frontend/tanstack/src/components/ui/separator.tsx +24 -0
- package/templates/frontend/tanstack/src/components/ui/skeleton.tsx +13 -0
- package/templates/frontend/tanstack/src/components/ui/spinner.tsx +10 -0
- package/templates/frontend/tanstack/src/lib/utils.ts +1 -6
- package/templates/frontend/tanstack/src/router.tsx +31 -31
- package/templates/frontend/tanstack/src/routes/__root.tsx +69 -69
- package/templates/frontend/tanstack/src/routes/index.tsx.hbs +64 -45
- package/templates/frontend/tanstack/src/styles/app.css +100 -55
- package/templates/frontend/tanstack/tsconfig.json +22 -22
- package/templates/modules/agents/AGENTS.md.hbs +245 -0
- package/templates/modules/agents/CLAUDE.md +1 -0
- package/templates/modules/agents/config.json +10 -0
- package/templates/modules/auth/express/config.json +12 -11
- package/templates/modules/auth/express/src/lib/auth.ts.hbs +143 -0
- package/templates/modules/auth/express/src/lib/email.ts +37 -0
- package/templates/modules/auth/express/src/middleware/requireAuth.ts +29 -0
- package/templates/modules/auth/express/src/routes/me.ts +13 -0
- package/templates/modules/auth/nestjs/config.json +13 -11
- package/templates/modules/auth/nestjs/src/auth/auth.module.ts.hbs +64 -14
- package/templates/modules/auth/nestjs/src/auth/auth.ts.hbs +152 -0
- package/templates/modules/auth/nestjs/src/auth/email.ts +37 -0
- package/templates/modules/auth/nestjs/src/me/me.controller.ts +15 -0
- package/templates/modules/auth/nextjs/app/api/auth/[...all]/route.ts +4 -4
- package/templates/modules/auth/nextjs/app/dashboard/page.tsx +101 -45
- package/templates/modules/auth/nextjs/app/forgot-password/page.tsx +11 -0
- package/templates/modules/auth/nextjs/app/reset-password/page.tsx +17 -0
- package/templates/modules/auth/nextjs/app/sign-in/page.tsx +23 -17
- package/templates/modules/auth/nextjs/app/sign-up/page.tsx +25 -19
- package/templates/modules/auth/nextjs/components/auth/change-password-form.tsx +125 -0
- package/templates/modules/auth/nextjs/components/auth/email-verification-card.tsx +91 -0
- package/templates/modules/auth/nextjs/components/auth/forgot-password-form.tsx +133 -0
- package/templates/modules/auth/nextjs/components/auth/reset-password-form.tsx +155 -0
- package/templates/modules/auth/nextjs/components/auth/sign-in-form.tsx +46 -32
- package/templates/modules/auth/nextjs/components/auth/sign-out-button.tsx +6 -5
- package/templates/modules/auth/nextjs/components/auth/sign-up-form.tsx +36 -30
- package/templates/modules/auth/nextjs/components/auth/social-buttons.tsx +73 -0
- package/templates/modules/auth/nextjs/config.json +24 -18
- package/templates/modules/auth/nextjs/lib/auth-client.ts +3 -3
- package/templates/modules/auth/nextjs/lib/auth-schema.ts +27 -2
- package/templates/modules/auth/nextjs/lib/auth.ts.hbs +65 -0
- package/templates/modules/auth/nextjs/lib/email.ts +43 -0
- package/templates/modules/auth/nextjs/lib/session.ts +12 -0
- package/templates/modules/auth/tanstack/config.json +25 -19
- package/templates/modules/auth/tanstack/src/components/auth/change-password-form.tsx +123 -0
- package/templates/modules/auth/tanstack/src/components/auth/email-verification-card.tsx +89 -0
- package/templates/modules/auth/tanstack/src/components/auth/forgot-password-form.tsx +131 -0
- package/templates/modules/auth/tanstack/src/components/auth/reset-password-form.tsx +149 -0
- package/templates/modules/auth/tanstack/src/components/auth/sign-in-form.tsx +44 -35
- package/templates/modules/auth/tanstack/src/components/auth/sign-out-button.tsx +7 -6
- package/templates/modules/auth/tanstack/src/components/auth/sign-up-form.tsx +37 -34
- package/templates/modules/auth/tanstack/src/components/auth/social-buttons.tsx +71 -0
- package/templates/modules/auth/tanstack/src/lib/auth-client.ts +2 -2
- package/templates/modules/auth/tanstack/src/lib/auth-functions.ts +14 -8
- package/templates/modules/auth/tanstack/src/lib/auth-schema.ts +27 -2
- package/templates/modules/auth/tanstack/src/lib/auth.ts.hbs +98 -38
- package/templates/modules/auth/tanstack/src/lib/email.ts +43 -0
- package/templates/modules/auth/tanstack/src/routeTree.gen.ts +61 -3
- package/templates/modules/auth/tanstack/src/routes/api/auth/$.ts +15 -15
- package/templates/modules/auth/tanstack/src/routes/dashboard.tsx +119 -111
- package/templates/modules/auth/tanstack/src/routes/forgot-password.tsx +17 -0
- package/templates/modules/auth/tanstack/src/routes/reset-password.tsx +25 -0
- package/templates/modules/auth/tanstack/src/routes/sign-in.tsx +44 -37
- package/templates/modules/auth/tanstack/src/routes/sign-up.tsx +44 -37
- package/templates/modules/docker/.dockerignore +2 -0
- package/templates/modules/docker/config.json +15 -15
- package/templates/modules/drizzle/express/config.json +26 -26
- package/templates/modules/drizzle/express/src/lib/schema.ts.hbs +90 -0
- package/templates/modules/drizzle/nestjs/config.json +26 -26
- package/templates/modules/drizzle/nestjs/src/database/schema.ts.hbs +90 -0
- package/templates/modules/drizzle/nextjs/config.json +26 -26
- package/templates/modules/drizzle/nextjs/drizzle.config.ts +13 -13
- package/templates/modules/drizzle/tanstack/config.json +26 -26
- package/templates/modules/drizzle/tanstack/drizzle.config.ts +12 -12
- package/templates/modules/drizzle/tanstack/src/lib/db.ts +13 -13
- package/templates/modules/mongoose/express/config.json +15 -15
- package/templates/modules/mongoose/express/src/lib/db.ts +43 -43
- package/templates/modules/mongoose/express/src/models/User.ts +48 -48
- package/templates/modules/mongoose/nestjs/config.json +16 -15
- package/templates/modules/mongoose/nextjs/config.json +15 -15
- package/templates/modules/mongoose/nextjs/models/User.ts +48 -48
- package/templates/modules/mongoose/tanstack/config.json +16 -16
- package/templates/modules/mongoose/tanstack/src/models/User.ts +48 -48
- package/templates/modules/prisma/express/config.json +27 -27
- package/templates/modules/prisma/express/prisma/schema.prisma.hbs +92 -0
- package/templates/modules/prisma/nestjs/config.json +27 -27
- package/templates/modules/prisma/nestjs/prisma/schema.prisma.hbs +91 -0
- package/templates/modules/prisma/nextjs/config.json +28 -28
- package/templates/modules/prisma/nextjs/lib/prisma.ts +18 -18
- package/templates/modules/prisma/nextjs/prisma.config.ts +14 -14
- package/templates/modules/prisma/tanstack/config.json +28 -28
- package/templates/modules/prisma/tanstack/prisma/schema.prisma.hbs +91 -91
- package/templates/modules/prisma/tanstack/prisma.config.ts +14 -14
- package/templates/modules/prisma/tanstack/src/lib/prisma.ts +17 -17
- package/templates/modules/rate-limit/express/src/middleware/rateLimit.ts +0 -8
- package/templates/modules/vscode/.vscode/extensions.json.hbs +29 -0
- package/templates/modules/vscode/.vscode/settings.json.hbs +22 -0
- package/templates/modules/vscode/config.json +10 -0
- package/templates/modules/auth/express/src/controllers/authController.ts.hbs +0 -116
- package/templates/modules/auth/express/src/lib/jwt.ts.hbs +0 -27
- package/templates/modules/auth/express/src/middleware/requireAuth.ts.hbs +0 -25
- package/templates/modules/auth/express/src/routes/auth.ts.hbs +0 -27
- package/templates/modules/auth/express/src/services/userStore.ts.hbs +0 -117
- package/templates/modules/auth/nestjs/src/auth/auth.controller.ts.hbs +0 -61
- package/templates/modules/auth/nestjs/src/auth/auth.guard.ts +0 -36
- package/templates/modules/auth/nestjs/src/auth/auth.schemas.ts +0 -35
- package/templates/modules/auth/nestjs/src/auth/auth.service.ts +0 -70
- package/templates/modules/auth/nestjs/src/auth/jwt.ts +0 -27
- package/templates/modules/auth/nestjs/src/auth/users.service.ts.hbs +0 -144
- package/templates/modules/auth/nestjs/src/auth/zod-validation.pipe.ts +0 -16
- package/templates/modules/drizzle/express/src/lib/schema.ts +0 -12
- package/templates/modules/drizzle/nestjs/src/database/schema.ts +0 -12
- package/templates/modules/prisma/express/prisma/schema.prisma +0 -24
- package/templates/modules/prisma/nestjs/prisma/schema.prisma +0 -23
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { config } from "dotenv";
|
|
2
|
-
import { drizzle } from "drizzle-orm/node-postgres";
|
|
3
|
-
import { Pool } from "pg";
|
|
4
|
-
|
|
5
|
-
import * as schema from "./schema";
|
|
6
|
-
|
|
7
|
-
config({ path: ".env" }); // or .env.local
|
|
8
|
-
|
|
9
|
-
const pool = new Pool({
|
|
10
|
-
connectionString: process.env.DATABASE_URL,
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export const db = drizzle(pool, { schema });
|
|
1
|
+
import { config } from "dotenv";
|
|
2
|
+
import { drizzle } from "drizzle-orm/node-postgres";
|
|
3
|
+
import { Pool } from "pg";
|
|
4
|
+
|
|
5
|
+
import * as schema from "./schema";
|
|
6
|
+
|
|
7
|
+
config({ path: ".env" }); // or .env.local
|
|
8
|
+
|
|
9
|
+
const pool = new Pool({
|
|
10
|
+
connectionString: process.env.DATABASE_URL,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const db = drizzle(pool, { schema });
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "mongoose",
|
|
3
|
-
"name": "Mongoose (MongoDB)",
|
|
4
|
-
"description": "MongoDB database integration for Express using Mongoose ODM",
|
|
5
|
-
"type": "database",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"mongoose": "^9.11.4",
|
|
8
|
-
"mongodb": "^7.8.0"
|
|
9
|
-
},
|
|
10
|
-
"devDependencies": {},
|
|
11
|
-
"scripts": {},
|
|
12
|
-
"envVars": {
|
|
13
|
-
"MONGODB_URI": "mongodb://localhost:27017/myapp"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "mongoose",
|
|
3
|
+
"name": "Mongoose (MongoDB)",
|
|
4
|
+
"description": "MongoDB database integration for Express using Mongoose ODM",
|
|
5
|
+
"type": "database",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"mongoose": "^9.11.4",
|
|
8
|
+
"mongodb": "^7.8.0"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {},
|
|
11
|
+
"scripts": {},
|
|
12
|
+
"envVars": {
|
|
13
|
+
"MONGODB_URI": "mongodb://localhost:27017/myapp"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import mongoose from "mongoose";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* MongoDB connection configuration
|
|
5
|
-
*/
|
|
6
|
-
const connectDB = async (): Promise<void> => {
|
|
7
|
-
try {
|
|
8
|
-
const mongoUri = process.env.MONGODB_URI;
|
|
9
|
-
|
|
10
|
-
if (!mongoUri) {
|
|
11
|
-
throw new Error("MONGODB_URI environment variable is not defined");
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
await mongoose.connect(mongoUri);
|
|
15
|
-
|
|
16
|
-
console.log("MongoDB connected successfully");
|
|
17
|
-
|
|
18
|
-
mongoose.connection.on("error", (error) => {
|
|
19
|
-
console.error("MongoDB connection error:", error);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
mongoose.connection.on("disconnected", () => {
|
|
23
|
-
console.log("MongoDB disconnected");
|
|
24
|
-
});
|
|
25
|
-
} catch (error) {
|
|
26
|
-
console.error("Failed to connect to MongoDB:", error);
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Gracefully close MongoDB connection
|
|
33
|
-
*/
|
|
34
|
-
const disconnectDB = async (): Promise<void> => {
|
|
35
|
-
try {
|
|
36
|
-
await mongoose.connection.close();
|
|
37
|
-
console.log("MongoDB connection closed");
|
|
38
|
-
} catch (error) {
|
|
39
|
-
console.error("Error closing MongoDB connection:", error);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export { connectDB, disconnectDB };
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MongoDB connection configuration
|
|
5
|
+
*/
|
|
6
|
+
const connectDB = async (): Promise<void> => {
|
|
7
|
+
try {
|
|
8
|
+
const mongoUri = process.env.MONGODB_URI;
|
|
9
|
+
|
|
10
|
+
if (!mongoUri) {
|
|
11
|
+
throw new Error("MONGODB_URI environment variable is not defined");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
await mongoose.connect(mongoUri);
|
|
15
|
+
|
|
16
|
+
console.log("MongoDB connected successfully");
|
|
17
|
+
|
|
18
|
+
mongoose.connection.on("error", (error) => {
|
|
19
|
+
console.error("MongoDB connection error:", error);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
mongoose.connection.on("disconnected", () => {
|
|
23
|
+
console.log("MongoDB disconnected");
|
|
24
|
+
});
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error("Failed to connect to MongoDB:", error);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Gracefully close MongoDB connection
|
|
33
|
+
*/
|
|
34
|
+
const disconnectDB = async (): Promise<void> => {
|
|
35
|
+
try {
|
|
36
|
+
await mongoose.connection.close();
|
|
37
|
+
console.log("MongoDB connection closed");
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error("Error closing MongoDB connection:", error);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { connectDB, disconnectDB };
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import mongoose, { type Model, Schema } from "mongoose";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* User document interface
|
|
5
|
-
*/
|
|
6
|
-
export interface IUser {
|
|
7
|
-
email: string;
|
|
8
|
-
name?: string | null;
|
|
9
|
-
password: string;
|
|
10
|
-
createdAt: Date;
|
|
11
|
-
updatedAt: Date;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* User schema definition
|
|
16
|
-
*/
|
|
17
|
-
const userSchema = new Schema<IUser>(
|
|
18
|
-
{
|
|
19
|
-
email: {
|
|
20
|
-
type: String,
|
|
21
|
-
required: true,
|
|
22
|
-
unique: true,
|
|
23
|
-
lowercase: true,
|
|
24
|
-
trim: true,
|
|
25
|
-
},
|
|
26
|
-
name: {
|
|
27
|
-
type: String,
|
|
28
|
-
trim: true,
|
|
29
|
-
},
|
|
30
|
-
password: {
|
|
31
|
-
type: String,
|
|
32
|
-
required: true,
|
|
33
|
-
minlength: 6,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
timestamps: true,
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* User model
|
|
43
|
-
*/
|
|
44
|
-
const User =
|
|
45
|
-
(mongoose.models.User as Model<IUser> | undefined) ??
|
|
46
|
-
mongoose.model<IUser>("User", userSchema);
|
|
47
|
-
|
|
48
|
-
export default User;
|
|
1
|
+
import mongoose, { type Model, Schema } from "mongoose";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* User document interface
|
|
5
|
+
*/
|
|
6
|
+
export interface IUser {
|
|
7
|
+
email: string;
|
|
8
|
+
name?: string | null;
|
|
9
|
+
password: string;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
updatedAt: Date;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* User schema definition
|
|
16
|
+
*/
|
|
17
|
+
const userSchema = new Schema<IUser>(
|
|
18
|
+
{
|
|
19
|
+
email: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: true,
|
|
22
|
+
unique: true,
|
|
23
|
+
lowercase: true,
|
|
24
|
+
trim: true,
|
|
25
|
+
},
|
|
26
|
+
name: {
|
|
27
|
+
type: String,
|
|
28
|
+
trim: true,
|
|
29
|
+
},
|
|
30
|
+
password: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: true,
|
|
33
|
+
minlength: 6,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
timestamps: true,
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* User model
|
|
43
|
+
*/
|
|
44
|
+
const User =
|
|
45
|
+
(mongoose.models.User as Model<IUser> | undefined) ??
|
|
46
|
+
mongoose.model<IUser>("User", userSchema);
|
|
47
|
+
|
|
48
|
+
export default User;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "mongoose",
|
|
3
|
-
"name": "Mongoose (MongoDB)",
|
|
4
|
-
"description": "MongoDB database integration for NestJS using Mongoose ODM",
|
|
5
|
-
"type": "database",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"@nestjs/mongoose": "^12.0.0",
|
|
8
|
-
"mongoose": "^9.11.4"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "mongoose",
|
|
3
|
+
"name": "Mongoose (MongoDB)",
|
|
4
|
+
"description": "MongoDB database integration for NestJS using Mongoose ODM",
|
|
5
|
+
"type": "database",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@nestjs/mongoose": "^12.0.0",
|
|
8
|
+
"mongoose": "^9.11.4",
|
|
9
|
+
"mongodb": "^7.8.0"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {},
|
|
12
|
+
"scripts": {},
|
|
13
|
+
"envVars": {
|
|
14
|
+
"MONGODB_URI": "mongodb://localhost:27017/myapp"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "mongoose",
|
|
3
|
-
"name": "Mongoose (MongoDB)",
|
|
4
|
-
"description": "MongoDB database integration for Next.js using Mongoose ODM",
|
|
5
|
-
"type": "database",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"mongoose": "^9.11.4",
|
|
8
|
-
"mongodb": "^7.8.0"
|
|
9
|
-
},
|
|
10
|
-
"devDependencies": {},
|
|
11
|
-
"scripts": {},
|
|
12
|
-
"envVars": {
|
|
13
|
-
"MONGODB_URI": "mongodb://localhost:27017/myapp"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "mongoose",
|
|
3
|
+
"name": "Mongoose (MongoDB)",
|
|
4
|
+
"description": "MongoDB database integration for Next.js using Mongoose ODM",
|
|
5
|
+
"type": "database",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"mongoose": "^9.11.4",
|
|
8
|
+
"mongodb": "^7.8.0"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {},
|
|
11
|
+
"scripts": {},
|
|
12
|
+
"envVars": {
|
|
13
|
+
"MONGODB_URI": "mongodb://localhost:27017/myapp"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import mongoose, { type Model, Schema } from "mongoose";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* User document interface
|
|
5
|
-
*/
|
|
6
|
-
export interface IUser {
|
|
7
|
-
email: string;
|
|
8
|
-
name?: string | null;
|
|
9
|
-
password: string;
|
|
10
|
-
createdAt: Date;
|
|
11
|
-
updatedAt: Date;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* User schema definition
|
|
16
|
-
*/
|
|
17
|
-
const userSchema = new Schema<IUser>(
|
|
18
|
-
{
|
|
19
|
-
email: {
|
|
20
|
-
type: String,
|
|
21
|
-
required: true,
|
|
22
|
-
unique: true,
|
|
23
|
-
lowercase: true,
|
|
24
|
-
trim: true,
|
|
25
|
-
},
|
|
26
|
-
name: {
|
|
27
|
-
type: String,
|
|
28
|
-
trim: true,
|
|
29
|
-
},
|
|
30
|
-
password: {
|
|
31
|
-
type: String,
|
|
32
|
-
required: true,
|
|
33
|
-
minlength: 6,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
timestamps: true,
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* User model
|
|
43
|
-
*/
|
|
44
|
-
const User =
|
|
45
|
-
(mongoose.models.User as Model<IUser> | undefined) ??
|
|
46
|
-
mongoose.model<IUser>("User", userSchema);
|
|
47
|
-
|
|
48
|
-
export default User;
|
|
1
|
+
import mongoose, { type Model, Schema } from "mongoose";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* User document interface
|
|
5
|
+
*/
|
|
6
|
+
export interface IUser {
|
|
7
|
+
email: string;
|
|
8
|
+
name?: string | null;
|
|
9
|
+
password: string;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
updatedAt: Date;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* User schema definition
|
|
16
|
+
*/
|
|
17
|
+
const userSchema = new Schema<IUser>(
|
|
18
|
+
{
|
|
19
|
+
email: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: true,
|
|
22
|
+
unique: true,
|
|
23
|
+
lowercase: true,
|
|
24
|
+
trim: true,
|
|
25
|
+
},
|
|
26
|
+
name: {
|
|
27
|
+
type: String,
|
|
28
|
+
trim: true,
|
|
29
|
+
},
|
|
30
|
+
password: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: true,
|
|
33
|
+
minlength: 6,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
timestamps: true,
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* User model
|
|
43
|
+
*/
|
|
44
|
+
const User =
|
|
45
|
+
(mongoose.models.User as Model<IUser> | undefined) ??
|
|
46
|
+
mongoose.model<IUser>("User", userSchema);
|
|
47
|
+
|
|
48
|
+
export default User;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "mongoose",
|
|
3
|
-
"name": "Mongoose (MongoDB)",
|
|
4
|
-
"description": "MongoDB database integration for TanStack Start using Mongoose ODM",
|
|
5
|
-
"type": "database",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"mongoose": "^9.11.4",
|
|
8
|
-
"mongodb": "^7.8.0",
|
|
9
|
-
"dotenv": "^17.4.2"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {},
|
|
12
|
-
"scripts": {},
|
|
13
|
-
"envVars": {
|
|
14
|
-
"MONGODB_URI": "mongodb://localhost:27017/myapp"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "mongoose",
|
|
3
|
+
"name": "Mongoose (MongoDB)",
|
|
4
|
+
"description": "MongoDB database integration for TanStack Start using Mongoose ODM",
|
|
5
|
+
"type": "database",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"mongoose": "^9.11.4",
|
|
8
|
+
"mongodb": "^7.8.0",
|
|
9
|
+
"dotenv": "^17.4.2"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {},
|
|
12
|
+
"scripts": {},
|
|
13
|
+
"envVars": {
|
|
14
|
+
"MONGODB_URI": "mongodb://localhost:27017/myapp"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import mongoose, { type Model, Schema } from "mongoose";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* User document interface
|
|
5
|
-
*/
|
|
6
|
-
export interface IUser {
|
|
7
|
-
email: string;
|
|
8
|
-
name?: string | null;
|
|
9
|
-
password: string;
|
|
10
|
-
createdAt: Date;
|
|
11
|
-
updatedAt: Date;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* User schema definition
|
|
16
|
-
*/
|
|
17
|
-
const userSchema = new Schema<IUser>(
|
|
18
|
-
{
|
|
19
|
-
email: {
|
|
20
|
-
type: String,
|
|
21
|
-
required: true,
|
|
22
|
-
unique: true,
|
|
23
|
-
lowercase: true,
|
|
24
|
-
trim: true,
|
|
25
|
-
},
|
|
26
|
-
name: {
|
|
27
|
-
type: String,
|
|
28
|
-
trim: true,
|
|
29
|
-
},
|
|
30
|
-
password: {
|
|
31
|
-
type: String,
|
|
32
|
-
required: true,
|
|
33
|
-
minlength: 6,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
timestamps: true,
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* User model
|
|
43
|
-
*/
|
|
44
|
-
const User =
|
|
45
|
-
(mongoose.models.User as Model<IUser> | undefined) ??
|
|
46
|
-
mongoose.model<IUser>("User", userSchema);
|
|
47
|
-
|
|
48
|
-
export default User;
|
|
1
|
+
import mongoose, { type Model, Schema } from "mongoose";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* User document interface
|
|
5
|
+
*/
|
|
6
|
+
export interface IUser {
|
|
7
|
+
email: string;
|
|
8
|
+
name?: string | null;
|
|
9
|
+
password: string;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
updatedAt: Date;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* User schema definition
|
|
16
|
+
*/
|
|
17
|
+
const userSchema = new Schema<IUser>(
|
|
18
|
+
{
|
|
19
|
+
email: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: true,
|
|
22
|
+
unique: true,
|
|
23
|
+
lowercase: true,
|
|
24
|
+
trim: true,
|
|
25
|
+
},
|
|
26
|
+
name: {
|
|
27
|
+
type: String,
|
|
28
|
+
trim: true,
|
|
29
|
+
},
|
|
30
|
+
password: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: true,
|
|
33
|
+
minlength: 6,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
timestamps: true,
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* User model
|
|
43
|
+
*/
|
|
44
|
+
const User =
|
|
45
|
+
(mongoose.models.User as Model<IUser> | undefined) ??
|
|
46
|
+
mongoose.model<IUser>("User", userSchema);
|
|
47
|
+
|
|
48
|
+
export default User;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "prisma",
|
|
3
|
-
"name": "Prisma ORM",
|
|
4
|
-
"description": "Prisma ORM with PostgreSQL database support",
|
|
5
|
-
"type": "database",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"@prisma/adapter-pg": "^7.10.1",
|
|
8
|
-
"@prisma/client": "^7.10.1"
|
|
9
|
-
},
|
|
10
|
-
"devDependencies": {
|
|
11
|
-
"prisma": "^7.10.1"
|
|
12
|
-
},
|
|
13
|
-
"scripts": {
|
|
14
|
-
"prisma:generate": "prisma generate",
|
|
15
|
-
"prisma:migrate": "prisma migrate dev",
|
|
16
|
-
"prisma:studio": "prisma studio",
|
|
17
|
-
"pretype:check": "prisma generate",
|
|
18
|
-
"prebuild": "prisma generate"
|
|
19
|
-
},
|
|
20
|
-
"envVars": {
|
|
21
|
-
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres?schema=public"
|
|
22
|
-
},
|
|
23
|
-
"overrides": {
|
|
24
|
-
"deepmerge-ts": "^8.0.2",
|
|
25
|
-
"mysql2": "^3.24.6"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "prisma",
|
|
3
|
+
"name": "Prisma ORM",
|
|
4
|
+
"description": "Prisma ORM with PostgreSQL database support",
|
|
5
|
+
"type": "database",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@prisma/adapter-pg": "^7.10.1",
|
|
8
|
+
"@prisma/client": "^7.10.1"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"prisma": "^7.10.1"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"prisma:generate": "prisma generate",
|
|
15
|
+
"prisma:migrate": "prisma migrate dev",
|
|
16
|
+
"prisma:studio": "prisma studio",
|
|
17
|
+
"pretype:check": "prisma generate",
|
|
18
|
+
"prebuild": "prisma generate"
|
|
19
|
+
},
|
|
20
|
+
"envVars": {
|
|
21
|
+
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres?schema=public"
|
|
22
|
+
},
|
|
23
|
+
"overrides": {
|
|
24
|
+
"deepmerge-ts": "^8.0.2",
|
|
25
|
+
"mysql2": "^3.24.6"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Prisma schema file
|
|
2
|
+
// Learn more: https://pris.ly/d/prisma-schema
|
|
3
|
+
|
|
4
|
+
generator client {
|
|
5
|
+
provider = "prisma-client"
|
|
6
|
+
moduleFormat = "cjs"
|
|
7
|
+
output = "../src/generated/prisma"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
datasource db {
|
|
11
|
+
provider = "postgresql"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
{{#if useAuth}}
|
|
15
|
+
// Better Auth tables
|
|
16
|
+
model User {
|
|
17
|
+
id String @id
|
|
18
|
+
name String
|
|
19
|
+
email String
|
|
20
|
+
emailVerified Boolean @default(false)
|
|
21
|
+
image String?
|
|
22
|
+
createdAt DateTime @default(now())
|
|
23
|
+
updatedAt DateTime @updatedAt
|
|
24
|
+
sessions Session[]
|
|
25
|
+
accounts Account[]
|
|
26
|
+
|
|
27
|
+
@@unique([email])
|
|
28
|
+
@@map("user")
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
model Session {
|
|
32
|
+
id String @id
|
|
33
|
+
expiresAt DateTime
|
|
34
|
+
token String
|
|
35
|
+
createdAt DateTime @default(now())
|
|
36
|
+
updatedAt DateTime @updatedAt
|
|
37
|
+
ipAddress String?
|
|
38
|
+
userAgent String?
|
|
39
|
+
userId String
|
|
40
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
41
|
+
|
|
42
|
+
@@unique([token])
|
|
43
|
+
@@index([userId])
|
|
44
|
+
@@map("session")
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
model Account {
|
|
48
|
+
id String @id
|
|
49
|
+
accountId String
|
|
50
|
+
providerId String
|
|
51
|
+
userId String
|
|
52
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
53
|
+
accessToken String?
|
|
54
|
+
refreshToken String?
|
|
55
|
+
idToken String?
|
|
56
|
+
accessTokenExpiresAt DateTime?
|
|
57
|
+
refreshTokenExpiresAt DateTime?
|
|
58
|
+
scope String?
|
|
59
|
+
password String?
|
|
60
|
+
createdAt DateTime @default(now())
|
|
61
|
+
updatedAt DateTime @updatedAt
|
|
62
|
+
|
|
63
|
+
@@index([userId])
|
|
64
|
+
@@unique([providerId, accountId])
|
|
65
|
+
@@map("account")
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
model Verification {
|
|
69
|
+
id String @id
|
|
70
|
+
identifier String
|
|
71
|
+
value String
|
|
72
|
+
expiresAt DateTime
|
|
73
|
+
createdAt DateTime @default(now())
|
|
74
|
+
updatedAt DateTime @updatedAt
|
|
75
|
+
|
|
76
|
+
@@index([identifier])
|
|
77
|
+
@@map("verification")
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
{{else}}
|
|
81
|
+
// Sample User model
|
|
82
|
+
model User {
|
|
83
|
+
id String @id @default(uuid())
|
|
84
|
+
email String @unique
|
|
85
|
+
name String?
|
|
86
|
+
password String
|
|
87
|
+
createdAt DateTime @default(now())
|
|
88
|
+
updatedAt DateTime @updatedAt
|
|
89
|
+
|
|
90
|
+
@@map("users")
|
|
91
|
+
}
|
|
92
|
+
{{/if}}
|