better-ts-stack 1.1.3 → 2.0.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/README.md +113 -82
- package/dist/args.d.ts +12 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +90 -0
- package/dist/args.js.map +1 -0
- package/dist/builder/configGenerator.d.ts +1 -0
- package/dist/builder/configGenerator.d.ts.map +1 -1
- package/dist/builder/configGenerator.js +46 -6
- package/dist/builder/configGenerator.js.map +1 -1
- package/dist/builder/dependencyInstaller.d.ts.map +1 -1
- package/dist/builder/dependencyInstaller.js +8 -14
- package/dist/builder/dependencyInstaller.js.map +1 -1
- package/dist/builder/gitInitializer.d.ts.map +1 -1
- package/dist/builder/gitInitializer.js +8 -41
- package/dist/builder/gitInitializer.js.map +1 -1
- package/dist/builder/index.d.ts.map +1 -1
- package/dist/builder/index.js +27 -63
- package/dist/builder/index.js.map +1 -1
- package/dist/builder/moduleSelector.d.ts +1 -4
- package/dist/builder/moduleSelector.d.ts.map +1 -1
- package/dist/builder/moduleSelector.js +11 -15
- package/dist/builder/moduleSelector.js.map +1 -1
- package/dist/builder/templateContext.d.ts +2 -17
- package/dist/builder/templateContext.d.ts.map +1 -1
- package/dist/builder/templateContext.js +6 -5
- package/dist/builder/templateContext.js.map +1 -1
- package/dist/index.js +45 -20
- package/dist/index.js.map +1 -1
- package/dist/output/nextSteps.d.ts +1 -2
- package/dist/output/nextSteps.d.ts.map +1 -1
- package/dist/output/nextSteps.js +10 -19
- package/dist/output/nextSteps.js.map +1 -1
- package/dist/prompts/index.d.ts +3 -3
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +22 -58
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/stack.d.ts +3 -2
- package/dist/prompts/stack.d.ts.map +1 -1
- package/dist/prompts/stack.js +81 -70
- package/dist/prompts/stack.js.map +1 -1
- package/dist/types/index.d.ts +20 -42
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +40 -38
- package/dist/types/index.js.map +1 -1
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +19 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/messages.d.ts +9 -0
- package/dist/ui/messages.d.ts.map +1 -0
- package/dist/ui/messages.js +100 -0
- package/dist/ui/messages.js.map +1 -0
- package/dist/ui/prompts.d.ts +20 -0
- package/dist/ui/prompts.d.ts.map +1 -0
- package/dist/ui/prompts.js +71 -0
- package/dist/ui/prompts.js.map +1 -0
- package/dist/ui/theme.d.ts +9 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/theme.js +24 -0
- package/dist/ui/theme.js.map +1 -0
- package/dist/validators/index.d.ts +1 -0
- package/dist/validators/index.d.ts.map +1 -1
- package/dist/validators/index.js +6 -0
- package/dist/validators/index.js.map +1 -1
- package/package.json +70 -66
- package/templates/backend/express/config.json +44 -44
- package/templates/backend/express/eslint.config.mjs +40 -40
- package/templates/backend/express/gitignore +36 -36
- package/templates/backend/express/src/index.ts +76 -76
- package/templates/backend/express/src/routes/health.ts +12 -12
- package/templates/backend/express/tsconfig.json +25 -25
- package/templates/backend/nestjs/.prettierignore +52 -0
- package/templates/backend/nestjs/.prettierrc +16 -0
- package/templates/backend/nestjs/config.json +44 -0
- package/templates/backend/nestjs/eslint.config.mjs +40 -0
- package/templates/backend/nestjs/gitignore +36 -0
- package/templates/backend/nestjs/nest-cli.json +9 -0
- package/templates/backend/nestjs/src/app.module.ts.hbs +34 -0
- package/templates/backend/nestjs/src/health/health.controller.ts +12 -0
- package/templates/backend/nestjs/src/main.ts +23 -0
- package/templates/backend/nestjs/tsconfig.eslint.json +9 -0
- package/templates/backend/nestjs/tsconfig.json +25 -0
- package/templates/frontend/nextjs/app/layout.tsx +13 -13
- package/templates/frontend/nextjs/app/page.tsx.hbs +97 -97
- package/templates/frontend/nextjs/components/ui/button.tsx +51 -51
- package/templates/frontend/nextjs/components/ui/card.tsx +60 -60
- package/templates/frontend/nextjs/components/ui/field.tsx +67 -67
- package/templates/frontend/nextjs/components/ui/input.tsx +18 -18
- package/templates/frontend/nextjs/components.json +19 -19
- package/templates/frontend/nextjs/config.json +38 -38
- package/templates/frontend/nextjs/eslint.config.mjs +11 -11
- package/templates/frontend/nextjs/gitignore +42 -42
- package/templates/frontend/nextjs/lib/utils.ts +6 -6
- package/templates/frontend/nextjs/next.config.ts.hbs +12 -12
- package/templates/frontend/nextjs/proxy.ts.hbs +24 -24
- package/templates/frontend/nextjs/tsconfig.json +34 -34
- package/templates/frontend/tanstack/config.json +48 -48
- package/templates/frontend/tanstack/src/routeTree.gen.ts +68 -68
- package/templates/frontend/tanstack/src/styles/app.css +85 -85
- package/templates/modules/auth/express/config.json +27 -26
- package/templates/modules/auth/express/src/controllers/authController.ts.hbs +116 -130
- package/templates/modules/auth/express/src/middleware/requireAuth.ts.hbs +26 -26
- package/templates/modules/auth/express/src/services/userStore.ts.hbs +117 -117
- package/templates/modules/auth/nestjs/config.json +24 -0
- package/templates/modules/auth/nestjs/src/auth/auth.controller.ts +46 -0
- package/templates/modules/auth/nestjs/src/auth/auth.guard.ts +36 -0
- package/templates/modules/auth/nestjs/src/auth/auth.module.ts.hbs +22 -0
- package/templates/modules/auth/nestjs/src/auth/auth.schemas.ts +35 -0
- package/templates/modules/auth/nestjs/src/auth/auth.service.ts +70 -0
- package/templates/modules/auth/nestjs/src/auth/jwt.ts +27 -0
- package/templates/modules/auth/nestjs/src/auth/users.service.ts.hbs +144 -0
- package/templates/modules/auth/nestjs/src/auth/zod-validation.pipe.ts +16 -0
- package/templates/modules/auth/nextjs/app/dashboard/page.tsx +96 -96
- package/templates/modules/auth/nextjs/app/sign-in/page.tsx +35 -35
- package/templates/modules/auth/nextjs/app/sign-up/page.tsx +35 -35
- package/templates/modules/auth/nextjs/components/auth/sign-in-form.tsx +132 -132
- package/templates/modules/auth/nextjs/components/auth/sign-out-button.tsx +50 -50
- package/templates/modules/auth/nextjs/components/auth/sign-up-form.tsx +152 -152
- package/templates/modules/auth/nextjs/config.json +31 -31
- package/templates/modules/auth/nextjs/lib/auth-schema.ts +39 -39
- package/templates/modules/auth/nextjs/lib/auth.ts.hbs +37 -37
- package/templates/modules/auth/tanstack/src/lib/auth-functions.ts +4 -4
- package/templates/modules/auth/tanstack/src/routeTree.gen.ts +140 -140
- package/templates/modules/docker/.dockerignore +14 -14
- package/templates/modules/docker/Dockerfile.hbs +137 -130
- package/templates/modules/docker/config.json +19 -19
- package/templates/modules/docker/docker-compose.yml.hbs +9 -9
- package/templates/modules/drizzle/express/config.json +27 -27
- package/templates/modules/drizzle/express/drizzle.config.ts +13 -13
- package/templates/modules/drizzle/express/src/lib/db.ts +13 -13
- package/templates/modules/drizzle/express/src/lib/schema.ts +10 -10
- package/templates/modules/drizzle/nestjs/config.json +27 -0
- package/templates/modules/drizzle/nestjs/drizzle.config.ts +13 -0
- package/templates/modules/drizzle/nestjs/src/database/database.module.ts +30 -0
- package/templates/modules/drizzle/nestjs/src/database/schema.ts +10 -0
- package/templates/modules/drizzle/nextjs/config.json +29 -29
- package/templates/modules/drizzle/nextjs/lib/db.ts +13 -13
- package/templates/modules/drizzle/nextjs/lib/schema.ts.hbs +84 -84
- package/templates/modules/mongoose/express/config.json +16 -16
- package/templates/modules/mongoose/nestjs/config.json +16 -0
- package/templates/modules/mongoose/nestjs/src/users/user.schema.ts +21 -0
- package/templates/modules/mongoose/nextjs/config.json +16 -16
- package/templates/modules/mongoose/nextjs/lib/db.ts +36 -36
- package/templates/modules/mongoose/tanstack/config.json +17 -17
- package/templates/modules/mongoose/tanstack/src/lib/db.ts +37 -37
- package/templates/modules/prisma/express/config.json +28 -28
- package/templates/modules/prisma/express/prisma/schema.prisma +1 -1
- package/templates/modules/prisma/express/prisma.config.ts +12 -12
- package/templates/modules/prisma/express/src/lib/prisma.ts +24 -24
- package/templates/modules/prisma/nestjs/config.json +28 -0
- package/templates/modules/prisma/nestjs/prisma/schema.prisma +23 -0
- package/templates/modules/prisma/nestjs/prisma.config.ts +12 -0
- package/templates/modules/prisma/nestjs/src/prisma/prisma.module.ts +11 -0
- package/templates/modules/prisma/nestjs/src/prisma/prisma.service.ts +17 -0
- package/templates/modules/prisma/nextjs/config.json +29 -29
- package/templates/modules/prisma/nextjs/prisma/schema.prisma.hbs +91 -91
- package/templates/modules/prisma/tanstack/config.json +5 -5
- package/dist/intro.d.ts +0 -2
- package/dist/intro.d.ts.map +0 -1
- package/dist/intro.js +0 -27
- package/dist/intro.js.map +0 -1
- package/templates/backend/express/.eslintrc.js +0 -24
|
@@ -1,17 +1,17 @@
|
|
|
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.9.5",
|
|
8
|
-
"mongodb": "^7.6.0",
|
|
9
|
-
"dotenv": "^17.4.2"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {},
|
|
12
|
-
"scripts": {},
|
|
13
|
-
"envVars": {
|
|
14
|
-
"MONGODB_URI": "mongodb://localhost:27017/myapp"
|
|
15
|
-
},
|
|
16
|
-
"templateFiles": []
|
|
17
|
-
}
|
|
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.9.5",
|
|
8
|
+
"mongodb": "^7.6.0",
|
|
9
|
+
"dotenv": "^17.4.2"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {},
|
|
12
|
+
"scripts": {},
|
|
13
|
+
"envVars": {
|
|
14
|
+
"MONGODB_URI": "mongodb://localhost:27017/myapp"
|
|
15
|
+
},
|
|
16
|
+
"templateFiles": []
|
|
17
|
+
}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import "dotenv/config";
|
|
2
|
-
import mongoose from "mongoose";
|
|
3
|
-
|
|
4
|
-
// Reuse one connection across hot reloads and concurrent requests
|
|
5
|
-
const globalForMongoose = globalThis as unknown as {
|
|
6
|
-
mongooseConnection?: Promise<typeof mongoose>;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Connects Mongoose once and returns the shared connection.
|
|
11
|
-
* Call this in server code before querying Mongoose models.
|
|
12
|
-
*/
|
|
13
|
-
export async function connectDB(): Promise<typeof mongoose> {
|
|
14
|
-
const mongoUri = process.env.MONGODB_URI;
|
|
15
|
-
|
|
16
|
-
if (!mongoUri) {
|
|
17
|
-
throw new Error("MONGODB_URI environment variable is not defined");
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
globalForMongoose.mongooseConnection ??= mongoose
|
|
21
|
-
.connect(mongoUri)
|
|
22
|
-
.catch((error: unknown) => {
|
|
23
|
-
// Let the next call retry instead of caching the failure
|
|
24
|
-
globalForMongoose.mongooseConnection = undefined;
|
|
25
|
-
throw error;
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
return globalForMongoose.mongooseConnection;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Gracefully close the MongoDB connection
|
|
33
|
-
*/
|
|
34
|
-
export async function disconnectDB(): Promise<void> {
|
|
35
|
-
await mongoose.connection.close();
|
|
36
|
-
globalForMongoose.mongooseConnection = undefined;
|
|
37
|
-
}
|
|
1
|
+
import "dotenv/config";
|
|
2
|
+
import mongoose from "mongoose";
|
|
3
|
+
|
|
4
|
+
// Reuse one connection across hot reloads and concurrent requests
|
|
5
|
+
const globalForMongoose = globalThis as unknown as {
|
|
6
|
+
mongooseConnection?: Promise<typeof mongoose>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Connects Mongoose once and returns the shared connection.
|
|
11
|
+
* Call this in server code before querying Mongoose models.
|
|
12
|
+
*/
|
|
13
|
+
export async function connectDB(): Promise<typeof mongoose> {
|
|
14
|
+
const mongoUri = process.env.MONGODB_URI;
|
|
15
|
+
|
|
16
|
+
if (!mongoUri) {
|
|
17
|
+
throw new Error("MONGODB_URI environment variable is not defined");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
globalForMongoose.mongooseConnection ??= mongoose
|
|
21
|
+
.connect(mongoUri)
|
|
22
|
+
.catch((error: unknown) => {
|
|
23
|
+
// Let the next call retry instead of caching the failure
|
|
24
|
+
globalForMongoose.mongooseConnection = undefined;
|
|
25
|
+
throw error;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return globalForMongoose.mongooseConnection;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Gracefully close the MongoDB connection
|
|
33
|
+
*/
|
|
34
|
+
export async function disconnectDB(): Promise<void> {
|
|
35
|
+
await mongoose.connection.close();
|
|
36
|
+
globalForMongoose.mongooseConnection = undefined;
|
|
37
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
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.0",
|
|
8
|
-
"@prisma/client": "^7.10.0"
|
|
9
|
-
},
|
|
10
|
-
"devDependencies": {
|
|
11
|
-
"prisma": "^7.10.0"
|
|
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
|
-
"templateFiles": [],
|
|
24
|
-
"overrides": {
|
|
25
|
-
"deepmerge-ts": "^8.0.2",
|
|
26
|
-
"mysql2": "^3.24.3"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
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.0",
|
|
8
|
+
"@prisma/client": "^7.10.0"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"prisma": "^7.10.0"
|
|
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
|
+
"templateFiles": [],
|
|
24
|
+
"overrides": {
|
|
25
|
+
"deepmerge-ts": "^8.0.2",
|
|
26
|
+
"mysql2": "^3.24.3"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "dotenv/config";
|
|
2
|
-
import { defineConfig, env } from "prisma/config";
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
schema: "prisma/schema.prisma",
|
|
6
|
-
migrations: {
|
|
7
|
-
path: "prisma/migrations",
|
|
8
|
-
},
|
|
9
|
-
datasource: {
|
|
10
|
-
url: env("DATABASE_URL"),
|
|
11
|
-
},
|
|
12
|
-
});
|
|
1
|
+
import "dotenv/config";
|
|
2
|
+
import { defineConfig, env } from "prisma/config";
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
schema: "prisma/schema.prisma",
|
|
6
|
+
migrations: {
|
|
7
|
+
path: "prisma/migrations",
|
|
8
|
+
},
|
|
9
|
+
datasource: {
|
|
10
|
+
url: env("DATABASE_URL"),
|
|
11
|
+
},
|
|
12
|
+
});
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { PrismaPg } from "@prisma/adapter-pg";
|
|
2
|
-
import "dotenv/config";
|
|
3
|
-
|
|
4
|
-
import { PrismaClient } from "../generated/prisma/client";
|
|
5
|
-
|
|
6
|
-
const globalForPrisma = globalThis as unknown as {
|
|
7
|
-
prisma: PrismaClient | undefined;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const prisma =
|
|
11
|
-
globalForPrisma.prisma ??
|
|
12
|
-
new PrismaClient({
|
|
13
|
-
adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL! }),
|
|
14
|
-
log:
|
|
15
|
-
process.env.NODE_ENV === "development"
|
|
16
|
-
? ["query", "error", "warn"]
|
|
17
|
-
: ["error"],
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
|
|
21
|
-
|
|
22
|
-
export async function disconnectPrisma(): Promise<void> {
|
|
23
|
-
await prisma.$disconnect();
|
|
24
|
-
}
|
|
1
|
+
import { PrismaPg } from "@prisma/adapter-pg";
|
|
2
|
+
import "dotenv/config";
|
|
3
|
+
|
|
4
|
+
import { PrismaClient } from "../generated/prisma/client";
|
|
5
|
+
|
|
6
|
+
const globalForPrisma = globalThis as unknown as {
|
|
7
|
+
prisma: PrismaClient | undefined;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const prisma =
|
|
11
|
+
globalForPrisma.prisma ??
|
|
12
|
+
new PrismaClient({
|
|
13
|
+
adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL! }),
|
|
14
|
+
log:
|
|
15
|
+
process.env.NODE_ENV === "development"
|
|
16
|
+
? ["query", "error", "warn"]
|
|
17
|
+
: ["error"],
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;
|
|
21
|
+
|
|
22
|
+
export async function disconnectPrisma(): Promise<void> {
|
|
23
|
+
await prisma.$disconnect();
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "prisma",
|
|
3
|
+
"name": "Prisma ORM",
|
|
4
|
+
"description": "Prisma ORM for NestJS with PostgreSQL",
|
|
5
|
+
"type": "database",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@prisma/adapter-pg": "^7.10.0",
|
|
8
|
+
"@prisma/client": "^7.10.0"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"prisma": "^7.10.0"
|
|
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
|
+
"templateFiles": [],
|
|
24
|
+
"overrides": {
|
|
25
|
+
"deepmerge-ts": "^8.0.2",
|
|
26
|
+
"mysql2": "^3.24.3"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Prisma schema file
|
|
2
|
+
// Learn more: https://pris.ly/d/prisma-schema
|
|
3
|
+
|
|
4
|
+
generator client {
|
|
5
|
+
provider = "prisma-client"
|
|
6
|
+
output = "../src/generated/prisma"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
datasource db {
|
|
10
|
+
provider = "postgresql"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Sample User model
|
|
14
|
+
model User {
|
|
15
|
+
id String @id @default(uuid())
|
|
16
|
+
email String @unique
|
|
17
|
+
name String?
|
|
18
|
+
password String
|
|
19
|
+
createdAt DateTime @default(now())
|
|
20
|
+
updatedAt DateTime @updatedAt
|
|
21
|
+
|
|
22
|
+
@@map("users")
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Global, Module } from "@nestjs/common";
|
|
2
|
+
|
|
3
|
+
import { PrismaService } from "./prisma.service.js";
|
|
4
|
+
|
|
5
|
+
// Global so any module can inject PrismaService without importing this one
|
|
6
|
+
@Global()
|
|
7
|
+
@Module({
|
|
8
|
+
providers: [PrismaService],
|
|
9
|
+
exports: [PrismaService],
|
|
10
|
+
})
|
|
11
|
+
export class PrismaModule {}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Injectable, type OnModuleDestroy } from "@nestjs/common";
|
|
2
|
+
import { PrismaPg } from "@prisma/adapter-pg";
|
|
3
|
+
|
|
4
|
+
import { PrismaClient } from "../generated/prisma/client.js";
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class PrismaService extends PrismaClient implements OnModuleDestroy {
|
|
8
|
+
constructor() {
|
|
9
|
+
super({
|
|
10
|
+
adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL! }),
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async onModuleDestroy(): Promise<void> {
|
|
15
|
+
await this.$disconnect();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "prisma",
|
|
3
|
-
"name": "Prisma ORM",
|
|
4
|
-
"description": "Prisma ORM for Next.js with PostgreSQL",
|
|
5
|
-
"type": "database",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"@prisma/client": "^7.10.0",
|
|
8
|
-
"@prisma/adapter-pg": "^7.10.0"
|
|
9
|
-
},
|
|
10
|
-
"devDependencies": {
|
|
11
|
-
"prisma": "^7.10.0",
|
|
12
|
-
"dotenv": "^17.4.2"
|
|
13
|
-
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"prisma:generate": "prisma generate",
|
|
16
|
-
"prisma:migrate": "prisma migrate dev",
|
|
17
|
-
"prisma:studio": "prisma studio",
|
|
18
|
-
"pretype:check": "prisma generate",
|
|
19
|
-
"prebuild": "prisma generate"
|
|
20
|
-
},
|
|
21
|
-
"envVars": {
|
|
22
|
-
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres?schema=public"
|
|
23
|
-
},
|
|
24
|
-
"templateFiles": ["prisma/schema.prisma.hbs"],
|
|
25
|
-
"overrides": {
|
|
26
|
-
"deepmerge-ts": "^8.0.2",
|
|
27
|
-
"mysql2": "^3.24.3"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"id": "prisma",
|
|
3
|
+
"name": "Prisma ORM",
|
|
4
|
+
"description": "Prisma ORM for Next.js with PostgreSQL",
|
|
5
|
+
"type": "database",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@prisma/client": "^7.10.0",
|
|
8
|
+
"@prisma/adapter-pg": "^7.10.0"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"prisma": "^7.10.0",
|
|
12
|
+
"dotenv": "^17.4.2"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"prisma:generate": "prisma generate",
|
|
16
|
+
"prisma:migrate": "prisma migrate dev",
|
|
17
|
+
"prisma:studio": "prisma studio",
|
|
18
|
+
"pretype:check": "prisma generate",
|
|
19
|
+
"prebuild": "prisma generate"
|
|
20
|
+
},
|
|
21
|
+
"envVars": {
|
|
22
|
+
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres?schema=public"
|
|
23
|
+
},
|
|
24
|
+
"templateFiles": ["prisma/schema.prisma.hbs"],
|
|
25
|
+
"overrides": {
|
|
26
|
+
"deepmerge-ts": "^8.0.2",
|
|
27
|
+
"mysql2": "^3.24.3"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
// Prisma schema file
|
|
2
|
-
// Learn more: https://pris.ly/d/prisma-schema
|
|
3
|
-
|
|
4
|
-
generator client {
|
|
5
|
-
provider = "prisma-client"
|
|
6
|
-
output = "../generated"
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
datasource db {
|
|
10
|
-
provider = "postgresql"
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
{{#if useAuth}}
|
|
14
|
-
|
|
15
|
-
model User {
|
|
16
|
-
id String @id
|
|
17
|
-
name String
|
|
18
|
-
email String
|
|
19
|
-
emailVerified Boolean @default(false)
|
|
20
|
-
image String?
|
|
21
|
-
createdAt DateTime @default(now())
|
|
22
|
-
updatedAt DateTime @updatedAt
|
|
23
|
-
sessions Session[]
|
|
24
|
-
accounts Account[]
|
|
25
|
-
|
|
26
|
-
@@unique([email])
|
|
27
|
-
@@map("user")
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
model Session {
|
|
31
|
-
id String @id
|
|
32
|
-
expiresAt DateTime
|
|
33
|
-
token String
|
|
34
|
-
createdAt DateTime @default(now())
|
|
35
|
-
updatedAt DateTime @updatedAt
|
|
36
|
-
ipAddress String?
|
|
37
|
-
userAgent String?
|
|
38
|
-
userId String
|
|
39
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
40
|
-
|
|
41
|
-
@@unique([token])
|
|
42
|
-
@@index([userId])
|
|
43
|
-
@@map("session")
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
model Account {
|
|
47
|
-
id String @id
|
|
48
|
-
accountId String
|
|
49
|
-
providerId String
|
|
50
|
-
userId String
|
|
51
|
-
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
52
|
-
accessToken String?
|
|
53
|
-
refreshToken String?
|
|
54
|
-
idToken String?
|
|
55
|
-
accessTokenExpiresAt DateTime?
|
|
56
|
-
refreshTokenExpiresAt DateTime?
|
|
57
|
-
scope String?
|
|
58
|
-
password String?
|
|
59
|
-
createdAt DateTime @default(now())
|
|
60
|
-
updatedAt DateTime @updatedAt
|
|
61
|
-
|
|
62
|
-
@@index([userId])
|
|
63
|
-
@@unique([providerId, accountId])
|
|
64
|
-
@@map("account")
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
model Verification {
|
|
68
|
-
id String @id
|
|
69
|
-
identifier String
|
|
70
|
-
value String
|
|
71
|
-
expiresAt DateTime
|
|
72
|
-
createdAt DateTime @default(now())
|
|
73
|
-
updatedAt DateTime @updatedAt
|
|
74
|
-
|
|
75
|
-
@@index([identifier])
|
|
76
|
-
@@map("verification")
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
{{else}}
|
|
80
|
-
// Sample User model
|
|
81
|
-
model User {
|
|
82
|
-
id String @id @default(uuid())
|
|
83
|
-
email String @unique
|
|
84
|
-
name String?
|
|
85
|
-
password String
|
|
86
|
-
createdAt DateTime @default(now())
|
|
87
|
-
updatedAt DateTime @updatedAt
|
|
88
|
-
|
|
89
|
-
@@map("users")
|
|
90
|
-
}
|
|
91
|
-
{{/if}}
|
|
1
|
+
// Prisma schema file
|
|
2
|
+
// Learn more: https://pris.ly/d/prisma-schema
|
|
3
|
+
|
|
4
|
+
generator client {
|
|
5
|
+
provider = "prisma-client"
|
|
6
|
+
output = "../generated"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
datasource db {
|
|
10
|
+
provider = "postgresql"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
{{#if useAuth}}
|
|
14
|
+
|
|
15
|
+
model User {
|
|
16
|
+
id String @id
|
|
17
|
+
name String
|
|
18
|
+
email String
|
|
19
|
+
emailVerified Boolean @default(false)
|
|
20
|
+
image String?
|
|
21
|
+
createdAt DateTime @default(now())
|
|
22
|
+
updatedAt DateTime @updatedAt
|
|
23
|
+
sessions Session[]
|
|
24
|
+
accounts Account[]
|
|
25
|
+
|
|
26
|
+
@@unique([email])
|
|
27
|
+
@@map("user")
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
model Session {
|
|
31
|
+
id String @id
|
|
32
|
+
expiresAt DateTime
|
|
33
|
+
token String
|
|
34
|
+
createdAt DateTime @default(now())
|
|
35
|
+
updatedAt DateTime @updatedAt
|
|
36
|
+
ipAddress String?
|
|
37
|
+
userAgent String?
|
|
38
|
+
userId String
|
|
39
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
40
|
+
|
|
41
|
+
@@unique([token])
|
|
42
|
+
@@index([userId])
|
|
43
|
+
@@map("session")
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
model Account {
|
|
47
|
+
id String @id
|
|
48
|
+
accountId String
|
|
49
|
+
providerId String
|
|
50
|
+
userId String
|
|
51
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
52
|
+
accessToken String?
|
|
53
|
+
refreshToken String?
|
|
54
|
+
idToken String?
|
|
55
|
+
accessTokenExpiresAt DateTime?
|
|
56
|
+
refreshTokenExpiresAt DateTime?
|
|
57
|
+
scope String?
|
|
58
|
+
password String?
|
|
59
|
+
createdAt DateTime @default(now())
|
|
60
|
+
updatedAt DateTime @updatedAt
|
|
61
|
+
|
|
62
|
+
@@index([userId])
|
|
63
|
+
@@unique([providerId, accountId])
|
|
64
|
+
@@map("account")
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
model Verification {
|
|
68
|
+
id String @id
|
|
69
|
+
identifier String
|
|
70
|
+
value String
|
|
71
|
+
expiresAt DateTime
|
|
72
|
+
createdAt DateTime @default(now())
|
|
73
|
+
updatedAt DateTime @updatedAt
|
|
74
|
+
|
|
75
|
+
@@index([identifier])
|
|
76
|
+
@@map("verification")
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
{{else}}
|
|
80
|
+
// Sample User model
|
|
81
|
+
model User {
|
|
82
|
+
id String @id @default(uuid())
|
|
83
|
+
email String @unique
|
|
84
|
+
name String?
|
|
85
|
+
password String
|
|
86
|
+
createdAt DateTime @default(now())
|
|
87
|
+
updatedAt DateTime @updatedAt
|
|
88
|
+
|
|
89
|
+
@@map("users")
|
|
90
|
+
}
|
|
91
|
+
{{/if}}
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"prisma:generate": "prisma generate",
|
|
16
|
-
"prisma:migrate": "prisma migrate dev",
|
|
17
|
-
"prisma:studio": "prisma studio",
|
|
18
|
-
"pretype:check": "prisma generate",
|
|
19
|
-
"prebuild": "prisma generate"
|
|
16
|
+
"prisma:migrate": "prisma migrate dev",
|
|
17
|
+
"prisma:studio": "prisma studio",
|
|
18
|
+
"pretype:check": "prisma generate",
|
|
19
|
+
"prebuild": "prisma generate"
|
|
20
20
|
},
|
|
21
21
|
"envVars": {
|
|
22
22
|
"DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres?schema=public"
|
|
@@ -26,4 +26,4 @@
|
|
|
26
26
|
"deepmerge-ts": "^8.0.2",
|
|
27
27
|
"mysql2": "^3.24.3"
|
|
28
28
|
}
|
|
29
|
-
}
|
|
29
|
+
}
|
package/dist/intro.d.ts
DELETED
package/dist/intro.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intro.d.ts","sourceRoot":"","sources":["../src/intro.ts"],"names":[],"mappings":"AAKA,wBAAsB,oBAAoB,kBA6BzC"}
|
package/dist/intro.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
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.showInteractiveIntro = showInteractiveIntro;
|
|
7
|
-
// Better TS Stack - Interactive CLI Intro
|
|
8
|
-
const consola_1 = __importDefault(require("consola"));
|
|
9
|
-
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
10
|
-
async function showInteractiveIntro() {
|
|
11
|
-
console.clear();
|
|
12
|
-
// Subtle fade-in effect
|
|
13
|
-
console.log("\n");
|
|
14
|
-
await sleep(80);
|
|
15
|
-
consola_1.default.log(" \x1b[36m╭─────────────────────────────────────────╮\x1b[0m");
|
|
16
|
-
await sleep(50);
|
|
17
|
-
consola_1.default.log(" \x1b[36m│\x1b[0m \x1b[36m│\x1b[0m");
|
|
18
|
-
await sleep(50);
|
|
19
|
-
consola_1.default.log(" \x1b[36m│\x1b[0m \x1b[1m\x1b[96mBetter TS Stack\x1b[0m \x1b[36m│\x1b[0m");
|
|
20
|
-
await sleep(50);
|
|
21
|
-
consola_1.default.log(" \x1b[36m│\x1b[0m \x1b[36m│\x1b[0m");
|
|
22
|
-
await sleep(50);
|
|
23
|
-
consola_1.default.log(" \x1b[36m╰─────────────────────────────────────────╯\x1b[0m");
|
|
24
|
-
await sleep(150);
|
|
25
|
-
console.log("\n");
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=intro.js.map
|
package/dist/intro.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intro.js","sourceRoot":"","sources":["../src/intro.ts"],"names":[],"mappings":";;;;;AAKA,oDA6BC;AAlCD,0CAA0C;AAC1C,sDAA8B;AAE9B,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAEzE,KAAK,UAAU,oBAAoB;IACxC,OAAO,CAAC,KAAK,EAAE,CAAC;IAEhB,wBAAwB;IACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClB,MAAM,KAAK,CAAC,EAAE,CAAC,CAAC;IAEhB,iBAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;IAC5E,MAAM,KAAK,CAAC,EAAE,CAAC,CAAC;IAEhB,iBAAO,CAAC,GAAG,CACT,6EAA6E,CAC9E,CAAC;IACF,MAAM,KAAK,CAAC,EAAE,CAAC,CAAC;IAEhB,iBAAO,CAAC,GAAG,CACT,mGAAmG,CACpG,CAAC;IACF,MAAM,KAAK,CAAC,EAAE,CAAC,CAAC;IAEhB,iBAAO,CAAC,GAAG,CACT,6EAA6E,CAC9E,CAAC;IACF,MAAM,KAAK,CAAC,EAAE,CAAC,CAAC;IAEhB,iBAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;IAE5E,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC"}
|