express-ts-api-starter 1.0.1 → 1.3.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 (39) hide show
  1. package/.env.example +23 -0
  2. package/.gitignore +136 -0
  3. package/README.md +416 -495
  4. package/bin/cli.mjs +199 -0
  5. package/eslint.config.js +22 -0
  6. package/jest.config.ts +9 -0
  7. package/package.json +575 -160
  8. package/scripts/eslint-report.js +65 -0
  9. package/src/app.ts +56 -0
  10. package/src/config/dbConfig.ts +17 -0
  11. package/src/config/emailConfig.ts +0 -0
  12. package/src/config/envConfig.ts +18 -0
  13. package/src/config/rateLimitConfig.ts +7 -0
  14. package/src/config/throttleConfig.cjs +6 -0
  15. package/src/constants/index.ts +5 -0
  16. package/src/interfaces/userInterface.ts +11 -0
  17. package/src/messages/index.ts +29 -0
  18. package/src/middleware/auth.ts +54 -0
  19. package/src/middleware/errorMiddleware.ts +30 -0
  20. package/src/middleware/logMiddleware.ts +31 -0
  21. package/src/middleware/requestIdMiddleware.ts +13 -0
  22. package/src/middleware/uploadMiddleware.ts +37 -0
  23. package/src/middleware/validatorMiddleware.ts +21 -0
  24. package/src/models/UserModel.ts +30 -0
  25. package/src/modules/users/tests/userController.test.ts +171 -0
  26. package/src/modules/users/userController.ts +78 -0
  27. package/src/modules/users/userMessage.ts +9 -0
  28. package/src/modules/users/userService.ts +84 -0
  29. package/src/routes/index.ts +9 -0
  30. package/src/routes/usersRoute.ts +13 -0
  31. package/src/server.ts +56 -0
  32. package/src/types/index.ts +13 -0
  33. package/src/types/roleType.ts +1 -0
  34. package/src/types/userTypes.ts +22 -0
  35. package/src/utils/authFunction.ts +15 -0
  36. package/src/utils/responseUtil.ts +42 -0
  37. package/src/validators/index.ts +1 -0
  38. package/src/validators/userValidators.ts +38 -0
  39. package/tsconfig.json +16 -0
package/.env.example ADDED
@@ -0,0 +1,23 @@
1
+ # Environment Configuration
2
+ NODE_ENV=development
3
+
4
+ # Server Configuration
5
+ PORT=5000
6
+ BASIC_API_URL=/api/v1
7
+
8
+ # Database Configuration
9
+ DB_CONNECTION=mongodb://localhost:27017/
10
+ DB_NAME=testDB
11
+
12
+ # Authentication
13
+ JWT_SECRET=your-super-secret-jwt-key-change-in-production
14
+
15
+ # Email Configuration (if using email features)
16
+ SMTP_HOST=smtp.gmail.com
17
+ SMTP_PORT=587
18
+ SMTP_USER=your-email@gmail.com
19
+ SMTP_PASSWORD=your-app-password
20
+
21
+ # Optional: Third-party APIs
22
+ # API_KEY=your-api-key
23
+ # EXTERNAL_SERVICE_URL=https://api.example.com
package/.gitignore ADDED
@@ -0,0 +1,136 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ lerna-debug.log*
8
+ .pnpm-debug.log*
9
+
10
+ # Diagnostic reports (https://nodejs.org/api/report.html)
11
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12
+
13
+ # Runtime data
14
+ pids
15
+ *.pid
16
+ *.seed
17
+ *.pid.lock
18
+
19
+ # Directory for instrumented libs generated by jscoverage/JSCover
20
+ lib-cov
21
+
22
+ # Coverage directory used by tools like istanbul
23
+ coverage
24
+ *.lcov
25
+
26
+ # nyc test coverage
27
+ .nyc_output
28
+
29
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30
+ .grunt
31
+
32
+ # Bower dependency directory (https://bower.io/)
33
+ bower_components
34
+
35
+ # node-waf configuration
36
+ .lock-wscript
37
+
38
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
39
+ build/Release
40
+
41
+ # Dependency directories
42
+ node_modules/
43
+ jspm_packages/
44
+
45
+ # Snowpack dependency directory (https://snowpack.dev/)
46
+ web_modules/
47
+
48
+ # TypeScript cache
49
+ *.tsbuildinfo
50
+
51
+ # Optional npm cache directory
52
+ .npm
53
+
54
+ # Optional eslint cache
55
+ .eslintcache
56
+
57
+ # Optional stylelint cache
58
+ .stylelintcache
59
+
60
+ # Microbundle cache
61
+ .rpt2_cache/
62
+ .rts2_cache_cjs/
63
+ .rts2_cache_es/
64
+ .rts2_cache_umd/
65
+
66
+ # Optional REPL history
67
+ .node_repl_history
68
+
69
+ # Output of 'npm pack'
70
+ *.tgz
71
+
72
+ # Yarn Integrity file
73
+ .yarn-integrity
74
+
75
+ # dotenv environment variable files
76
+ .env
77
+ .env.development.local
78
+ .env.test.local
79
+ .env.production.local
80
+ .env.local
81
+
82
+ # parcel-bundler cache (https://parceljs.org/)
83
+ .cache
84
+ .parcel-cache
85
+
86
+ # Next.js build output
87
+ .next
88
+ out
89
+
90
+ # Nuxt.js build / generate output
91
+ .nuxt
92
+ dist
93
+
94
+ # Gatsby files
95
+ .cache/
96
+ # Comment in the public line in if your project uses Gatsby and not Next.js
97
+ # https://nextjs.org/blog/next-9-1#public-directory-support
98
+ # public
99
+
100
+ # vuepress build output
101
+ .vuepress/dist
102
+
103
+ # vuepress v2.x temp and cache directory
104
+ .temp
105
+ .cache
106
+
107
+ # vitepress build output
108
+ **/.vitepress/dist
109
+
110
+ # vitepress cache directory
111
+ **/.vitepress/cache
112
+
113
+ # Docusaurus cache and generated files
114
+ .docusaurus
115
+
116
+ # Serverless directories
117
+ .serverless/
118
+
119
+ # FuseBox cache
120
+ .fusebox/
121
+
122
+ # DynamoDB Local files
123
+ .dynamodb/
124
+
125
+ # TernJS port file
126
+ .tern-port
127
+
128
+ # Stores VSCode versions used for testing VSCode extensions
129
+ .vscode-test
130
+
131
+ # yarn v2
132
+ .yarn/cache
133
+ .yarn/unplugged
134
+ .yarn/build-state.yml
135
+ .yarn/install-state.gz
136
+ .pnp.*