create-craftjs 2.0.6 → 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.
Files changed (34) hide show
  1. package/README.md +3 -0
  2. package/bin/index.js +10 -1
  3. package/package.json +5 -2
  4. package/template/Craft JS.postman_collection.json +1500 -0
  5. package/template/craft/commands/key-generate.js +12 -4
  6. package/template/craft/commands/make-controller.js +3 -3
  7. package/template/craft/commands/make-middleware.js +7 -7
  8. package/template/craft/commands/make-route.js +0 -3
  9. package/template/craft/commands/make-test.js +5 -4
  10. package/template/package-lock.json +95 -2
  11. package/template/package.json +3 -1
  12. package/template/src/config/database.ts +5 -3
  13. package/template/src/config/env.ts +10 -1
  14. package/template/src/config/logger.ts +2 -4
  15. package/template/src/config/redis.ts +77 -0
  16. package/template/src/config/web.ts +1 -1
  17. package/template/src/controllers/auth-controller.ts +22 -15
  18. package/template/src/controllers/user-controller.ts +1 -2
  19. package/template/src/database/seeders/seed.ts +14 -4
  20. package/template/src/dtos/auth-dto.ts +28 -0
  21. package/template/src/dtos/user-dto.ts +2 -5
  22. package/template/src/interfaces/auth-session.ts +16 -0
  23. package/template/src/interfaces/type-request.ts +11 -0
  24. package/template/src/main.ts +6 -4
  25. package/template/src/middleware/auth-middleware.ts +19 -28
  26. package/template/src/providers/auth-session-provider.ts +12 -0
  27. package/template/src/providers/db-auth-session.ts +23 -0
  28. package/template/src/providers/redis-auth-session.ts +33 -0
  29. package/template/src/repositories/auth-token-repository.ts +1 -1
  30. package/template/src/services/auth-service.ts +136 -78
  31. package/template/src/services/user-service.ts +8 -2
  32. package/template/test/user.test.ts +3 -2
  33. package/template/tsconfig.json +2 -1
  34. package/template/src/utils/type-request.ts +0 -6
package/README.md CHANGED
@@ -12,6 +12,7 @@ A starter kit backend powered by Express, TypeScript, EJS Engine, and Prisma —
12
12
  - **CLI tool** (`craft`) for project automation
13
13
  - Built-in **Logger**, **Validation**, **Error handler**, and **Request lifecycle**
14
14
  - Predefined project structure for fast onboarding
15
+ - Redis Add On Optional for Auth
15
16
 
16
17
  ---
17
18
 
@@ -88,7 +89,9 @@ my-app/
88
89
  │ ├── config/
89
90
  │ ├── controllers/
90
91
  │ ├── dtos/
92
+ │ ├── interfaces/
91
93
  │ ├── middleware/
94
+ │ ├── providers/
92
95
  │ ├── repositories/
93
96
  │ ├── routes/
94
97
  │ └── services/
package/bin/index.js CHANGED
@@ -87,6 +87,9 @@ APP_SECRET=
87
87
  NODE_ENV="development"
88
88
  TZ="Asia/Jakarta"
89
89
  DATETIME_FORMAT="dd-MM-yyyy HH:mm:ss"
90
+ CLOUDINARY_CLOUD_NAME=
91
+ CLOUDINARY_API_KEY=
92
+ CLOUDINARY_API_SECRET=
90
93
  DATABASE_URL="mysql://root:@localhost:3306/${projectName}"
91
94
  DATABASE_USER="root"
92
95
  DATABASE_PASSWORD=""
@@ -95,8 +98,14 @@ DATABASE_HOST="localhost"
95
98
  DATABASE_PORT=3306
96
99
  DATABASE_CONNECTION_LIMIT=5
97
100
  PORT=4444
98
- JWT_SECRET=
101
+ JWT_ACCESS_SECRET=
102
+ JWT_REFRESH_SECRET=
99
103
  COOKIE_ENCRYPTION_KEY=
104
+ REDIS_ENABLED=false
105
+ REDIS_HOST=localhost
106
+ REDIS_PORT=6379
107
+ REDIS_PASS=
108
+ REDIS_DB=0
100
109
  `;
101
110
 
102
111
  const envExampleContent = envContent.replace(/=.*/g, "=");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-craftjs",
3
- "version": "2.0.6",
3
+ "version": "2.1.0",
4
4
  "description": "A starter kit backend framework powered by Express, TypeScript, EJS Engine, and Prisma — designed for rapid development, simplicity, and scalability.",
5
5
  "bin": {
6
6
  "create-craftjs": "bin/index.js"
@@ -20,5 +20,8 @@
20
20
  "typescript",
21
21
  "prisma",
22
22
  "api"
23
- ]
23
+ ],
24
+ "devDependencies": {
25
+ "@types/jest": "^30.0.0"
26
+ }
24
27
  }