create-craftjs 1.0.4 → 1.0.6

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 (67) hide show
  1. package/README.md +139 -137
  2. package/bin/index.js +158 -158
  3. package/package.json +24 -24
  4. package/template/Dockerfile +57 -12
  5. package/template/babel.config.json +3 -3
  6. package/template/craft/commands/build.js +16 -15
  7. package/template/craft/commands/db-fresh.js +22 -22
  8. package/template/craft/commands/db-generate.js +23 -23
  9. package/template/craft/commands/db-migrate.js +22 -22
  10. package/template/craft/commands/dev.js +16 -16
  11. package/template/craft/commands/key-generate.js +41 -41
  12. package/template/craft/commands/make-apidocs.js +121 -121
  13. package/template/craft/commands/make-command.js +38 -38
  14. package/template/craft/commands/make-controller.js +95 -95
  15. package/template/craft/commands/make-dto.js +39 -39
  16. package/template/craft/commands/make-middleware.js +46 -46
  17. package/template/craft/commands/make-repository.js +36 -36
  18. package/template/craft/commands/make-route.js +92 -92
  19. package/template/craft/commands/make-service.js +39 -39
  20. package/template/craft/commands/make-test.js +48 -48
  21. package/template/craft/commands/make-utils.js +30 -30
  22. package/template/craft/commands/make-validation.js +42 -42
  23. package/template/craft/commands/make-view.js +42 -42
  24. package/template/craft/commands/start.js +29 -29
  25. package/template/craft/commands/test.js +20 -20
  26. package/template/craft.js +256 -256
  27. package/template/docker-compose.yml +8 -0
  28. package/template/nodemon.json +6 -6
  29. package/template/package-lock.json +8877 -8877
  30. package/template/package.json +84 -84
  31. package/template/prisma/schema.prisma +22 -22
  32. package/template/prisma/seed.ts +29 -29
  33. package/template/src/apidocs/auth-docs.ts +314 -314
  34. package/template/src/apidocs/users-docs.ts +240 -240
  35. package/template/src/config/cloudinary.ts +21 -21
  36. package/template/src/config/database.ts +90 -90
  37. package/template/src/config/env.ts +67 -67
  38. package/template/src/config/logger.ts +139 -139
  39. package/template/src/config/nodemailer.ts +23 -23
  40. package/template/src/config/web.ts +47 -47
  41. package/template/src/controllers/auth-controller.ts +88 -88
  42. package/template/src/controllers/user-controller.ts +79 -79
  43. package/template/src/dtos/list-dto.ts +12 -12
  44. package/template/src/dtos/user-dto.ts +57 -57
  45. package/template/src/main.ts +28 -28
  46. package/template/src/middleware/auth-middleware.ts +44 -44
  47. package/template/src/middleware/error-middleware.ts +27 -27
  48. package/template/src/middleware/http-logger-middleware.ts +31 -31
  49. package/template/src/repositories/user-repository.ts +75 -75
  50. package/template/src/routes/auth-route.ts +20 -20
  51. package/template/src/routes/main-route.ts +25 -25
  52. package/template/src/routes/user-route.ts +35 -35
  53. package/template/src/services/auth-service.ts +162 -162
  54. package/template/src/services/user-service.ts +102 -102
  55. package/template/src/types/type-request.ts +6 -6
  56. package/template/src/utils/async-handler.ts +9 -9
  57. package/template/src/utils/response-error.ts +10 -10
  58. package/template/src/utils/response.ts +60 -60
  59. package/template/src/utils/swagger.ts +135 -135
  60. package/template/src/utils/validation.ts +7 -7
  61. package/template/src/validations/user-validation.ts +127 -127
  62. package/template/src/views/index.ejs +6 -6
  63. package/template/src/views/layouts/main.ejs +14 -14
  64. package/template/src/views/partials/header.ejs +3 -3
  65. package/template/test/user.test.ts +16 -16
  66. package/template/tsconfig.json +13 -13
  67. package/template/.dockerignore +0 -4
@@ -1,84 +1,84 @@
1
- {
2
- "name": "craftjs",
3
- "description": "A starter kit backend framework powered by Express, TypeScript, EJS Engine, and Prisma — designed for rapid development, simplicity, and scalability.",
4
- "version": "1.0.4",
5
- "keywords": [
6
- "express",
7
- "typescript",
8
- "prisma",
9
- "api"
10
- ],
11
- "license": "UNLICENSED",
12
- "main": "main.js",
13
- "scripts": {
14
- "craft": "node craft.js",
15
- "start": "node craft start",
16
- "dev": "node craft dev",
17
- "build": "node craft build",
18
- "test": "node craft test"
19
- },
20
- "jest": {
21
- "transform": {
22
- "^.+\\.[t|j]sx?$": "babel-jest"
23
- }
24
- },
25
- "prisma": {
26
- "seed": "ts-node prisma/seed.ts"
27
- },
28
- "dependencies": {
29
- "@prisma/client": "^6.6.0",
30
- "argon2": "^0.41.1",
31
- "chalk": "^4.1.2",
32
- "cloudinary": "^2.6.1",
33
- "cookie-parser": "^1.4.7",
34
- "cors": "^2.8.5",
35
- "crypto": "^1.0.1",
36
- "dotenv": "^16.5.0",
37
- "ejs": "^3.1.10",
38
- "express": "^5.1.0",
39
- "express-ejs-layouts": "^2.5.1",
40
- "express-fileupload": "^1.5.1",
41
- "inquirer": "^8.2.6",
42
- "jsonwebtoken": "^9.0.2",
43
- "luxon": "^3.6.1",
44
- "nodemailer": "^7.0.3",
45
- "swagger-jsdoc": "^6.2.8",
46
- "swagger-themes": "^1.4.3",
47
- "swagger-ui-express": "^5.0.1",
48
- "winston": "^3.17.0",
49
- "winston-daily-rotate-file": "^5.0.0",
50
- "yargs": "^17.7.2",
51
- "zod": "^3.24.3"
52
- },
53
- "devDependencies": {
54
- "@babel/preset-env": "^7.27.2",
55
- "@babel/preset-typescript": "^7.27.0",
56
- "@jest/globals": "^29.7.0",
57
- "@types/argon2": "^0.14.1",
58
- "@types/cookie-parser": "^1.4.8",
59
- "@types/cors": "^2.8.17",
60
- "@types/dotenv": "^6.1.1",
61
- "@types/ejs": "^3.1.5",
62
- "@types/express": "^5.0.1",
63
- "@types/express-ejs-layouts": "^2.5.4",
64
- "@types/express-fileupload": "^1.5.1",
65
- "@types/jest": "^29.5.14",
66
- "@types/jsonwebtoken": "^9.0.9",
67
- "@types/luxon": "^3.6.2",
68
- "@types/node": "^22.15.18",
69
- "@types/nodemailer": "^6.4.17",
70
- "@types/supertest": "^6.0.3",
71
- "@types/swagger-jsdoc": "^6.0.4",
72
- "@types/swagger-ui-express": "^4.1.8",
73
- "babel-jest": "^29.7.0",
74
- "jest": "^29.7.0",
75
- "nodemon": "^3.1.9",
76
- "prettier": "^3.5.3",
77
- "prisma": "^6.6.0",
78
- "supertest": "^7.1.0",
79
- "ts-jest": "^29.3.4",
80
- "ts-node": "^10.9.2",
81
- "tsx": "^4.19.4",
82
- "typescript": "^5.8.3"
83
- }
84
- }
1
+ {
2
+ "name": "craftjs",
3
+ "description": "A starter kit backend framework powered by Express, TypeScript, EJS Engine, and Prisma — designed for rapid development, simplicity, and scalability.",
4
+ "version": "1.0.4",
5
+ "keywords": [
6
+ "express",
7
+ "typescript",
8
+ "prisma",
9
+ "api"
10
+ ],
11
+ "license": "UNLICENSED",
12
+ "main": "main.js",
13
+ "scripts": {
14
+ "craft": "node craft.js",
15
+ "start": "node craft start",
16
+ "dev": "node craft dev",
17
+ "build": "node craft build",
18
+ "test": "node craft test"
19
+ },
20
+ "jest": {
21
+ "transform": {
22
+ "^.+\\.[t|j]sx?$": "babel-jest"
23
+ }
24
+ },
25
+ "prisma": {
26
+ "seed": "ts-node prisma/seed.ts"
27
+ },
28
+ "dependencies": {
29
+ "@prisma/client": "^6.6.0",
30
+ "argon2": "^0.41.1",
31
+ "chalk": "^4.1.2",
32
+ "cloudinary": "^2.6.1",
33
+ "cookie-parser": "^1.4.7",
34
+ "cors": "^2.8.5",
35
+ "crypto": "^1.0.1",
36
+ "dotenv": "^16.5.0",
37
+ "ejs": "^3.1.10",
38
+ "express": "^5.1.0",
39
+ "express-ejs-layouts": "^2.5.1",
40
+ "express-fileupload": "^1.5.1",
41
+ "inquirer": "^8.2.6",
42
+ "jsonwebtoken": "^9.0.2",
43
+ "luxon": "^3.6.1",
44
+ "nodemailer": "^7.0.3",
45
+ "swagger-jsdoc": "^6.2.8",
46
+ "swagger-themes": "^1.4.3",
47
+ "swagger-ui-express": "^5.0.1",
48
+ "winston": "^3.17.0",
49
+ "winston-daily-rotate-file": "^5.0.0",
50
+ "yargs": "^17.7.2",
51
+ "zod": "^3.24.3"
52
+ },
53
+ "devDependencies": {
54
+ "@babel/preset-env": "^7.27.2",
55
+ "@babel/preset-typescript": "^7.27.0",
56
+ "@jest/globals": "^29.7.0",
57
+ "@types/argon2": "^0.14.1",
58
+ "@types/cookie-parser": "^1.4.8",
59
+ "@types/cors": "^2.8.17",
60
+ "@types/dotenv": "^6.1.1",
61
+ "@types/ejs": "^3.1.5",
62
+ "@types/express": "^5.0.1",
63
+ "@types/express-ejs-layouts": "^2.5.4",
64
+ "@types/express-fileupload": "^1.5.1",
65
+ "@types/jest": "^29.5.14",
66
+ "@types/jsonwebtoken": "^9.0.9",
67
+ "@types/luxon": "^3.6.2",
68
+ "@types/node": "^22.15.18",
69
+ "@types/nodemailer": "^6.4.17",
70
+ "@types/supertest": "^6.0.3",
71
+ "@types/swagger-jsdoc": "^6.0.4",
72
+ "@types/swagger-ui-express": "^4.1.8",
73
+ "babel-jest": "^29.7.0",
74
+ "jest": "^29.7.0",
75
+ "nodemon": "^3.1.9",
76
+ "prettier": "^3.5.3",
77
+ "prisma": "^6.6.0",
78
+ "supertest": "^7.1.0",
79
+ "ts-jest": "^29.3.4",
80
+ "ts-node": "^10.9.2",
81
+ "tsx": "^4.19.4",
82
+ "typescript": "^5.8.3"
83
+ }
84
+ }
@@ -1,22 +1,22 @@
1
- generator client {
2
- provider = "prisma-client-js"
3
- binaryTargets = ["native", "debian-openssl-1.1.x"]
4
- output = "../node_modules/.prisma/client"
5
- }
6
-
7
- datasource db {
8
- provider = "mysql"
9
- url = env("DATABASE_URL")
10
- }
11
-
12
- model User {
13
- id String @id @default(uuid())
14
- fullName String @db.VarChar(100)
15
- email String @unique @db.VarChar(100)
16
- password String @db.VarChar(255)
17
- created_at DateTime @default(now()) @db.Timestamp(0)
18
- updated_at DateTime @updatedAt @db.Timestamp(0)
19
- deleted_at DateTime? @db.Timestamp(0)
20
-
21
- @@map("users")
22
- }
1
+ generator client {
2
+ provider = "prisma-client-js"
3
+ binaryTargets = ["native", "debian-openssl-1.1.x"]
4
+ output = "../node_modules/.prisma/client"
5
+ }
6
+
7
+ datasource db {
8
+ provider = "mysql"
9
+ url = env("DATABASE_URL")
10
+ }
11
+
12
+ model User {
13
+ id String @id @default(uuid())
14
+ fullName String @db.VarChar(100)
15
+ email String @unique @db.VarChar(100)
16
+ password String @db.VarChar(255)
17
+ created_at DateTime @default(now()) @db.Timestamp(0)
18
+ updated_at DateTime @updatedAt @db.Timestamp(0)
19
+ deleted_at DateTime? @db.Timestamp(0)
20
+
21
+ @@map("users")
22
+ }
@@ -1,29 +1,29 @@
1
- import { PrismaClient } from "@prisma/client";
2
- import * as argon2 from "argon2";
3
- import dotenv from "dotenv";
4
-
5
- dotenv.config();
6
-
7
- const prisma = new PrismaClient();
8
-
9
- async function main() {
10
- await prisma.user.upsert({
11
- where: { email: "tes@gmail.com" },
12
- update: {},
13
- create: {
14
- fullName: "Tes",
15
- email: "tes@gmail.com",
16
- password: await argon2.hash("12345678"),
17
- },
18
- });
19
-
20
- console.log("Users seeded");
21
- }
22
- main()
23
- .catch((e) => {
24
- console.error(e);
25
- process.exit(1);
26
- })
27
- .finally(async () => {
28
- await prisma.$disconnect();
29
- });
1
+ import { PrismaClient } from "@prisma/client";
2
+ import * as argon2 from "argon2";
3
+ import dotenv from "dotenv";
4
+
5
+ dotenv.config();
6
+
7
+ const prisma = new PrismaClient();
8
+
9
+ async function main() {
10
+ await prisma.user.upsert({
11
+ where: { email: "tes@gmail.com" },
12
+ update: {},
13
+ create: {
14
+ fullName: "Tes",
15
+ email: "tes@gmail.com",
16
+ password: await argon2.hash("12345678"),
17
+ },
18
+ });
19
+
20
+ console.log("Users seeded");
21
+ }
22
+ main()
23
+ .catch((e) => {
24
+ console.error(e);
25
+ process.exit(1);
26
+ })
27
+ .finally(async () => {
28
+ await prisma.$disconnect();
29
+ });