arkos 1.5.10-beta → 1.6.0-beta

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 (274) hide show
  1. package/README.md +146 -147
  2. package/cli.js +33 -20
  3. package/dist/cjs/app.js +65 -168
  4. package/dist/cjs/app.js.map +1 -1
  5. package/dist/cjs/components/arkos-policy/index.js +38 -0
  6. package/dist/cjs/components/arkos-policy/index.js.map +1 -0
  7. package/dist/cjs/{types/arkos-config.js → components/arkos-policy/types.js} +1 -1
  8. package/dist/cjs/components/arkos-policy/types.js.map +1 -0
  9. package/dist/cjs/exports/config.js +6 -0
  10. package/dist/cjs/exports/config.js.map +1 -0
  11. package/dist/cjs/exports/error-handler/index.js +15 -0
  12. package/dist/cjs/exports/error-handler/index.js.map +1 -1
  13. package/dist/cjs/exports/index.js +5 -5
  14. package/dist/cjs/exports/index.js.map +1 -1
  15. package/dist/cjs/modules/auth/auth.router.js +2 -2
  16. package/dist/cjs/modules/auth/auth.router.js.map +1 -1
  17. package/dist/cjs/modules/auth/auth.service.js +160 -6
  18. package/dist/cjs/modules/auth/auth.service.js.map +1 -1
  19. package/dist/cjs/modules/auth/utils/services/auth-action.service.js +5 -1
  20. package/dist/cjs/modules/auth/utils/services/auth-action.service.js.map +1 -1
  21. package/dist/cjs/modules/base/base.controller.js.map +1 -1
  22. package/dist/cjs/modules/base/base.router.js.map +1 -1
  23. package/dist/cjs/modules/base/base.service.js.map +1 -1
  24. package/dist/cjs/modules/base/types/base.service.types.js.map +1 -1
  25. package/dist/cjs/modules/base/utils/helpers/base.router.helpers.js +3 -2
  26. package/dist/cjs/modules/base/utils/helpers/base.router.helpers.js.map +1 -1
  27. package/dist/cjs/modules/debugger/utils/loaded-components-logger.js +0 -1
  28. package/dist/cjs/modules/debugger/utils/loaded-components-logger.js.map +1 -1
  29. package/dist/cjs/modules/email/email.service.js +1 -1
  30. package/dist/cjs/modules/email/email.service.js.map +1 -1
  31. package/dist/cjs/modules/error-handler/error-handler.controller.js +11 -5
  32. package/dist/cjs/modules/error-handler/error-handler.controller.js.map +1 -1
  33. package/dist/cjs/modules/error-handler/utils/error-handler.helpers.js +0 -7
  34. package/dist/cjs/modules/error-handler/utils/error-handler.helpers.js.map +1 -1
  35. package/dist/cjs/modules/error-handler/utils/errors.js +158 -0
  36. package/dist/cjs/modules/error-handler/utils/errors.js.map +1 -0
  37. package/dist/cjs/modules/file-upload/file-upload.controller.js.map +1 -1
  38. package/dist/cjs/modules/file-upload/file-upload.router.js +1 -1
  39. package/dist/cjs/modules/file-upload/file-upload.router.js.map +1 -1
  40. package/dist/cjs/modules/swagger/swagger.router.js +46 -6
  41. package/dist/cjs/modules/swagger/swagger.router.js.map +1 -1
  42. package/dist/cjs/modules/swagger/utils/get-open-api-login-html.js +306 -0
  43. package/dist/cjs/modules/swagger/utils/get-open-api-login-html.js.map +1 -0
  44. package/dist/cjs/modules/swagger/utils/helpers/get-swagger-default-configs.js +1 -0
  45. package/dist/cjs/modules/swagger/utils/helpers/get-swagger-default-configs.js.map +1 -1
  46. package/dist/cjs/server.js +17 -57
  47. package/dist/cjs/server.js.map +1 -1
  48. package/dist/cjs/types/{arkos-prisma-input.bak.js → arkos-config/utils.js} +1 -1
  49. package/dist/cjs/types/arkos-config/utils.js.map +1 -0
  50. package/dist/cjs/types/arkos.js +3 -0
  51. package/dist/cjs/types/arkos.js.map +1 -0
  52. package/dist/cjs/types/auth.js.map +1 -1
  53. package/dist/cjs/types/index.js.map +1 -1
  54. package/dist/cjs/types/new-arkos-config.js.map +1 -1
  55. package/dist/cjs/types/router-config.js.map +1 -1
  56. package/dist/cjs/utils/arkos-router/index.js +2 -95
  57. package/dist/cjs/utils/arkos-router/index.js.map +1 -1
  58. package/dist/cjs/utils/arkos-router/types/index.js.map +1 -1
  59. package/dist/cjs/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.js +150 -0
  60. package/dist/cjs/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.js.map +1 -0
  61. package/dist/cjs/utils/arkos-router/utils/helpers/index.js +1 -1
  62. package/dist/cjs/utils/arkos-router/utils/helpers/index.js.map +1 -1
  63. package/dist/cjs/utils/arkos-router/utils/helpers/upload-manager.js.map +1 -1
  64. package/dist/cjs/utils/cli/build.js +1 -0
  65. package/dist/cjs/utils/cli/build.js.map +1 -1
  66. package/dist/cjs/utils/cli/dev.js +1 -1
  67. package/dist/cjs/utils/cli/dev.js.map +1 -1
  68. package/dist/cjs/utils/cli/generate.js +133 -26
  69. package/dist/cjs/utils/cli/generate.js.map +1 -1
  70. package/dist/cjs/utils/cli/index.js +94 -2
  71. package/dist/cjs/utils/cli/index.js.map +1 -1
  72. package/dist/cjs/utils/cli/utils/cli.helpers.js +1 -1
  73. package/dist/cjs/utils/cli/utils/runtime-cli-commander.js +18 -3
  74. package/dist/cjs/utils/cli/utils/runtime-cli-commander.js.map +1 -1
  75. package/dist/cjs/utils/cli/utils/template-generator/templates/auth-configs-template.js +28 -22
  76. package/dist/cjs/utils/cli/utils/template-generator/templates/auth-configs-template.js.map +1 -1
  77. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator-dto-generator.js +208 -0
  78. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator-dto-generator.js.map +1 -1
  79. package/dist/cjs/utils/cli/utils/template-generator/templates/generate-controller-template.js +2 -2
  80. package/dist/cjs/utils/cli/utils/template-generator/templates/generate-controller-template.js.map +1 -1
  81. package/dist/cjs/utils/cli/utils/template-generator/templates/generate-multiple-components.js +144 -39
  82. package/dist/cjs/utils/cli/utils/template-generator/templates/generate-multiple-components.js.map +1 -1
  83. package/dist/cjs/utils/cli/utils/template-generator/templates/policy-template.js +51 -0
  84. package/dist/cjs/utils/cli/utils/template-generator/templates/policy-template.js.map +1 -0
  85. package/dist/cjs/utils/cli/utils/template-generator/templates/router-template.js +20 -29
  86. package/dist/cjs/utils/cli/utils/template-generator/templates/router-template.js.map +1 -1
  87. package/dist/cjs/utils/cli/utils/template-generator/templates/service-template.js +15 -0
  88. package/dist/cjs/utils/cli/utils/template-generator/templates/service-template.js.map +1 -1
  89. package/dist/cjs/utils/cli/utils/template-generator/templates/zod-schema-generator.js +169 -0
  90. package/dist/cjs/utils/cli/utils/template-generator/templates/zod-schema-generator.js.map +1 -1
  91. package/dist/cjs/utils/cli/utils/template-generators.js +19 -0
  92. package/dist/cjs/utils/cli/utils/template-generators.js.map +1 -1
  93. package/dist/cjs/utils/define-config.js +58 -0
  94. package/dist/cjs/utils/define-config.js.map +1 -1
  95. package/dist/cjs/utils/dynamic-loader.js +15 -89
  96. package/dist/cjs/utils/dynamic-loader.js.map +1 -1
  97. package/dist/cjs/utils/helpers/arkos-config.helpers.js +16 -33
  98. package/dist/cjs/utils/helpers/arkos-config.helpers.js.map +1 -1
  99. package/dist/cjs/utils/helpers/dynamic-loader.helpers.js.map +1 -1
  100. package/dist/cjs/utils/helpers/exit-error.js +13 -0
  101. package/dist/cjs/utils/helpers/exit-error.js.map +1 -0
  102. package/dist/cjs/utils/helpers/fs.helpers.js +0 -9
  103. package/dist/cjs/utils/helpers/fs.helpers.js.map +1 -1
  104. package/dist/cjs/utils/helpers/global.helpers.js +3 -2
  105. package/dist/cjs/utils/helpers/global.helpers.js.map +1 -1
  106. package/dist/cjs/utils/helpers/routers.helpers.js +3 -2
  107. package/dist/cjs/utils/helpers/routers.helpers.js.map +1 -1
  108. package/dist/cjs/utils/initialize-app.js +60 -0
  109. package/dist/cjs/utils/initialize-app.js.map +1 -0
  110. package/dist/cjs/utils/setup-app.js +118 -0
  111. package/dist/cjs/utils/setup-app.js.map +1 -0
  112. package/dist/esm/app.js +63 -166
  113. package/dist/esm/app.js.map +1 -1
  114. package/dist/esm/components/arkos-policy/index.js +32 -0
  115. package/dist/esm/components/arkos-policy/index.js.map +1 -0
  116. package/dist/esm/components/arkos-policy/types.js +2 -0
  117. package/dist/esm/components/arkos-policy/types.js.map +1 -0
  118. package/dist/esm/exports/config.js +3 -0
  119. package/dist/esm/exports/config.js.map +1 -0
  120. package/dist/esm/exports/error-handler/index.js +1 -0
  121. package/dist/esm/exports/error-handler/index.js.map +1 -1
  122. package/dist/esm/exports/index.js +4 -5
  123. package/dist/esm/exports/index.js.map +1 -1
  124. package/dist/esm/modules/auth/auth.router.js +2 -2
  125. package/dist/esm/modules/auth/auth.router.js.map +1 -1
  126. package/dist/esm/modules/auth/auth.service.js +160 -6
  127. package/dist/esm/modules/auth/auth.service.js.map +1 -1
  128. package/dist/esm/modules/auth/utils/services/auth-action.service.js +5 -1
  129. package/dist/esm/modules/auth/utils/services/auth-action.service.js.map +1 -1
  130. package/dist/esm/modules/base/base.controller.js.map +1 -1
  131. package/dist/esm/modules/base/base.router.js.map +1 -1
  132. package/dist/esm/modules/base/base.service.js.map +1 -1
  133. package/dist/esm/modules/base/types/base.service.types.js.map +1 -1
  134. package/dist/esm/modules/base/utils/helpers/base.router.helpers.js +3 -2
  135. package/dist/esm/modules/base/utils/helpers/base.router.helpers.js.map +1 -1
  136. package/dist/esm/modules/debugger/utils/loaded-components-logger.js +0 -1
  137. package/dist/esm/modules/debugger/utils/loaded-components-logger.js.map +1 -1
  138. package/dist/esm/modules/email/email.service.js +1 -1
  139. package/dist/esm/modules/email/email.service.js.map +1 -1
  140. package/dist/esm/modules/error-handler/error-handler.controller.js +11 -5
  141. package/dist/esm/modules/error-handler/error-handler.controller.js.map +1 -1
  142. package/dist/esm/modules/error-handler/utils/error-handler.helpers.js +1 -7
  143. package/dist/esm/modules/error-handler/utils/error-handler.helpers.js.map +1 -1
  144. package/dist/esm/modules/error-handler/utils/errors.js +127 -0
  145. package/dist/esm/modules/error-handler/utils/errors.js.map +1 -0
  146. package/dist/esm/modules/file-upload/file-upload.controller.js.map +1 -1
  147. package/dist/esm/modules/file-upload/file-upload.router.js +1 -1
  148. package/dist/esm/modules/file-upload/file-upload.router.js.map +1 -1
  149. package/dist/esm/modules/swagger/swagger.router.js +45 -6
  150. package/dist/esm/modules/swagger/swagger.router.js.map +1 -1
  151. package/dist/esm/modules/swagger/utils/get-open-api-login-html.js +303 -0
  152. package/dist/esm/modules/swagger/utils/get-open-api-login-html.js.map +1 -0
  153. package/dist/esm/modules/swagger/utils/helpers/get-swagger-default-configs.js +1 -0
  154. package/dist/esm/modules/swagger/utils/helpers/get-swagger-default-configs.js.map +1 -1
  155. package/dist/esm/server.js +16 -55
  156. package/dist/esm/server.js.map +1 -1
  157. package/dist/esm/types/arkos-config/utils.js +2 -0
  158. package/dist/esm/types/arkos-config/utils.js.map +1 -0
  159. package/dist/esm/types/arkos.js +2 -0
  160. package/dist/esm/types/arkos.js.map +1 -0
  161. package/dist/esm/types/auth.js.map +1 -1
  162. package/dist/esm/types/index.js.map +1 -1
  163. package/dist/esm/types/new-arkos-config.js.map +1 -1
  164. package/dist/esm/types/router-config.js.map +1 -1
  165. package/dist/esm/utils/arkos-router/index.js +3 -96
  166. package/dist/esm/utils/arkos-router/index.js.map +1 -1
  167. package/dist/esm/utils/arkos-router/types/index.js.map +1 -1
  168. package/dist/esm/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.js +144 -0
  169. package/dist/esm/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.js.map +1 -0
  170. package/dist/esm/utils/arkos-router/utils/helpers/index.js +1 -1
  171. package/dist/esm/utils/arkos-router/utils/helpers/index.js.map +1 -1
  172. package/dist/esm/utils/arkos-router/utils/helpers/upload-manager.js.map +1 -1
  173. package/dist/esm/utils/cli/build.js +1 -0
  174. package/dist/esm/utils/cli/build.js.map +1 -1
  175. package/dist/esm/utils/cli/dev.js +1 -1
  176. package/dist/esm/utils/cli/dev.js.map +1 -1
  177. package/dist/esm/utils/cli/generate.js +129 -22
  178. package/dist/esm/utils/cli/generate.js.map +1 -1
  179. package/dist/esm/utils/cli/index.js +94 -2
  180. package/dist/esm/utils/cli/index.js.map +1 -1
  181. package/dist/esm/utils/cli/utils/cli.helpers.js +1 -1
  182. package/dist/esm/utils/cli/utils/runtime-cli-commander.js +18 -3
  183. package/dist/esm/utils/cli/utils/runtime-cli-commander.js.map +1 -1
  184. package/dist/esm/utils/cli/utils/template-generator/templates/auth-configs-template.js +25 -22
  185. package/dist/esm/utils/cli/utils/template-generator/templates/auth-configs-template.js.map +1 -1
  186. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator-dto-generator.js +208 -0
  187. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator-dto-generator.js.map +1 -1
  188. package/dist/esm/utils/cli/utils/template-generator/templates/generate-controller-template.js +2 -2
  189. package/dist/esm/utils/cli/utils/template-generator/templates/generate-controller-template.js.map +1 -1
  190. package/dist/esm/utils/cli/utils/template-generator/templates/generate-multiple-components.js +144 -39
  191. package/dist/esm/utils/cli/utils/template-generator/templates/generate-multiple-components.js.map +1 -1
  192. package/dist/esm/utils/cli/utils/template-generator/templates/policy-template.js +45 -0
  193. package/dist/esm/utils/cli/utils/template-generator/templates/policy-template.js.map +1 -0
  194. package/dist/esm/utils/cli/utils/template-generator/templates/router-template.js +18 -30
  195. package/dist/esm/utils/cli/utils/template-generator/templates/router-template.js.map +1 -1
  196. package/dist/esm/utils/cli/utils/template-generator/templates/service-template.js +15 -0
  197. package/dist/esm/utils/cli/utils/template-generator/templates/service-template.js.map +1 -1
  198. package/dist/esm/utils/cli/utils/template-generator/templates/zod-schema-generator.js +169 -0
  199. package/dist/esm/utils/cli/utils/template-generator/templates/zod-schema-generator.js.map +1 -1
  200. package/dist/esm/utils/cli/utils/template-generators.js +19 -0
  201. package/dist/esm/utils/cli/utils/template-generators.js.map +1 -1
  202. package/dist/esm/utils/define-config.js +56 -1
  203. package/dist/esm/utils/define-config.js.map +1 -1
  204. package/dist/esm/utils/dynamic-loader.js +15 -88
  205. package/dist/esm/utils/dynamic-loader.js.map +1 -1
  206. package/dist/esm/utils/helpers/arkos-config.helpers.js +16 -32
  207. package/dist/esm/utils/helpers/arkos-config.helpers.js.map +1 -1
  208. package/dist/esm/utils/helpers/dynamic-loader.helpers.js.map +1 -1
  209. package/dist/esm/utils/helpers/exit-error.js +7 -0
  210. package/dist/esm/utils/helpers/exit-error.js.map +1 -0
  211. package/dist/esm/utils/helpers/fs.helpers.js +0 -8
  212. package/dist/esm/utils/helpers/fs.helpers.js.map +1 -1
  213. package/dist/esm/utils/helpers/global.helpers.js +1 -1
  214. package/dist/esm/utils/helpers/global.helpers.js.map +1 -1
  215. package/dist/esm/utils/helpers/routers.helpers.js +3 -2
  216. package/dist/esm/utils/helpers/routers.helpers.js.map +1 -1
  217. package/dist/esm/utils/initialize-app.js +53 -0
  218. package/dist/esm/utils/initialize-app.js.map +1 -0
  219. package/dist/esm/utils/setup-app.js +112 -0
  220. package/dist/esm/utils/setup-app.js.map +1 -0
  221. package/dist/types/app.d.ts +46 -4
  222. package/dist/types/components/arkos-policy/index.d.ts +31 -0
  223. package/dist/types/components/arkos-policy/types.d.ts +21 -0
  224. package/dist/types/exports/config.d.ts +2 -0
  225. package/dist/types/exports/error-handler/index.d.ts +1 -0
  226. package/dist/types/exports/index.d.ts +6 -38
  227. package/dist/types/modules/auth/auth.router.d.ts +2 -2
  228. package/dist/types/modules/auth/auth.service.d.ts +103 -7
  229. package/dist/types/modules/base/base.controller.d.ts +2 -2
  230. package/dist/types/modules/base/base.router.d.ts +2 -2
  231. package/dist/types/modules/base/base.service.d.ts +1 -1
  232. package/dist/types/modules/base/types/base.service.types.d.ts +0 -3
  233. package/dist/types/modules/base/utils/helpers/base.router.helpers.d.ts +3 -2
  234. package/dist/types/modules/email/email.service.d.ts +1 -1
  235. package/dist/types/modules/error-handler/utils/error-handler.helpers.d.ts +0 -7
  236. package/dist/types/modules/error-handler/utils/errors.d.ts +176 -0
  237. package/dist/types/modules/file-upload/file-upload.controller.d.ts +1 -1
  238. package/dist/types/modules/file-upload/file-upload.router.d.ts +2 -2
  239. package/dist/types/modules/swagger/swagger.router.d.ts +4 -3
  240. package/dist/types/modules/swagger/utils/get-open-api-login-html.d.ts +1 -0
  241. package/dist/types/server.d.ts +3 -22
  242. package/dist/types/types/arkos-config/utils.d.ts +68 -0
  243. package/dist/types/types/arkos.d.ts +31 -0
  244. package/dist/types/types/auth.d.ts +4 -4
  245. package/dist/types/types/index.d.ts +22 -0
  246. package/dist/types/types/new-arkos-config.d.ts +149 -7
  247. package/dist/types/types/router-config.d.ts +49 -8
  248. package/dist/types/utils/arkos-router/index.d.ts +4 -1
  249. package/dist/types/utils/arkos-router/types/index.d.ts +20 -4
  250. package/dist/types/utils/arkos-router/utils/helpers/apply-arkos-router-proxy.d.ts +7 -0
  251. package/dist/types/utils/arkos-router/utils/helpers/index.d.ts +1 -1
  252. package/dist/types/utils/cli/generate.d.ts +11 -0
  253. package/dist/types/utils/cli/utils/template-generator/templates/class-validator-dto-generator.d.ts +4 -0
  254. package/dist/types/utils/cli/utils/template-generator/templates/policy-template.d.ts +2 -0
  255. package/dist/types/utils/cli/utils/template-generator/templates/zod-schema-generator.d.ts +4 -0
  256. package/dist/types/utils/define-config.d.ts +21 -0
  257. package/dist/types/utils/dynamic-loader.d.ts +9 -19
  258. package/dist/types/utils/helpers/arkos-config.helpers.d.ts +2 -5
  259. package/dist/types/utils/helpers/dynamic-loader.helpers.d.ts +3 -2
  260. package/dist/types/utils/helpers/exit-error.d.ts +1 -0
  261. package/dist/types/utils/helpers/fs.helpers.d.ts +0 -15
  262. package/dist/types/utils/helpers/global.helpers.d.ts +1 -0
  263. package/dist/types/utils/helpers/routers.helpers.d.ts +2 -2
  264. package/dist/types/utils/initialize-app.d.ts +3 -0
  265. package/dist/types/utils/setup-app.d.ts +2 -0
  266. package/package.json +42 -20
  267. package/dist/cjs/types/arkos-config.js.map +0 -1
  268. package/dist/cjs/types/arkos-prisma-input.bak.js.map +0 -1
  269. package/dist/esm/types/arkos-config.js +0 -2
  270. package/dist/esm/types/arkos-config.js.map +0 -1
  271. package/dist/esm/types/arkos-prisma-input.bak.js +0 -2
  272. package/dist/esm/types/arkos-prisma-input.bak.js.map +0 -1
  273. package/dist/types/types/arkos-config.d.ts +0 -51
  274. package/dist/types/types/arkos-prisma-input.bak.d.ts +0 -237
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![Header Image](https://www.arkosjs.com/img/arkos-readme-header.webp?v=2)
1
+ ![Header Image](https://www.arkosjs.com/img/arkos-readme-header.webp?v=3)
2
2
 
3
3
  <div align="center">
4
4
 
@@ -15,50 +15,89 @@
15
15
  <p>A tool for backend developers and teams who ship software with complex business logic under tight deadlines</p>
16
16
  </div>
17
17
 
18
- ---
19
-
20
18
  <div align="center">
21
19
 
22
20
  **[Installation](https://www.arkosjs.com/docs/getting-started/installation)** •
23
- **[Documentation](https://arkosjs.com/docs/intro)** •
21
+ **[Documentation](https://arkosjs.com/docs)** •
24
22
  **[Website](https://arkosjs.com)** •
23
+ **[Tutorial](https://arkosjs.com/learn)** •
25
24
  **[GitHub](https://github.com/uanela/arkos)** •
26
25
  **[Blog](https://www.arkosjs.com/blog)** •
27
26
  **[Npm](https://www.npmjs.com/package/arkos)**
28
27
 
29
28
  </div>
30
29
 
31
- ---
30
+ ## Quick Start
32
31
 
33
- ## Why Arkos?
32
+ ```bash
33
+ pnpm create arkos@latest my-project
34
+ ```
34
35
 
35
- Every line of boilerplate code is a missed opportunity for innovation. Arkos.js gives developers back their time so they can focus on building what truly matters—**the core business logic**.
36
+ Your new project already has JWT auth, customizable CRUD routes, Swagger docs at `/api/docs`, file uploads, validation, and a full security middleware stack. Understand the generated [Project Structure](https://www.arkosjs.com/docs/getting-started/project-structure).
36
37
 
37
- **Perfect for:**
38
+ ## Your Entry Point
38
39
 
39
- - Backend developers shipping complex features under tight deadlines
40
- - Teams who want to scale fast without reinventing standard patterns
41
- - Projects that need production-ready auth, validation, and docs from day one
40
+ ```typescript
41
+ // src/app.ts
42
+ import arkos from "arkos";
43
+ import postRouter from "@/src/modules/post/post.router"; // custom router
42
44
 
43
- ## Quick Start
45
+ const app = arkos();
44
46
 
45
- Get started with Arkos.js in seconds:
47
+ app.use(postRouter);
46
48
 
47
- ```bash
48
- pnpm create arkos@latest my-project
49
+ app.listen();
49
50
  ```
50
51
 
51
- **That's it!** You now have:
52
+ Arkos replaces the Express `app` — but it _is_ Express under the hood. You can still use `app.use()`, custom middleware, and raw Express code wherever you need it.
53
+
54
+ ## Creating a Router Beyond Express
55
+
56
+ ```typescript
57
+ // src/modules/post/post.router.ts
58
+ import { ArkosRouter } from "arkos";
59
+ import CreatePostSchema from "@/src/modules/post/schemas/create-post.schema";
60
+ import postService from "@/src/modules/post/post.service";
61
+ import postPolicy from "@/src/modules/post/post.policy"; // Authorization component
62
+
63
+ const postRouter = ArkosRouter({ prefix: "/api/posts" });
64
+
65
+ postRouter.post(
66
+ {
67
+ path: "/", // auto registered into openapi
68
+ authentication: postPolicy.Create, // Authentication and authorization with RBAC
69
+ validation: { body: CreatePostSchema }, // auto documented into openapi requestBody
70
+ },
71
+ async (req, res) => {
72
+ const post = await postService.createOne(req.body); // no error handling need, arkos already handles it
73
+ res.json({ data: post });
74
+ }
75
+ );
76
+
77
+ export default postRouter;
78
+ ```
79
+
80
+ See more about the enhaced express-based router (ArkosRouter) at [ArkosRouter Guide](https://www.arkosjs.com/docs/core-concepts/components/routers).
81
+
82
+ ## Define Permissions Once, Guard Everywhere
83
+
84
+ ```typescript
85
+ // src/modules/post/post.policy.ts
86
+ import { ArkosPolicy } from "arkos";
87
+
88
+ const postPolicy: ArkosPolicy<"post"> = ArkosPolicy("post");
89
+
90
+ postPolicy.rule("Create", ["Writer", "Admin"]);
91
+ postPolicy.rule("View", ["Writer", "Admin", "User"]);
52
92
 
53
- - Production-ready REST API
54
- - JWT authentication
55
- - Auto-generated Swagger docs at `/api/docs`
56
- - File upload handling
57
- - Input validation
93
+ export default postPolicy;
94
+ ```
58
95
 
59
- ## See It In Action
96
+ Define who can do what, once, per resource. Arkos enforces it across every route that references the policy — no scattered middleware, no repeated role checks.
60
97
 
61
- **1. Define your Prisma model:**
98
+ ## Automatic CRUD: One Model, Full REST Endpoints
99
+
100
+ **Define The Prisma model:**
62
101
 
63
102
  ```prisma
64
103
  model Post {
@@ -66,162 +105,101 @@ model Post {
66
105
  title String
67
106
  content String
68
107
  authorId String
69
- author User @relation(fields: [authorId], references: [id])
108
+ author User @relation(fields: [authorId], references: [id])
70
109
  createdAt DateTime @default(now())
71
110
  updatedAt DateTime @updatedAt
72
111
  }
73
112
  ```
74
113
 
75
- **2. Get instant REST endpoints:**
114
+ **Get a full REST API — instantly:**
76
115
 
77
116
  ```
78
- POST /api/posts Create a new post
79
- GET /api/posts List all posts
80
- GET /api/posts/:id Get a specific post
81
- PATCH /api/posts/:id Update a post
82
- DELETE /api/posts/:id Delete a post
117
+ POST /api/posts Create a post
118
+ GET /api/posts List all posts
119
+ GET /api/posts/:id Get a post
120
+ PATCH /api/posts/:id Update a post
121
+ DELETE /api/posts/:id Delete a post
83
122
  ```
84
123
 
85
- All with built-in **authentication**, **validation**, and **documentation**. **Zero boilerplate.**
124
+ Authenticated, validated, and documented. Zero boilerplate.
86
125
 
87
- **3. Add custom business logic with interceptors:**
126
+ **Customize just like normal router:**
88
127
 
89
128
  ```typescript
129
+ // src/modules/post/post.router.ts
130
+ import { ArkosRouter, RouteHook } from "arkos";
131
+ import postPolicy from "@/src/modules/post/post.policy";
132
+ import UpdatePostSchema from "@/src/modules/post/post.schema";
133
+
134
+ export const hook: RouteHook<"prisma"> = {
135
+ findMany: { authentication: false }, // Making GET /api/posts public
136
+ createOne: { authentication: postPolicy.Create },
137
+ updateOne: {
138
+ authentication: postPolicy.Update,
139
+ validation: { body: UpdatePostSchema },
140
+ },
141
+ deleteOne: { authentication: postPolicy.Delete },
142
+ };
143
+
144
+ const postRouter = ArkosRouter({ prefix: "/api/posts" });
145
+
146
+ export default postRouter;
147
+ ```
148
+
149
+ Your auto-generated CRUD routes accept the same config as any ArkosRouter route — authentication, validation, rate limiting, all in one place.
150
+
151
+ **Add business logic exactly where you need it:**
152
+
153
+ ```typescript
154
+ // src/modules/post/post.interceptor.ts
90
155
  import { ArkosRequest, ArkosResponse, ArkosNextFunction } from "arkos";
91
- import { AppError } from "arkos/error-handler";
156
+ import { BadRequestError } from "arkos/error-handler";
92
157
 
93
158
  export const beforeCreateOne = [
94
159
  async (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => {
95
- // Add custom validation
96
- if (req.body.title.length < 5) {
97
- throw new AppErr("Title is too short", 400, "TitleTooShort");
98
- }
160
+ if (req.body.title.length < 5)
161
+ throw new BadRequestError("Title is too short", "TitleTooShort");
99
162
 
100
- // Enrich data
101
163
  req.body.slug = req.body.title.toLowerCase().replace(/\s/g, "-");
102
164
  req.body.authorId = req.user.id;
103
-
104
165
  next();
105
166
  },
106
167
  ];
107
168
  ```
108
169
 
109
- ## What You Get Out of the Box
110
-
111
- ### **Enterprise-Ready Authentication**
112
-
113
- - JWT token management with secure refresh tokens
114
- - Password hashing with bcrypt
115
- - Role-based access control (RBAC)
116
- - Production-ready from day one
117
-
118
- ### **Smart Data Validation**
119
-
120
- - Automatic validation from Prisma models
121
- - Zod schema integration
122
- - Class-validator support
123
- - Zero configuration required
124
-
125
- ### **Bulletproof Security Stack**
126
-
127
- - Rate limiting to prevent abuse
128
- - CORS configuration
129
- - Input sanitization with helmet.js
130
- - Comprehensive error handling
170
+ Name the file, export the hook, and Arkos picks it up automatically. No registration needed.
131
171
 
132
- ### **Self-Documenting APIs**
172
+ ## What You Stop Building From Scratch
133
173
 
134
- - Auto-generated OpenAPI/Swagger specifications
135
- - Beautiful interactive Scalar UI
136
- - Auto-sync with your routes
137
- - JSON schemas from Zod or Prisma models
138
-
139
- ### **Intelligent File Processing**
140
-
141
- - Multer-powered file uploads
142
- - Automatic image and video optimization
143
- - Smart type validation
144
- - Easy local storage configuration
145
-
146
- ### **Effortless Email Integration**
147
-
148
- - Built-in Nodemailer service
149
- - Template support
150
- - Clean, simple API
151
- - Just focus on your content
152
-
153
- ### **Powerful Interceptors**
154
-
155
- - Before/after request hooks
156
- - Custom validation logic
157
- - Data transformation
158
- - Flexible middleware system
159
-
160
- ### **Unmatched Prisma Integration**
161
-
162
- - Seamless ORM integration
163
- - Automatic relation handling
164
- - Write less Prisma, build more data
165
- - Built on Prisma's rock-solid foundation
166
-
167
- ## Arkos vs Traditional Setup
168
-
169
- | Task | Traditional Approach | With Arkos |
170
- | ------------------------ | --------------------------- | ---------------------- |
171
- | Setup JWT authentication | 2-3 hours of config | ✅ Built-in & ready |
172
- | Create CRUD routes | 30 min per model | ✅ Auto-generated |
173
- | Add input validation | Manual for each endpoint | ✅ Zod/Class-validator |
174
- | Setup API documentation | Install + configure Swagger | ✅ Auto-generated |
175
- | Configure file uploads | Multer setup + validation | ✅ Ready to use |
176
- | Add security middleware | Research + implement | ✅ Pre-configured |
177
- | **Total setup time** | **~8-12 hours** | **~5 minutes** |
178
-
179
- ## Features
180
-
181
- - **Automatic API Generation** - Instantly create RESTful routes from Prisma models
182
- - **Built-in Authentication** - JWT-based authentication with minimal setup
183
- - **Express Middlewares** - Pre-configured security, parsing, and error handling
184
- - **Data Validation** - Input validation and transformation capabilities
185
- - **Prisma Integration** - Seamless database management with relation fields support
186
- - **File Upload & Optimization** - Efficient handling of images, videos, and documents
187
- - **Interceptors Middlewares** - Customize request/response flow with hooks
188
- - **Nodemailer Integration** - Easy email sending functionality
189
- - **Swagger API Documentation** - Automatically generate API documentation
190
-
191
- **BETA VERSION**
192
-
193
- ## Trusted By Developers Building Daily
194
-
195
- > "Arkos.js changed how I work on the backend: with a Prisma model I already get CRUD routes, auth, and validation out-of-the-box — I saved a lot of time and could focus on business logic."
196
- > **— Gelson Matavela, Founder / Grupo Vergui**
197
-
198
- > "It removes boilerplate and provides a clean structure to build products. Built-in auth is powerful and ready. Automatic CRUD and docs save time, while interceptors allow flexible business logic."
199
- > **— Augusto Domingos, Tech Lead / DSAI For Moz**
200
-
201
- > "With Arkos.js, I can build backends in just a few minutes. It removes the boilerplate and lets me focus entirely on the core logic. Fast, simple, and incredibly productive."
202
- > **— Niuro Langa, Software Developer / SparkTech**
203
-
204
- [See more testimonials →](https://arkosjs.com)
174
+ | What you'd normally write | What Arkos gives you |
175
+ | ---------------------------------------- | --------------------------------- |
176
+ | JWT setup, refresh tokens, bcrypt | ✅ Built-in auth system |
177
+ | 5 route handlers per Prisma model | ✅ Auto-generated CRUD |
178
+ | Zod/CV schemas per endpoint | ✅ Auto generate from your models |
179
+ | Swagger config + schema upkeep | ✅ Auto-generated OpenAPI docs |
180
+ | Multer setup + file type validation | ✅ File upload system |
181
+ | Rate limiting, CORS, Helmet, compression | ✅ Pre-configured security stack |
182
+ | **Total setup time** | **~5 minutes vs ~8–12 hours** |
205
183
 
206
184
  ## Documentation
207
185
 
208
- For comprehensive guides, API reference, and examples, visit our [official documentation](https://arkosjs.com/docs/intro).
186
+ For comprehensive guides, API reference, and examples, visit our [official documentation](https://arkosjs.com/docs).
209
187
 
210
188
  **Quick Links:**
211
189
 
212
- - [Getting Started Guide](https://arkosjs.com/docs/intro)
213
- - [Authentication Setup](https://arkosjs.com/docs/core-concepts/authentication-system)
214
- - [Using Interceptors](https://arkosjs.com/docs/core-concepts/interceptors)
215
- - [File Uploads](https://arkosjs.com/docs/core-concepts/file-uploads)
216
- - [Validation](https://arkosjs.com/docs/core-concepts/request-data-validation)
217
- - [Email Service](https://arkosjs.com/docs/core-concepts/sending-emails)
190
+ - [Getting Started Guide](https://arkosjs.com/docs)
191
+ - [Authentication Setup](https://arkosjs.com/docs/core-concepts/authentication/setup)
192
+ - [Using Interceptors](https://arkosjs.com/docs/core-concepts/components/interceptors)
193
+ - [File Uploads](https://arkosjs.com/docs/guides/file-uploads/setup)
194
+ - [Validation](https://arkosjs.com/docs/guides/validation/setup)
195
+ - [Email Service](https://arkosjs.com/docs/guides/email-service)
218
196
 
219
197
  ## Getting Nightly Updates
220
198
 
221
199
  You can get the latest features we're testing before releasing them:
222
200
 
223
201
  ```bash
224
- pnpm create arkos@canary my-project
202
+ pnpm create arkos@next my-project
225
203
  ```
226
204
 
227
205
  ## Built With
@@ -234,32 +212,53 @@ Arkos.js is built on top of industry-leading tools:
234
212
 
235
213
  ## Support & Contributing
236
214
 
237
- - **Documentation:** [arkosjs.com/docs](https://arkosjs.com/docs/intro)
215
+ - **Documentation:** [arkosjs.com/docs](https://arkosjs.com/docs)
238
216
  - **Bug Reports:** [GitHub Issues](https://github.com/uanela/arkos/issues)
239
217
  - **Feature Requests:** Open a GitHub issue
240
218
  - **Contact:** [uanelaluiswayne@gmail.com](mailto:uanelaluiswayne@gmail.com)
241
219
 
242
220
  Contributions are welcome! We appreciate all contributions, from bug fixes to new features.
243
221
 
222
+ ## What Developers Say
223
+
224
+ > "Arkos.js changed how I work on the backend: with a Prisma model I already get CRUD routes, auth, and validation out-of-the-box — I saved a lot of time and could focus on business logic."
225
+ >
226
+ > **— Gelson Matavela, Founder / Grupo Vergui**
227
+
228
+ > "It removes boilerplate and provides a clean structure to build products. Built-in auth is powerful and ready. Automatic CRUD and docs save time, while interceptors allow flexible business logic."
229
+ >
230
+ > **— Augusto Domingos, Tech Lead / DSAI For Moz**
231
+
232
+ > "With Arkos.js, I can build backends in just a few minutes. It removes the boilerplate and lets me focus entirely on the core logic. Fast, simple, and incredibly productive."
233
+ >
234
+ > **— Niuro Langa, Software Developer / SparkTech**
235
+
236
+ [See more testimonials →](https://arkosjs.com)
237
+
238
+ ## Philosophy
239
+
240
+ Arkos sits between minimal frameworks like Express/Fastify and opinionated ones like NestJS/AdonisJS. It doesn't ask you to learn a new paradigm — it enhances the one most Node.js developers already use, by automating everything that's standardized and staying out of the way everywhere else.
241
+
242
+ Inspired by how Django and Laravel work in their ecosystems: batteries included, nothing forced on you.
243
+
244
+ > The name "Arkos" comes from the Greek word **ἀρχή** _(Arkhē)_, meaning "beginning" or "foundation".
245
+
244
246
  ## License
245
247
 
246
248
  This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
247
249
 
248
- ---
249
-
250
250
  <div align="center">
251
251
 
252
252
  **[Installation](https://www.arkosjs.com/docs/getting-started/installation)** •
253
- **[Documentation](https://arkosjs.com/docs/intro)** •
253
+ **[Documentation](https://arkosjs.com/docs)** •
254
254
  **[Website](https://arkosjs.com)** •
255
+ **[Tutorial](https://arkosjs.com/learn)** •
255
256
  **[GitHub](https://github.com/uanela/arkos)** •
256
257
  **[Blog](https://www.arkosjs.com/blog)** •
257
258
  **[Npm](https://www.npmjs.com/package/arkos)**
258
259
 
259
260
  Built with ❤️ by [Uanela Como](https://github.com/uanela) and contributors
260
261
 
261
- ---
262
-
263
262
  _The name "Arkos" comes from the Greek word "ἀρχή" (Arkhē), meaning "beginning" or "foundation", reflecting our goal of providing a solid foundation for backend development._
264
263
 
265
264
  </div>
package/cli.js CHANGED
@@ -1,26 +1,39 @@
1
1
  #!/usr/bin/env node
2
2
  (async () => {
3
- try {
4
- const { join } = await import("path");
5
- const { existsSync, readFileSync } = await import("fs");
3
+ const { join } = await import("path");
4
+ const { existsSync, readFileSync } = await import("fs");
5
+ const { spawn } = await import("child_process");
6
6
 
7
- let useEsm = false;
7
+ const pkgPath = join(process.cwd(), "package.json");
8
+ let useEsm = false;
8
9
 
9
- try {
10
- const pkgPath = join(process.cwd(), "package.json");
11
- if (existsSync(pkgPath)) {
12
- const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
13
- useEsm = pkg.type === "module";
14
- }
15
- } catch (err) {
16
- console.error("Error checking package.json:", err);
17
- }
18
-
19
- process.env.NO_CLI = "false";
20
- if (useEsm) await import("./dist/esm/utils/cli/index.js");
21
- else await import("./dist/cjs/utils/cli/index.js");
22
- } catch (err) {
23
- console.error("Failed to load CLI:", err);
24
- process.exit(1);
10
+ if (existsSync(pkgPath)) {
11
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
12
+ useEsm = pkg.type === "module";
25
13
  }
14
+
15
+ const tsSrc = join(process.cwd(), "tsconfig.json");
16
+ const entryPoint = join(
17
+ __dirname,
18
+ `dist/${useEsm ? "esm" : "cjs"}/utils/cli/index.js`
19
+ );
20
+ const useTs = existsSync(tsSrc);
21
+
22
+ const args = [
23
+ ...(useTs ? ["--experimental-strip-types"] : []),
24
+ entryPoint,
25
+ ...process.argv.slice(2),
26
+ ];
27
+
28
+ process.env.NO_CLI = "true";
29
+ process.env.FORCE_COLOR = "3";
30
+ const child = spawn(process.execPath, args, {
31
+ stdio: ["inherit", "inherit", "pipe"],
32
+ });
33
+ child.stderr.on("data", (data) => {
34
+ const str = data.toString();
35
+ if (!str.includes("ExperimentalWarning: Type Stripping is an experimental"))
36
+ process.stderr.write(data);
37
+ });
38
+ child.on("exit", (code) => process.exit(code ?? 0));
26
39
  })();