authkit-api 1.0.0 → 1.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 (186) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/README.md +21 -5
  3. package/package.json +12 -5
  4. package/src/constants.js +5 -0
  5. package/src/generator.js +37 -7
  6. package/src/index.js +12 -2
  7. package/src/prompts.js +20 -4
  8. package/templates/base/README.md +5 -5
  9. package/templates/base/package.json +4 -4
  10. package/templates/base/scripts/docker-entrypoint.sh +1 -1
  11. package/templates/base/scripts/generate-postman.ts +102 -0
  12. package/templates/base/scripts/seed-admin.ts +62 -0
  13. package/templates/base/src/app.ts +46 -0
  14. package/templates/base/src/config/env.schema.ts +85 -0
  15. package/templates/base/src/config/env.ts +15 -0
  16. package/templates/base/src/config/logger.ts +20 -0
  17. package/templates/base/src/constants/examples.ts +3 -0
  18. package/templates/base/src/constants/roles.ts +4 -0
  19. package/templates/base/src/constants/user.rules.ts +16 -0
  20. package/templates/base/src/docs/openapi.registry.ts +90 -0
  21. package/templates/base/src/docs/openapi.ts +36 -0
  22. package/templates/base/src/docs/paths/auth.paths.ts +88 -0
  23. package/templates/base/src/docs/paths/user.paths.ts +88 -0
  24. package/templates/base/src/middlewares/authenticate.ts +20 -0
  25. package/templates/base/src/middlewares/authorize.ts +13 -0
  26. package/templates/base/src/middlewares/errorHandler.ts +52 -0
  27. package/templates/base/src/middlewares/notFound.ts +6 -0
  28. package/templates/base/src/middlewares/rateLimiter.ts +20 -0
  29. package/templates/base/src/middlewares/validate.ts +39 -0
  30. package/templates/base/src/modules/auth/auth.controller.ts +45 -0
  31. package/templates/base/src/modules/auth/auth.cookie.ts +22 -0
  32. package/templates/base/src/modules/auth/auth.routes.ts +12 -0
  33. package/templates/base/src/modules/auth/auth.service.ts +81 -0
  34. package/templates/base/src/modules/auth/auth.validation.ts +44 -0
  35. package/templates/base/src/modules/user/user.controller.ts +24 -0
  36. package/templates/base/src/modules/user/user.routes.ts +22 -0
  37. package/templates/base/src/modules/user/user.service.ts +57 -0
  38. package/templates/base/src/modules/user/user.validation.ts +27 -0
  39. package/templates/base/src/routes/docs.routes.ts +16 -0
  40. package/templates/base/src/routes/health.routes.ts +17 -0
  41. package/templates/base/src/routes/index.ts +13 -0
  42. package/templates/base/src/server.ts +51 -0
  43. package/templates/base/src/types/express.d.ts +14 -0
  44. package/templates/base/src/utils/ApiError.ts +35 -0
  45. package/templates/base/src/utils/apiResponse.ts +24 -0
  46. package/templates/base/src/utils/password.ts +14 -0
  47. package/templates/base/src/utils/token.ts +60 -0
  48. package/templates/base/src/utils/zod.ts +5 -0
  49. package/templates/base/tests/app.test.ts +67 -0
  50. package/templates/base/tests/auth.test.ts +194 -0
  51. package/templates/base/tests/authenticate.test.ts +61 -0
  52. package/templates/base/tests/docs.test.ts +127 -0
  53. package/templates/base/tests/env.test.ts +96 -0
  54. package/templates/base/tests/health.test.ts +21 -0
  55. package/templates/base/tests/helpers/auth.helper.ts +49 -0
  56. package/templates/base/tests/password.test.ts +18 -0
  57. package/templates/base/tests/postman.test.ts +32 -0
  58. package/templates/base/tests/rateLimiter.test.ts +27 -0
  59. package/templates/base/tests/seedAdmin.test.ts +42 -0
  60. package/templates/base/tests/token.test.ts +69 -0
  61. package/templates/base/tests/trustProxy.test.ts +24 -0
  62. package/templates/base/tests/user.repository.test.ts +211 -0
  63. package/templates/base/tests/user.test.ts +145 -0
  64. package/templates/base/tests/validate.test.ts +42 -0
  65. package/templates/base/tests/validation.test.ts +62 -0
  66. package/templates/base/vitest.config.ts +16 -0
  67. package/templates/databases/mongodb/README.part.md +1 -1
  68. package/templates/databases/mongodb/src/database/connection.ts +46 -0
  69. package/templates/databases/mongodb/src/database/env.schema.ts +3 -0
  70. package/templates/databases/mongodb/src/database/id.schema.ts +3 -0
  71. package/templates/databases/mongodb/src/database/models/refreshToken.model.ts +24 -0
  72. package/templates/databases/mongodb/src/database/models/user.model.ts +52 -0
  73. package/templates/databases/mongodb/src/modules/user/user.repository.ts +91 -0
  74. package/templates/databases/mongodb/tests/globalSetup.ts +13 -0
  75. package/templates/databases/mongodb/tests/setup.ts +17 -0
  76. package/templates/databases/postgres/README.part.md +1 -1
  77. package/templates/databases/postgres/prisma.config.ts +14 -0
  78. package/templates/databases/postgres/src/database/connection.ts +72 -0
  79. package/templates/databases/postgres/src/database/env.schema.ts +3 -0
  80. package/templates/databases/postgres/src/database/id.schema.ts +3 -0
  81. package/templates/databases/postgres/src/database/prisma.ts +9 -0
  82. package/templates/databases/postgres/src/modules/user/user.repository.ts +111 -0
  83. package/templates/databases/postgres/tests/connection.test.ts +19 -0
  84. package/templates/databases/postgres/tests/globalSetup.ts +66 -0
  85. package/templates/databases/postgres/tests/prismaSchema.test.ts +27 -0
  86. package/templates/databases/postgres/tests/setup.ts +15 -0
  87. package/templates/languages/ts/eslint.config.js +30 -0
  88. package/templates/languages/ts/package.part.json +21 -0
  89. package/templates/languages/ts/tsconfig.json +15 -0
  90. package/templates-js/base/Dockerfile +22 -0
  91. package/templates-js/base/README.md +108 -0
  92. package/templates-js/base/_dockerignore +16 -0
  93. package/templates-js/base/_env.example +25 -0
  94. package/templates-js/base/_gitignore +5 -0
  95. package/templates-js/base/_husky/pre-commit +1 -0
  96. package/templates-js/base/_prettierignore +5 -0
  97. package/templates-js/base/_prettierrc +1 -0
  98. package/templates-js/base/package.json +62 -0
  99. package/templates-js/base/scripts/docker-entrypoint.sh +9 -0
  100. package/templates-js/databases/mongodb/README.part.md +23 -0
  101. package/templates-js/databases/mongodb/_github/workflows/ci.yml +29 -0
  102. package/templates-js/databases/mongodb/docker-compose.yml +30 -0
  103. package/templates-js/databases/mongodb/env.part +2 -0
  104. package/templates-js/databases/mongodb/package.part.json +4 -0
  105. package/templates-js/databases/postgres/README.part.md +31 -0
  106. package/templates-js/databases/postgres/_github/workflows/ci.yml +46 -0
  107. package/templates-js/databases/postgres/docker-compose.yml +34 -0
  108. package/templates-js/databases/postgres/env.part +2 -0
  109. package/templates-js/databases/postgres/package.part.json +15 -0
  110. package/templates-js/databases/postgres/prisma/migrations/20261030073256_init/migration.sql +39 -0
  111. package/templates-js/databases/postgres/prisma/migrations/migration_lock.toml +3 -0
  112. package/templates-js/databases/postgres/prisma/schema.prisma +39 -0
  113. /package/templates/{base → languages/js}/eslint.config.js +0 -0
  114. /package/{templates → templates-js}/base/scripts/generate-postman.js +0 -0
  115. /package/{templates → templates-js}/base/scripts/seed-admin.js +0 -0
  116. /package/{templates → templates-js}/base/src/app.js +0 -0
  117. /package/{templates → templates-js}/base/src/config/env.js +0 -0
  118. /package/{templates → templates-js}/base/src/config/env.schema.js +0 -0
  119. /package/{templates → templates-js}/base/src/config/logger.js +0 -0
  120. /package/{templates → templates-js}/base/src/constants/examples.js +0 -0
  121. /package/{templates → templates-js}/base/src/constants/roles.js +0 -0
  122. /package/{templates → templates-js}/base/src/constants/user.rules.js +0 -0
  123. /package/{templates → templates-js}/base/src/docs/openapi.js +0 -0
  124. /package/{templates → templates-js}/base/src/docs/openapi.registry.js +0 -0
  125. /package/{templates → templates-js}/base/src/docs/paths/auth.paths.js +0 -0
  126. /package/{templates → templates-js}/base/src/docs/paths/user.paths.js +0 -0
  127. /package/{templates → templates-js}/base/src/middlewares/authenticate.js +0 -0
  128. /package/{templates → templates-js}/base/src/middlewares/authorize.js +0 -0
  129. /package/{templates → templates-js}/base/src/middlewares/errorHandler.js +0 -0
  130. /package/{templates → templates-js}/base/src/middlewares/notFound.js +0 -0
  131. /package/{templates → templates-js}/base/src/middlewares/rateLimiter.js +0 -0
  132. /package/{templates → templates-js}/base/src/middlewares/validate.js +0 -0
  133. /package/{templates → templates-js}/base/src/modules/auth/auth.controller.js +0 -0
  134. /package/{templates → templates-js}/base/src/modules/auth/auth.cookie.js +0 -0
  135. /package/{templates → templates-js}/base/src/modules/auth/auth.routes.js +0 -0
  136. /package/{templates → templates-js}/base/src/modules/auth/auth.service.js +0 -0
  137. /package/{templates → templates-js}/base/src/modules/auth/auth.validation.js +0 -0
  138. /package/{templates → templates-js}/base/src/modules/user/user.controller.js +0 -0
  139. /package/{templates → templates-js}/base/src/modules/user/user.routes.js +0 -0
  140. /package/{templates → templates-js}/base/src/modules/user/user.service.js +0 -0
  141. /package/{templates → templates-js}/base/src/modules/user/user.validation.js +0 -0
  142. /package/{templates → templates-js}/base/src/routes/docs.routes.js +0 -0
  143. /package/{templates → templates-js}/base/src/routes/health.routes.js +0 -0
  144. /package/{templates → templates-js}/base/src/routes/index.js +0 -0
  145. /package/{templates → templates-js}/base/src/server.js +0 -0
  146. /package/{templates → templates-js}/base/src/utils/ApiError.js +0 -0
  147. /package/{templates → templates-js}/base/src/utils/apiResponse.js +0 -0
  148. /package/{templates → templates-js}/base/src/utils/password.js +0 -0
  149. /package/{templates → templates-js}/base/src/utils/token.js +0 -0
  150. /package/{templates → templates-js}/base/src/utils/zod.js +0 -0
  151. /package/{templates → templates-js}/base/tests/app.test.js +0 -0
  152. /package/{templates → templates-js}/base/tests/auth.test.js +0 -0
  153. /package/{templates → templates-js}/base/tests/authenticate.test.js +0 -0
  154. /package/{templates → templates-js}/base/tests/docs.test.js +0 -0
  155. /package/{templates → templates-js}/base/tests/env.test.js +0 -0
  156. /package/{templates → templates-js}/base/tests/health.test.js +0 -0
  157. /package/{templates → templates-js}/base/tests/helpers/auth.helper.js +0 -0
  158. /package/{templates → templates-js}/base/tests/password.test.js +0 -0
  159. /package/{templates → templates-js}/base/tests/postman.test.js +0 -0
  160. /package/{templates → templates-js}/base/tests/rateLimiter.test.js +0 -0
  161. /package/{templates → templates-js}/base/tests/seedAdmin.test.js +0 -0
  162. /package/{templates → templates-js}/base/tests/token.test.js +0 -0
  163. /package/{templates → templates-js}/base/tests/trustProxy.test.js +0 -0
  164. /package/{templates → templates-js}/base/tests/user.repository.test.js +0 -0
  165. /package/{templates → templates-js}/base/tests/user.test.js +0 -0
  166. /package/{templates → templates-js}/base/tests/validate.test.js +0 -0
  167. /package/{templates → templates-js}/base/tests/validation.test.js +0 -0
  168. /package/{templates → templates-js}/base/vitest.config.js +0 -0
  169. /package/{templates → templates-js}/databases/mongodb/src/database/connection.js +0 -0
  170. /package/{templates → templates-js}/databases/mongodb/src/database/env.schema.js +0 -0
  171. /package/{templates → templates-js}/databases/mongodb/src/database/id.schema.js +0 -0
  172. /package/{templates → templates-js}/databases/mongodb/src/database/models/refreshToken.model.js +0 -0
  173. /package/{templates → templates-js}/databases/mongodb/src/database/models/user.model.js +0 -0
  174. /package/{templates → templates-js}/databases/mongodb/src/modules/user/user.repository.js +0 -0
  175. /package/{templates → templates-js}/databases/mongodb/tests/globalSetup.js +0 -0
  176. /package/{templates → templates-js}/databases/mongodb/tests/setup.js +0 -0
  177. /package/{templates → templates-js}/databases/postgres/prisma.config.js +0 -0
  178. /package/{templates → templates-js}/databases/postgres/src/database/connection.js +0 -0
  179. /package/{templates → templates-js}/databases/postgres/src/database/env.schema.js +0 -0
  180. /package/{templates → templates-js}/databases/postgres/src/database/id.schema.js +0 -0
  181. /package/{templates → templates-js}/databases/postgres/src/database/prisma.js +0 -0
  182. /package/{templates → templates-js}/databases/postgres/src/modules/user/user.repository.js +0 -0
  183. /package/{templates → templates-js}/databases/postgres/tests/connection.test.js +0 -0
  184. /package/{templates → templates-js}/databases/postgres/tests/globalSetup.js +0 -0
  185. /package/{templates → templates-js}/databases/postgres/tests/prismaSchema.test.js +0 -0
  186. /package/{templates → templates-js}/databases/postgres/tests/setup.js +0 -0