better-ts-stack 2.0.1 → 2.1.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 +114 -113
- package/dist/args.js +24 -20
- package/dist/builder/buildPlanner.js +1 -1
- package/dist/builder/configGenerator.js +1 -5
- package/dist/builder/index.js +15 -3
- package/dist/builder/moduleSelector.js +4 -2
- package/dist/builder/readmeGenerator.js +101 -0
- package/dist/builder/templateContext.js +30 -0
- package/dist/index.js +7 -1
- package/dist/output/nextSteps.js +22 -23
- package/dist/prompts/index.js +2 -1
- package/dist/prompts/stack.js +21 -2
- package/dist/types/index.js +2 -1
- package/dist/ui/messages.js +2 -1
- package/dist/validators/index.js +5 -2
- package/package.json +1 -1
- package/templates/backend/express/config.json +42 -40
- 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/src/app.module.ts.hbs +13 -0
- package/templates/backend/nestjs/src/env.ts.hbs +39 -0
- package/templates/backend/nestjs/src/main.ts +3 -2
- package/templates/frontend/nextjs/app/page.tsx.hbs +98 -97
- package/templates/frontend/tanstack/config.json +45 -45
- package/templates/frontend/tanstack/src/routes/index.tsx.hbs +102 -101
- package/templates/frontend/tanstack/vite.config.ts +22 -14
- package/templates/modules/auth/express/config.json +20 -20
- 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/lib/auth-schema.ts +1 -1
- 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/auth/tanstack/src/lib/auth-schema.ts +38 -38
- package/templates/modules/docker/.dockerignore +1 -0
- package/templates/modules/docker/Dockerfile.hbs +147 -136
- package/templates/modules/docker/docker-compose.yml.hbs +96 -1
- package/templates/modules/drizzle/express/src/lib/schema.ts +3 -1
- package/templates/modules/drizzle/nestjs/src/database/schema.ts +3 -1
- package/templates/modules/drizzle/nextjs/lib/schema.ts.hbs +11 -5
- package/templates/modules/drizzle/tanstack/src/lib/schema.ts.hbs +90 -84
- package/templates/modules/rate-limit/express/config.json +12 -0
- package/templates/modules/rate-limit/express/src/middleware/rateLimit.ts +21 -0
- package/templates/modules/rate-limit/nestjs/config.json +12 -0
|
@@ -0,0 +1,21 @@
|
|
|
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
|
|
8
|
+
export const apiLimiter = rateLimit({
|
|
9
|
+
windowMs: FIFTEEN_MINUTES,
|
|
10
|
+
limit: 100,
|
|
11
|
+
standardHeaders: "draft-8",
|
|
12
|
+
legacyHeaders: false,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// Sign-up and login: 10 attempts per IP in 15 minutes, against password guessing
|
|
16
|
+
export const authLimiter = rateLimit({
|
|
17
|
+
windowMs: FIFTEEN_MINUTES,
|
|
18
|
+
limit: 10,
|
|
19
|
+
standardHeaders: "draft-8",
|
|
20
|
+
legacyHeaders: false,
|
|
21
|
+
});
|
|
@@ -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
|
+
}
|