better-ts-stack 2.0.2 → 2.1.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 +114 -113
- package/dist/args.js +27 -20
- package/dist/builder/buildPlanner.js +1 -1
- package/dist/builder/configGenerator.js +4 -6
- package/dist/builder/index.js +15 -3
- package/dist/builder/moduleSelector.js +6 -2
- package/dist/builder/readmeGenerator.js +107 -0
- package/dist/builder/templateContext.js +53 -0
- package/dist/index.js +7 -1
- package/dist/output/nextSteps.js +23 -22
- package/dist/prompts/index.js +5 -2
- package/dist/prompts/stack.js +23 -2
- package/dist/types/index.js +2 -0
- package/dist/ui/messages.js +3 -1
- package/dist/validators/index.js +5 -2
- package/package.json +3 -3
- package/templates/backend/express/config.json +42 -40
- package/templates/backend/express/gitignore +3 -0
- package/templates/backend/express/src/env.ts.hbs +39 -0
- package/templates/backend/express/src/index.ts.hbs +111 -75
- package/templates/backend/nestjs/config.json +43 -41
- package/templates/backend/nestjs/gitignore +3 -0
- package/templates/backend/nestjs/src/app.module.ts.hbs +13 -0
- package/templates/backend/nestjs/src/env.ts.hbs +39 -0
- package/templates/backend/nestjs/src/health/{health.controller.ts → health.controller.ts.hbs} +8 -0
- package/templates/backend/nestjs/src/main.ts +3 -2
- package/templates/frontend/nextjs/app/page.tsx.hbs +98 -97
- package/templates/frontend/nextjs/config.json +12 -14
- package/templates/frontend/nextjs/gitignore +3 -0
- package/templates/frontend/tanstack/config.json +16 -16
- package/templates/frontend/tanstack/gitignore +3 -0
- package/templates/frontend/tanstack/src/routes/index.tsx.hbs +102 -101
- package/templates/frontend/tanstack/vite.config.ts +23 -14
- package/templates/modules/auth/express/config.json +20 -20
- package/templates/modules/auth/express/src/middleware/requireAuth.ts.hbs +1 -2
- package/templates/modules/auth/express/src/routes/auth.ts.hbs +27 -19
- package/templates/modules/auth/nestjs/config.json +20 -20
- package/templates/modules/auth/nestjs/src/auth/{auth.controller.ts → auth.controller.ts.hbs} +15 -0
- package/templates/modules/auth/nextjs/config.json +4 -4
- package/templates/{frontend/nextjs/proxy.ts.hbs → modules/auth/nextjs/proxy.ts} +1 -8
- package/templates/modules/auth/tanstack/config.json +4 -4
- package/templates/modules/auth/tanstack/src/components/auth/sign-in-form.tsx +132 -134
- package/templates/modules/auth/tanstack/src/components/auth/sign-out-button.tsx +46 -48
- package/templates/modules/auth/tanstack/src/components/auth/sign-up-form.tsx +150 -152
- package/templates/modules/ci/.github/workflows/ci.yml.hbs +43 -0
- package/templates/modules/ci/config.json +10 -0
- package/templates/modules/docker/.dockerignore +2 -0
- package/templates/modules/docker/Dockerfile.hbs +147 -136
- package/templates/modules/docker/docker-compose.yml.hbs +97 -2
- package/templates/modules/drizzle/express/config.json +3 -3
- package/templates/modules/drizzle/nestjs/config.json +3 -3
- package/templates/modules/drizzle/nextjs/config.json +3 -3
- package/templates/modules/drizzle/tanstack/config.json +3 -3
- package/templates/modules/mongoose/express/config.json +2 -2
- package/templates/modules/mongoose/nestjs/config.json +1 -1
- package/templates/modules/mongoose/nextjs/config.json +2 -2
- package/templates/modules/mongoose/tanstack/config.json +2 -2
- package/templates/modules/prisma/express/config.json +4 -4
- package/templates/modules/prisma/express/prisma.config.ts +4 -2
- package/templates/modules/prisma/nestjs/config.json +4 -4
- package/templates/modules/prisma/nestjs/prisma.config.ts +4 -2
- package/templates/modules/prisma/nextjs/config.json +4 -4
- package/templates/modules/prisma/nextjs/prisma.config.ts +4 -2
- package/templates/modules/prisma/tanstack/config.json +4 -4
- package/templates/modules/prisma/tanstack/prisma.config.ts +4 -2
- package/templates/modules/rate-limit/express/config.json +12 -0
- package/templates/modules/rate-limit/express/src/middleware/rateLimit.ts +23 -0
- package/templates/modules/rate-limit/nestjs/config.json +12 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "dotenv/config";
|
|
2
|
-
import { defineConfig
|
|
2
|
+
import { defineConfig } from "prisma/config";
|
|
3
3
|
|
|
4
4
|
export default defineConfig({
|
|
5
5
|
schema: "prisma/schema.prisma",
|
|
@@ -7,6 +7,8 @@ export default defineConfig({
|
|
|
7
7
|
path: "prisma/migrations",
|
|
8
8
|
},
|
|
9
9
|
datasource: {
|
|
10
|
-
|
|
10
|
+
// prisma generate needs no URL, so a build without .env (CI, a host) works.
|
|
11
|
+
// Commands that connect report the empty URL
|
|
12
|
+
url: process.env.DATABASE_URL ?? "",
|
|
11
13
|
},
|
|
12
14
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "rate-limit",
|
|
3
|
+
"name": "Rate limiting",
|
|
4
|
+
"description": "Per-IP request limits for Express with express-rate-limit",
|
|
5
|
+
"type": "feature",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"express-rate-limit": "^8.7.2"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {},
|
|
10
|
+
"scripts": {},
|
|
11
|
+
"envVars": {}
|
|
12
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { rateLimit } from "express-rate-limit";
|
|
2
|
+
|
|
3
|
+
// Limits count requests per client IP. Behind a reverse proxy or load
|
|
4
|
+
// balancer, set app.set("trust proxy", 1) so the real client IP is used.
|
|
5
|
+
const FIFTEEN_MINUTES = 15 * 60 * 1000;
|
|
6
|
+
|
|
7
|
+
// Every route: 100 requests per IP in 15 minutes. The health check is left out
|
|
8
|
+
// because Docker and load balancers call it on a schedule
|
|
9
|
+
export const apiLimiter = rateLimit({
|
|
10
|
+
windowMs: FIFTEEN_MINUTES,
|
|
11
|
+
limit: 100,
|
|
12
|
+
standardHeaders: "draft-8",
|
|
13
|
+
legacyHeaders: false,
|
|
14
|
+
skip: (req) => req.path === "/health",
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// Sign-up and login: 10 attempts per IP in 15 minutes, against password guessing
|
|
18
|
+
export const authLimiter = rateLimit({
|
|
19
|
+
windowMs: FIFTEEN_MINUTES,
|
|
20
|
+
limit: 10,
|
|
21
|
+
standardHeaders: "draft-8",
|
|
22
|
+
legacyHeaders: false,
|
|
23
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "rate-limit",
|
|
3
|
+
"name": "Rate limiting",
|
|
4
|
+
"description": "Per-IP request limits for NestJS with @nestjs/throttler",
|
|
5
|
+
"type": "feature",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@nestjs/throttler": "^6.7.1"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {},
|
|
10
|
+
"scripts": {},
|
|
11
|
+
"envVars": {}
|
|
12
|
+
}
|