bhooai-nexus 0.1.5 → 2.0.1

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 (329) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +109 -230
  3. package/bin/nexus.js +5 -13
  4. package/docs/ARCHITECTURE.md +134 -121
  5. package/docs/CLI.md +147 -0
  6. package/docs/CONVENTIONS.md +193 -0
  7. package/docs/MULTI_APP.md +107 -0
  8. package/docs/STORAGE.md +118 -0
  9. package/package.json +58 -57
  10. package/packages/nexus-admin/package.json +7 -6
  11. package/packages/nexus-admin/src/App.tsx +51 -4857
  12. package/packages/nexus-admin/src/api.ts +52 -576
  13. package/packages/nexus-admin/src/components/components.tsx +51 -0
  14. package/packages/nexus-admin/src/index.css +75 -3632
  15. package/packages/nexus-admin/src/tabs/Ai.tsx +70 -0
  16. package/packages/nexus-admin/src/tabs/Apps.tsx +53 -0
  17. package/packages/nexus-admin/src/tabs/Config.tsx +31 -0
  18. package/packages/nexus-admin/src/tabs/Health.tsx +38 -0
  19. package/packages/nexus-admin/src/tabs/Logs.tsx +52 -0
  20. package/packages/nexus-admin/src/tabs/Overview.tsx +43 -0
  21. package/packages/nexus-admin/src/tabs/Payments.tsx +62 -0
  22. package/packages/nexus-admin/src/tabs/Users.tsx +45 -0
  23. package/packages/nexus-ads/package.json +22 -22
  24. package/packages/nexus-ai-client/package.json +22 -20
  25. package/packages/nexus-auth/package.json +24 -24
  26. package/packages/nexus-cache/package.json +23 -23
  27. package/packages/nexus-cli/package.json +17 -12
  28. package/packages/nexus-cli/src/commands/add.ts +274 -0
  29. package/packages/nexus-cli/src/commands/build.ts +91 -0
  30. package/packages/nexus-cli/src/commands/db.ts +241 -0
  31. package/packages/nexus-cli/src/commands/dev.ts +149 -186
  32. package/packages/nexus-cli/src/commands/doctor.ts +102 -184
  33. package/packages/nexus-cli/src/commands/init.ts +232 -955
  34. package/packages/nexus-cli/src/commands/maintenance-commands.ts +40 -0
  35. package/packages/nexus-cli/src/commands/plugin.ts +233 -0
  36. package/packages/nexus-cli/src/commands/queue.ts +145 -0
  37. package/packages/nexus-cli/src/commands/test.ts +34 -0
  38. package/packages/nexus-cli/src/dispatcher.ts +98 -0
  39. package/packages/nexus-cli/src/generators.ts +102 -0
  40. package/packages/nexus-cli/src/index.ts +32 -90
  41. package/packages/nexus-cli/src/make/generators.ts +431 -0
  42. package/packages/nexus-cli/src/ports.ts +85 -0
  43. package/packages/nexus-cli/src/prompts.ts +68 -0
  44. package/packages/nexus-cli/src/templating/render.ts +109 -0
  45. package/packages/nexus-cli/src/util.ts +74 -112
  46. package/packages/nexus-cli/templates/base/Dockerfile.ejs +68 -0
  47. package/packages/nexus-cli/templates/base/README.md.ejs +62 -0
  48. package/packages/nexus-cli/templates/base/apps/admin/index.html.ejs +12 -0
  49. package/packages/nexus-cli/templates/base/apps/admin/nginx.conf.ejs +16 -0
  50. package/packages/nexus-cli/templates/base/apps/admin/package.json.ejs +15 -0
  51. package/packages/nexus-cli/templates/base/apps/admin/src/main.tsx.ejs +7 -0
  52. package/packages/nexus-cli/templates/base/apps/admin/vite.config.ts.ejs +22 -0
  53. package/packages/nexus-cli/templates/base/apps/ai-server/main.py.ejs +30 -0
  54. package/packages/nexus-cli/templates/base/apps/ai-server/requirements.txt +4 -0
  55. package/packages/nexus-cli/templates/base/apps/backend/src/main.ts +14 -0
  56. package/packages/nexus-cli/templates/base/apps/backend/src/routes/index.ts.ejs +11 -0
  57. package/packages/nexus-cli/templates/base/apps/frontend/index.html.ejs +12 -0
  58. package/packages/nexus-cli/templates/base/apps/frontend/nginx.conf.ejs +33 -0
  59. package/packages/nexus-cli/templates/base/apps/frontend/package.json.ejs +11 -0
  60. package/packages/nexus-cli/templates/base/apps/frontend/src/main.tsx.ejs +16 -0
  61. package/packages/nexus-cli/templates/base/apps/frontend/vite.config.ts.ejs +22 -0
  62. package/packages/nexus-cli/templates/base/docker-compose.yml.ejs +93 -0
  63. package/packages/nexus-cli/templates/base/dockerignore +21 -0
  64. package/packages/nexus-cli/templates/base/gitignore +43 -0
  65. package/packages/nexus-cli/templates/base/nexus.config.ts.ejs +97 -0
  66. package/packages/nexus-cli/templates/base/package.json.ejs +41 -0
  67. package/packages/nexus-cli/templates/{tsconfig.json → base/tsconfig.json} +2 -3
  68. package/packages/nexus-core/package.json +28 -40
  69. package/packages/nexus-core/src/app/ErrorHandler.ts +65 -0
  70. package/packages/nexus-core/src/app/FormRequest.ts +43 -0
  71. package/packages/nexus-core/src/app/Job.ts +98 -0
  72. package/packages/nexus-core/src/app/Mailable.ts +114 -0
  73. package/packages/nexus-core/src/app/Resource.ts +37 -0
  74. package/packages/nexus-core/src/app/Seeder.ts +17 -0
  75. package/packages/nexus-core/src/app/ServiceProvider.ts +16 -0
  76. package/packages/nexus-core/src/app/Storage.ts +366 -0
  77. package/packages/nexus-core/src/app/adminModule.ts +354 -0
  78. package/packages/nexus-core/src/app/createNexusApp.ts +356 -0
  79. package/packages/nexus-core/src/app/defineRoutes.ts +48 -0
  80. package/packages/nexus-core/src/app/discover.ts +144 -0
  81. package/packages/nexus-core/src/app/errorPages/_base.html +121 -0
  82. package/packages/nexus-core/src/app/errorPages.ts +117 -0
  83. package/packages/nexus-core/src/app/events.ts +81 -0
  84. package/packages/nexus-core/src/app/index.ts +15 -0
  85. package/packages/nexus-core/src/app/maintenance.ts +80 -0
  86. package/packages/nexus-core/src/app/policies.ts +53 -0
  87. package/packages/nexus-core/src/config/defaults.ts +0 -20
  88. package/packages/nexus-core/src/config/env.ts +1 -0
  89. package/packages/nexus-core/src/config/schema.ts +1 -27
  90. package/packages/nexus-core/src/config/types.ts +3 -86
  91. package/packages/nexus-core/src/index.ts +2 -1
  92. package/packages/nexus-crypto/package.json +22 -20
  93. package/packages/nexus-data/package.json +26 -29
  94. package/packages/nexus-data/src/index.ts +0 -6
  95. package/packages/nexus-data/src/projects.ts +0 -66
  96. package/packages/nexus-email/package.json +24 -24
  97. package/packages/nexus-examples/examples/ai-chat/README.md +37 -0
  98. package/packages/nexus-examples/examples/ai-chat/apps/backend/src/routes/chat.ts +40 -0
  99. package/packages/nexus-examples/examples/ai-chat/apps/frontend/src/main.tsx +105 -0
  100. package/packages/nexus-examples/examples/blog-crud/README.md +45 -0
  101. package/packages/nexus-examples/examples/blog-crud/apps/backend/src/graphql/post.graph.ts +99 -0
  102. package/packages/nexus-examples/examples/blog-crud/apps/backend/src/models/Author.ts +10 -0
  103. package/packages/nexus-examples/examples/blog-crud/apps/backend/src/models/Comment.ts +10 -0
  104. package/packages/nexus-examples/examples/blog-crud/apps/backend/src/models/Post.ts +13 -0
  105. package/packages/nexus-examples/examples/blog-crud/apps/backend/src/routes/posts.ts +119 -0
  106. package/packages/nexus-examples/examples/blog-crud/apps/frontend/src/main.tsx +102 -0
  107. package/packages/nexus-examples/examples/chat/README.md +20 -0
  108. package/packages/nexus-examples/examples/chat/apps/backend/src/models/Message.ts +11 -0
  109. package/packages/nexus-examples/examples/chat/apps/backend/src/routes/chat.ts +17 -0
  110. package/packages/nexus-examples/examples/chat/apps/backend/src/ws/chat.room.ts +56 -0
  111. package/packages/nexus-examples/examples/chat/apps/frontend/src/main.tsx +97 -0
  112. package/packages/nexus-examples/examples/checkout/README.md +40 -0
  113. package/packages/nexus-examples/examples/checkout/apps/backend/src/mail/mailables/OrderConfirmationMail.ts +27 -0
  114. package/packages/nexus-examples/examples/checkout/apps/backend/src/mail/templates/order-confirmation.ejs +28 -0
  115. package/packages/nexus-examples/examples/checkout/apps/backend/src/models/Order.ts +14 -0
  116. package/packages/nexus-examples/examples/checkout/apps/backend/src/routes/checkout.ts +74 -0
  117. package/packages/nexus-examples/examples/checkout/apps/frontend/src/main.tsx +85 -0
  118. package/packages/nexus-examples/examples/dashboard/README.md +26 -0
  119. package/packages/nexus-examples/examples/dashboard/apps/backend/src/routes/metrics.ts +76 -0
  120. package/packages/nexus-examples/examples/dashboard/apps/frontend/src/main.tsx +100 -0
  121. package/packages/nexus-examples/examples/file-storage/README.md +48 -0
  122. package/packages/nexus-examples/examples/file-storage/apps/backend/src/routes/files.ts +86 -0
  123. package/packages/nexus-examples/examples/file-storage/apps/frontend/src/main.tsx +111 -0
  124. package/packages/nexus-examples/examples/livestream/README.md +34 -0
  125. package/packages/nexus-examples/examples/livestream/apps/backend/src/routes/list.ts +21 -0
  126. package/packages/nexus-examples/examples/livestream/apps/backend/src/ws/stream.room.ts +53 -0
  127. package/packages/nexus-examples/examples/livestream/apps/frontend/src/main.tsx +148 -0
  128. package/packages/nexus-examples/examples/multi-app/README.md +51 -0
  129. package/packages/nexus-examples/examples/multi-app/apps/backend-api/src/routes/users.ts +26 -0
  130. package/packages/nexus-examples/examples/multi-app/apps/backend-shop/src/routes/products.ts +27 -0
  131. package/packages/nexus-examples/examples/saas-starter/README.md +37 -0
  132. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/events/TeamCreated.ts +11 -0
  133. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/events/UserRegistered.ts +10 -0
  134. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/listeners/OnTeamCreated.ts +11 -0
  135. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/listeners/OnUserRegistered.ts +10 -0
  136. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/middleware/auth.ts +14 -0
  137. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/models/Membership.ts +20 -0
  138. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/models/Team.ts +10 -0
  139. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/models/User.ts +17 -0
  140. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/policies/TeamPolicy.ts +35 -0
  141. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/routes/projects.ts +52 -0
  142. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/routes/teams.ts +112 -0
  143. package/packages/nexus-examples/examples/saas-starter/apps/frontend/src/main.tsx +95 -0
  144. package/packages/nexus-examples/examples/video-call/README.md +30 -0
  145. package/packages/nexus-examples/examples/video-call/apps/backend/src/ws/signaling.room.ts +47 -0
  146. package/packages/nexus-examples/examples/video-call/apps/frontend/src/main.tsx +116 -0
  147. package/packages/nexus-examples/package.json +14 -0
  148. package/packages/nexus-examples/src/index.ts +99 -0
  149. package/packages/nexus-graphql/package.json +26 -26
  150. package/packages/nexus-payments/package.json +22 -22
  151. package/packages/nexus-plugins/package.json +22 -22
  152. package/packages/nexus-postcss/package.json +44 -41
  153. package/packages/nexus-realtime/package.json +28 -28
  154. package/packages/nexus-safe-goto/package.json +16 -0
  155. package/packages/nexus-safe-goto/src/index.tsx +173 -0
  156. package/packages/nexus-telemetry/package.json +22 -22
  157. package/src/index.ts +53 -0
  158. package/apps/admin/index.html +0 -12
  159. package/apps/admin/package.json +0 -23
  160. package/apps/admin/postcss.config.js +0 -5
  161. package/apps/admin/public/anime-girl.svg +0 -84
  162. package/apps/admin/public/bhooai-nexus-logo.png +0 -0
  163. package/apps/admin/public/bhooai-nexus-logo.svg +0 -135
  164. package/apps/admin/public/favicon.ico +0 -0
  165. package/apps/admin/src/main.tsx +0 -10
  166. package/apps/admin/src/vite-env.d.ts +0 -18
  167. package/apps/admin/tailwind.config.js +0 -10
  168. package/apps/admin/tsconfig.json +0 -17
  169. package/apps/admin/vite.config.ts +0 -68
  170. package/docs/IMPROVEMENTS.md +0 -105
  171. package/docs/api/admin.html +0 -651
  172. package/docs/api/ads.html +0 -314
  173. package/docs/api/ai-client.html +0 -336
  174. package/docs/api/auth.html +0 -697
  175. package/docs/api/cache.html +0 -331
  176. package/docs/api/cli.html +0 -612
  177. package/docs/api/cluster.html +0 -489
  178. package/docs/api/core.html +0 -796
  179. package/docs/api/crypto.html +0 -310
  180. package/docs/api/data.html +0 -811
  181. package/docs/api/email.html +0 -345
  182. package/docs/api/graphql.html +0 -697
  183. package/docs/api/http-endpoints.html +0 -221
  184. package/docs/api/node-agent.html +0 -155
  185. package/docs/api/payments.html +0 -558
  186. package/docs/api/plugins.html +0 -522
  187. package/docs/api/postcss.html +0 -241
  188. package/docs/api/realtime.html +0 -324
  189. package/docs/api/safe-goto.html +0 -215
  190. package/docs/api/supervisor.html +0 -312
  191. package/docs/api/telemetry.html +0 -264
  192. package/docs/api/websockets.html +0 -163
  193. package/docs/architecture.html +0 -211
  194. package/docs/assets/bhooai-nexus-cluster-link.postman_collection.json +0 -185
  195. package/docs/assets/bhooai-nexus-local.postman_environment.json +0 -47
  196. package/docs/assets/bhooai-nexus-logo.png +0 -0
  197. package/docs/assets/bhooai-nexus-logo.svg +0 -135
  198. package/docs/assets/docs.js +0 -368
  199. package/docs/assets/favicon.ico +0 -0
  200. package/docs/assets/favicon.zip +0 -0
  201. package/docs/assets/nav.js +0 -91
  202. package/docs/assets/playground.js +0 -283
  203. package/docs/assets/screenshots/01-collection.png +0 -0
  204. package/docs/assets/screenshots/02-step1-csrf.png +0 -0
  205. package/docs/assets/screenshots/03-step2-login.png +0 -0
  206. package/docs/assets/screenshots/04-step3-link.png +0 -0
  207. package/docs/assets/screenshots/05-error-fetch-failed.png +0 -0
  208. package/docs/assets/screenshots/06-error-agent-401.png +0 -0
  209. package/docs/assets/screenshots/07-error-401-csrf.png +0 -0
  210. package/docs/assets/screenshots/08-env-runner.png +0 -0
  211. package/docs/assets/screenshots/visual-flow.png +0 -0
  212. package/docs/assets/style.css +0 -1140
  213. package/docs/examples.html +0 -248
  214. package/docs/favicon.ico +0 -0
  215. package/docs/getting-started.html +0 -155
  216. package/docs/guides/guide-ai-chat.html +0 -202
  217. package/docs/guides/guide-auth.html +0 -328
  218. package/docs/guides/guide-cluster.html +0 -325
  219. package/docs/guides/guide-email.html +0 -234
  220. package/docs/guides/guide-empty-project.html +0 -279
  221. package/docs/guides/guide-frontend-styling.html +0 -235
  222. package/docs/guides/guide-graphql.html +0 -214
  223. package/docs/guides/guide-mongodb.html +0 -220
  224. package/docs/guides/guide-payments.html +0 -321
  225. package/docs/guides/guide-uploads.html +0 -170
  226. package/docs/guides/guide-websocket.html +0 -263
  227. package/docs/improvements.html +0 -146
  228. package/docs/index.html +0 -101
  229. package/docs/learn/01-foundation.html +0 -129
  230. package/docs/learn/02-security.html +0 -104
  231. package/docs/learn/03-data.html +0 -99
  232. package/docs/learn/04-graphql.html +0 -86
  233. package/docs/learn/05-realtime.html +0 -76
  234. package/docs/learn/06-payments-email-crypto.html +0 -93
  235. package/docs/learn/07-cache-ads.html +0 -85
  236. package/docs/learn/08-ai.html +0 -93
  237. package/docs/learn/09-plugins.html +0 -81
  238. package/docs/learn/10-cluster.html +0 -83
  239. package/docs/learn/11-cli.html +0 -183
  240. package/docs/learn/12-apps.html +0 -123
  241. package/docs/learn/13-tests.html +0 -79
  242. package/docs/learn/14-postman-testing.html +0 -580
  243. package/docs/learn/PLAN.md +0 -59
  244. package/docs/learn/index.html +0 -87
  245. package/docs/screenshots/README.md +0 -23
  246. package/docs/screenshots/ai-agents-playground.png +0 -0
  247. package/docs/screenshots/ai-agents-providers.png +0 -0
  248. package/docs/screenshots/ai-agents.png +0 -0
  249. package/docs/screenshots/appearance.png +0 -0
  250. package/docs/screenshots/cluster-master.png +0 -0
  251. package/docs/screenshots/cluster-nodes.png +0 -0
  252. package/docs/screenshots/cluster-slave.png +0 -0
  253. package/docs/screenshots/login.png +0 -0
  254. package/docs/screenshots/logs-ai-summary.png +0 -0
  255. package/docs/screenshots/monitoring.png +0 -0
  256. package/docs/screenshots/nexus-dev.png +0 -0
  257. package/docs/screenshots/nexus-init.png +0 -0
  258. package/docs/screenshots/notification.png +0 -0
  259. package/docs/screenshots/overview.png +0 -0
  260. package/docs/screenshots/search-bar.png +0 -0
  261. package/docs/screenshots/settings.png +0 -0
  262. package/docs/screenshots/themes.png +0 -0
  263. package/docs/troubleshooting.html +0 -400
  264. package/packages/nexus-admin/src/alertCenter.tsx +0 -150
  265. package/packages/nexus-admin/src/assets/bhooai-nexus-logo.svg +0 -25
  266. package/packages/nexus-admin/src/vite-env.d.ts +0 -19
  267. package/packages/nexus-cli/src/commands/cluster.ts +0 -133
  268. package/packages/nexus-cli/src/commands/node.ts +0 -106
  269. package/packages/nexus-cli/src/commands/pysetup.ts +0 -142
  270. package/packages/nexus-cli/src/commands/sync.ts +0 -116
  271. package/packages/nexus-cli/src/commands/uninstall.ts +0 -287
  272. package/packages/nexus-cli/src/config-sync.ts +0 -384
  273. package/packages/nexus-cli/src/dotenv.ts +0 -39
  274. package/packages/nexus-cli/src/supervisor.ts +0 -394
  275. package/packages/nexus-cli/src/wizard.ts +0 -149
  276. package/packages/nexus-cli/templates/Dockerfile +0 -60
  277. package/packages/nexus-cli/templates/README.md +0 -69
  278. package/packages/nexus-cli/templates/apps/admin/index.html +0 -12
  279. package/packages/nexus-cli/templates/apps/admin/package.json +0 -22
  280. package/packages/nexus-cli/templates/apps/admin/postcss.config.js +0 -3
  281. package/packages/nexus-cli/templates/apps/admin/src/main.tsx +0 -10
  282. package/packages/nexus-cli/templates/apps/admin/src/vite-env.d.ts +0 -18
  283. package/packages/nexus-cli/templates/apps/admin/tailwind.config.js +0 -9
  284. package/packages/nexus-cli/templates/apps/admin/tsconfig.json +0 -17
  285. package/packages/nexus-cli/templates/apps/admin/vite.config.ts +0 -64
  286. package/packages/nexus-cli/templates/apps/ai-server/main.py +0 -43
  287. package/packages/nexus-cli/templates/apps/ai-server/providers/__init__.py +0 -3
  288. package/packages/nexus-cli/templates/apps/ai-server/providers/base.py +0 -111
  289. package/packages/nexus-cli/templates/apps/ai-server/requirements.txt +0 -3
  290. package/packages/nexus-cli/templates/apps/ai-server/routers/__init__.py +0 -3
  291. package/packages/nexus-cli/templates/apps/ai-server/routers/chat.py +0 -47
  292. package/packages/nexus-cli/templates/apps/ai-server/routers/embeddings.py +0 -30
  293. package/packages/nexus-cli/templates/apps/ai-server/routers/lint.py +0 -167
  294. package/packages/nexus-cli/templates/apps/ai-server/routers/models.py +0 -23
  295. package/packages/nexus-cli/templates/apps/ai-server/routers/preflight.py +0 -169
  296. package/packages/nexus-cli/templates/apps/ai-server/settings.py +0 -48
  297. package/packages/nexus-cli/templates/apps/backend/package.json +0 -34
  298. package/packages/nexus-cli/templates/apps/backend/src/main.ts +0 -375
  299. package/packages/nexus-cli/templates/apps/backend/src/modules/admin/adminRoutes.ts +0 -732
  300. package/packages/nexus-cli/templates/apps/backend/src/modules/admin/clusterRoutes.ts +0 -391
  301. package/packages/nexus-cli/templates/apps/backend/src/modules/admin/databaseRoutes.ts +0 -161
  302. package/packages/nexus-cli/templates/apps/backend/src/modules/admin/lintProxy.ts +0 -89
  303. package/packages/nexus-cli/templates/apps/backend/src/modules/admin/preflightProxy.ts +0 -242
  304. package/packages/nexus-cli/templates/apps/backend/src/modules/admin/roleCatalog.ts +0 -78
  305. package/packages/nexus-cli/templates/apps/backend/src/modules/admin/schemaRoutes.ts +0 -449
  306. package/packages/nexus-cli/templates/apps/backend/src/modules/ai/aiProxy.ts +0 -265
  307. package/packages/nexus-cli/templates/apps/backend/src/modules/auth/authRoutes.ts +0 -220
  308. package/packages/nexus-cli/templates/apps/backend/src/modules/payments/paymentRoutes.ts +0 -100
  309. package/packages/nexus-cli/templates/apps/backend/src/modules/payments/paymentStore.ts +0 -172
  310. package/packages/nexus-cli/templates/apps/backend/src/modules/requests/requestLog.ts +0 -175
  311. package/packages/nexus-cli/templates/apps/backend/src/modules/users/userGraph.ts +0 -83
  312. package/packages/nexus-cli/templates/apps/backend/src/modules/users/userModel.ts +0 -88
  313. package/packages/nexus-cli/templates/apps/backend/src/plugins/CronScheduler.ts +0 -69
  314. package/packages/nexus-cli/templates/apps/backend/src/plugins/loadPlugins.ts +0 -107
  315. package/packages/nexus-cli/templates/apps/backend/tsconfig.json +0 -14
  316. package/packages/nexus-cli/templates/apps/frontend/index.html +0 -12
  317. package/packages/nexus-cli/templates/apps/frontend/package.json +0 -20
  318. package/packages/nexus-cli/templates/apps/frontend/postcss.config.js +0 -3
  319. package/packages/nexus-cli/templates/apps/frontend/src/index.css +0 -44
  320. package/packages/nexus-cli/templates/apps/frontend/src/main.tsx +0 -65
  321. package/packages/nexus-cli/templates/apps/frontend/tailwind.config.js +0 -9
  322. package/packages/nexus-cli/templates/apps/frontend/vite.config.ts +0 -72
  323. package/packages/nexus-cli/templates/bin/nexus.js +0 -35
  324. package/packages/nexus-cli/templates/bin/serve-all.mjs +0 -45
  325. package/packages/nexus-cli/templates/dockerignore +0 -15
  326. package/packages/nexus-cli/templates/gitignore +0 -12
  327. package/packages/nexus-cli/templates/nexus.config.ts +0 -69
  328. package/packages/nexus-cli/templates/package.json +0 -47
  329. /package/packages/nexus-cli/templates/{uploads → base/apps/backend/storage}/.gitkeep +0 -0
package/LICENSE CHANGED
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,289 +1,168 @@
1
- # BhooAI Nexus
1
+ # BhooAI Nexus v2
2
2
 
3
- Build full-stack Node.js applications with one CLI and one configuration file. BhooAI Nexus includes an HTTP server, WebSockets, GraphQL federation, MongoDB data access, authentication, CSRF/CORS protection, payments, email, WebRTC, Python AI services, plugins, an admin console, and master/slave cluster orchestration.
3
+ A production-ready Node.js full-stack framework. One config file, one CLI, multi-app monorepo.
4
4
 
5
- ## Features
5
+ > v2 is a fresh workspace at `C:\server\PACKAGES\bhooai-nexus\` — reuses v1's packages, removes the
6
+ > cluster subsystem (Docker handles scaling), rewrites the CLI, and adds a Laravel-style
7
+ > convention layer on top.
6
8
 
7
- - Node.js HTTP server with trie routing, middleware, uploads, static files, security headers, CORS, CSRF, and rate limiting
8
- - MongoDB ODM with schemas, hooks, indexes, populate, and transactions
9
- - JWT access tokens, refresh tokens, sessions, Google OAuth, Facebook OAuth, and role-based access control
10
- - WebSockets, Redis adapters, WebRTC signaling, and mediasoup SFU integration
11
- - GraphQL subscriptions, federation composition, entity joins, `@provides`, and `@requires`
12
- - Razorpay, PayPal, PayU, Skrill, and Payoneer integrations
13
- - Email, certificate generation, Redis cache, Google Ads, and plugin extensions
14
- - Python FastAPI AI server with OpenAI-compatible chat, embeddings, Ollama, and SSE streaming
15
- - Admin console with configuration, environment, process, monitoring, database, AI, and cluster management
16
- - Master/slave cluster mesh with load balancing, node agents, request allocation, health checks, and upload path pinning
17
- - Tailwind CSS + `@bhooai/nexus-postcss` preset with PostCSS pipeline, design tokens, and dark theme baseline for every scaffolded frontend
9
+ ## Quick start
18
10
 
19
- ## Requirements
20
-
21
- - Node.js `>=20.10`
22
- - npm, included with Node.js
23
- - MongoDB 7 or newer, running locally or reachable through `MONGODB_URI`
24
- - Redis 7 or newer, running locally or reachable through `REDIS_URL`
25
- - Python 3.10 or newer for the optional AI server
26
- - A virtual environment is recommended for Python dependencies
27
-
28
- The Python service dependencies are listed in [`apps/ai-server/requirements.txt`](apps/ai-server/requirements.txt): FastAPI, Uvicorn, HTTPX, pytest, and pytest-asyncio.
29
-
30
- MongoDB and Redis can be started with Docker, system services, or managed cloud providers. The AI server is optional when AI features are not used.
31
-
32
- ## Install
11
+ `nexus init` scaffolds the project **and installs its dependencies** in one step.
33
12
 
34
13
  ```bash
35
- npm install bhooai-nexus
36
- npx nexus init my-app
14
+ # One-time: install the CLI (or use npx without installing)
15
+ npm install -g bhooai-nexus
16
+
17
+ # New project (zero prompts — opinionated defaults)
18
+ nexus init my-app
37
19
  cd my-app
38
- npm run doctor
39
20
  npm run dev
40
21
  ```
41
22
 
42
- Initialize the current directory with `npx nexus init .`. Use `npx nexus init . --skip-install` to defer dependency installation.
43
-
44
- ## Quick Start
23
+ Prefer `npx` over a global install? `nexus init` auto-installs deps either way:
45
24
 
46
25
  ```bash
47
- npm install bhooai-nexus
48
26
  npx nexus init my-app
49
27
  cd my-app
50
- npm run doctor
51
28
  npm run dev
52
29
  ```
53
30
 
54
- Default development services:
55
-
56
- | Service | Default port |
57
- | --- | ---: |
58
- | Backend API | `4000` |
59
- | Frontend | `3000` |
60
- | Admin console | `3300` |
61
- | Python AI server | `8000` |
62
- | Cluster load balancer | `8080` |
63
- | Node agent | `7575` |
64
-
65
- `nexus dev` automatically moves a configured port to the next available port, allowing master and slave projects to run side by side on one machine.
66
-
67
- ## Screenshots
68
-
69
- ### Admin login
70
-
71
- ![BhooAI Nexus admin login](docs/screenshots/login.png)
72
-
73
- ### Overview dashboard
74
-
75
- ![BhooAI Nexus overview dashboard](docs/screenshots/overview.png)
76
-
77
- ### Master cluster management
78
-
79
- ![BhooAI Nexus master cluster management](docs/screenshots/cluster-master.png)
80
-
81
- ### Slave node agent and roles
82
-
83
- ![BhooAI Nexus slave node agent](docs/screenshots/cluster-slave.png)
84
-
85
- ### Connected cluster nodes
86
-
87
- ![Connected cluster nodes](docs/screenshots/cluster-nodes.png)
88
-
89
- ### AI agents
90
-
91
- ![AI agents](docs/screenshots/ai-agents.png)
92
-
93
- ### AI providers
94
-
95
- ![AI agent providers](docs/screenshots/ai-agents-providers.png)
96
-
97
- ### AI playground
98
-
99
- ![AI playground](docs/screenshots/ai-agents-playground.png)
100
-
101
- ### Monitoring
102
-
103
- ![Monitoring dashboard](docs/screenshots/monitoring.png)
104
-
105
- ### Settings
106
-
107
- ![Settings](docs/screenshots/settings.png)
108
-
109
- ### Themes
110
-
111
- ![Theme selection](docs/screenshots/themes.png)
112
-
113
- ### Appearance
114
-
115
- ![Appearance settings](docs/screenshots/appearance.png)
116
-
117
- ### Search
118
-
119
- ![Admin search](docs/screenshots/search-bar.png)
120
-
121
- ### Notifications
122
-
123
- ![Notifications](docs/screenshots/notification.png)
124
-
125
- ### AI log summary
126
-
127
- ![AI log summary](docs/screenshots/logs-ai-summary.png)
128
-
129
- ### Nexus development services
130
-
131
- ![Nexus development services](docs/screenshots/nexus-dev.png)
132
-
133
- ### Nexus initialization
134
-
135
- ![Nexus initialization](docs/screenshots/nexus-init.png)
136
-
137
- ## Cluster Mesh
138
-
139
- BhooAI Nexus supports a central master and one or more slave nodes.
140
-
141
- Initialize a master:
142
-
143
31
  ```bash
144
- npx nexus init master --as=root
32
+ # Wizard with example picker
33
+ nexus init my-app --interactive
34
+ # or, named example:
35
+ nexus init my-app --example chat
145
36
  ```
146
37
 
147
- Initialize a slave with a built-in role:
38
+ Skip dependency install for CI/offline use:
148
39
 
149
40
  ```bash
150
- npx nexus init slave-1 --as=node --role=backend --port=7575
151
- npx nexus init slave-2 --as=node --role=files --port=7576
41
+ nexus init my-app --no-install
152
42
  ```
153
43
 
154
- Supported node roles are `backend`, `files`, `database`, and `ai`.
155
-
156
- After `npm run dev`, a node project automatically starts its node agent. The agent exposes the control API and advertises the node's development backend without starting a duplicate backend process.
157
-
158
- The master load balancer listens on port `8080` and distributes traffic across ready backend nodes. Authentication routes are pinned to the master:
44
+ ## Architecture at a glance
159
45
 
160
- - `/auth/*`
161
- - `/csrf-token`
162
-
163
- Use the same `NEXUS_AUTH_JWT_SECRET` on all nodes so slaves can verify master-issued access tokens.
164
-
165
- ### Upload path allocation
46
+ ```
47
+ ┌──────────────── Multi-app monorepo ─────────────────┐
48
+ │ apps/backend/ ← Node.js, auto-discovery │
49
+ │ apps/backend-shop/ ← add via `nexus add backend` │
50
+ │ apps/frontend/ ← Vite + React │
51
+ │ apps/frontend-shop/ ← add via `nexus add frontend` │
52
+ │ apps/admin/ ← wraps @bhooai/nexus-admin │
53
+ │ apps/ai-server/ ← FastAPI (optional) │
54
+ │ .nexus-ports.json ← stable port registry │
55
+ │ nexus.config.ts │
56
+ │ docker-compose.yml │
57
+ └──────────────────────────────────────────────────────┘
58
+ ```
166
59
 
167
- The master admin console includes **Cluster → Path routing**. Pin URL prefixes to specific nodes:
60
+ Each backend follows a Laravel-style convention under `src/`:
168
61
 
169
- ```text
170
- /uploads/images -> slave-1
171
- /uploads/files -> slave-2
62
+ ```
63
+ src/
64
+ ├── main.ts # 20-line createNexusApp()
65
+ ├── routes/ # HTTP endpoints (auto-discovered)
66
+ ├── graphql/ # *.graph.ts (federation)
67
+ ├── ws/ # *.room.ts (WebSocket rooms)
68
+ ├── mail/templates/ # *.ejs
69
+ ├── mail/mailables/ # classes
70
+ ├── errors/pages/ # 404.html / 500.html / ...
71
+ ├── errors/Handler.ts
72
+ ├── models/ services/ repositories/ controllers/
73
+ ├── middleware/ validators/ jobs/ listeners/ events/
74
+ ├── policies/ resources/ requests/ helpers/ config/
75
+ ├── database/{seeds,migrations}/ providers/ plugins/ types/ constants/
172
76
  ```
173
77
 
174
- Path pins use longest-prefix matching. A pinned request is sent only to its configured node. If the pinned node is unavailable, the load balancer returns `503 pinned_node_down` instead of silently sending the request to another node.
175
-
176
- When no slave nodes are linked, the load balancer fails open to the master's own backend if `cluster.failOpenSingleNode` is enabled. This keeps a cluster-enabled master usable as a single-node installation.
78
+ ## CLI
177
79
 
178
- Upload endpoints accept both `/uploads` and sub-paths such as `/uploads/images`. The upload directory is created automatically on the node that handles the request.
80
+ ```
81
+ Project init · dev · build · test · doctor · sync · uninstall · down · up
82
+ Multi-app add backend <name>
83
+ add frontend <name> [--for <backend>]
84
+ add route <name> --app <backend>
85
+ add module <payments|ai|admin|uploads|graphql-subgraph>
86
+
87
+ Data db:seed · db:migrate · db:rollback
88
+ Queue queue:work · queue:retry
89
+ Plugins plugin new · install · remove · list
90
+
91
+ Generators (make:*) — 21 total:
92
+ route · controller · model · service · repository · middleware · validator ·
93
+ job · event · listener · policy · resource · request · mail · room · subgraph ·
94
+ seeder · migration · provider · plugin
95
+ ```
179
96
 
180
- ## Admin Console
97
+ ## Examples
181
98
 
182
- Open the admin console at `http://localhost:3300` during development. The console provides overview, processes, logs, configuration, environment, plugins, users, monitoring, payments, databases, schema, AI, and cluster management.
99
+ 10 examples ship in `packages/nexus-examples/` and are overlayable via `nexus init --example`:
183
100
 
184
- The Cluster tab includes connected-node cards with request allocation percentage, CPU, memory, freshness, service health, test, enable, restart, and unlink controls. Slave mode includes role selection, node-agent status, pairing tokens, node IDs, and copyable serve/link commands. Master mode includes path-prefix routing for uploads and other services.
101
+ | Example | Demos |
102
+ |---|---|
103
+ | `empty` | bare scaffold |
104
+ | `chat` | realtime rooms, presence, typing |
105
+ | `video-call` | WebRTC signaling, 1:1 RTCPeerConnection |
106
+ | `checkout` | payments + mailables + HMAC webhook verify |
107
+ | `livestream` | broadcaster/viewer roles, streaming |
108
+ | `ai-chat` | streaming LLM via SSE |
109
+ | `saas-starter` | auth + teams + projects + policies + events |
110
+ | `blog-crud` | ODM models, GraphQL federation subgraph |
111
+ | `dashboard` | admin-metrics demo, CSS-only viz |
112
+ | `file-storage` | local + S3 storage, signed private URLs |
113
+ | `multi-app` | two backends, two frontends, one admin |
185
114
 
186
- ## Configuration
115
+ ## Storage
187
116
 
188
- Edit `nexus.config.ts`. Configuration precedence is:
117
+ Per-backend `storage/` folder with `local` + `s3` drivers shipped:
189
118
 
190
- ```text
191
- code defaults < nexus.config.ts < nexus.runtime.json < NEXUS_* environment variables < CLI flags
119
+ ```ts
120
+ import { storage } from 'bhooai-nexus';
121
+ await storage.disk('uploads').put('avatars', file);
122
+ const url = await storage.disk('private').signedUrl('invoices/1.pdf');
192
123
  ```
193
124
 
194
- Admin changes are written to the gitignored `nexus.runtime.json` file. Store secrets in the project `.env` file:
195
-
196
- ```env
197
- MONGODB_URI=mongodb://localhost:27017/my-app
198
- REDIS_URL=redis://localhost:6379
199
- NEXUS_AUTH_JWT_SECRET=replace-with-a-long-random-secret
200
- ```
125
+ UUID filenames + `YYYY/MM` sharding. EXIF-stripped. sharp-driven image transforms.
201
126
 
202
- Common port overrides include `NEXUS_SERVER_PORT`, `NEXUS_FRONTEND_PORT`, `NEXUS_ADMIN_PORT`, `NEXUS_CLUSTER_LBPORT`, `NEXUS_CLUSTER_NODEAGENTPORT`, and `AI_PORT`.
127
+ ## Importing the framework
203
128
 
204
- ## Uninstall
129
+ `bhooai-nexus` is the umbrella package — one import surfaces the whole API:
205
130
 
206
- Preview changes:
207
-
208
- ```bash
209
- npx nexus uninstall --dry-run
131
+ ```ts
132
+ import { createNexusApp, storage, model, Schema, AiClient, defineRoutes } from 'bhooai-nexus';
210
133
  ```
211
134
 
212
- Remove the project database and registration while keeping files:
213
-
214
- ```bash
215
- npx nexus uninstall
216
- ```
135
+ Prefer narrower imports for smaller bundles? Use the sub-path exports
136
+ (`bhooai-nexus/core`, `bhooai-nexus/data`, `bhooai-nexus/ai-client`, …) or the
137
+ scoped packages (`@bhooai/nexus-core`, `@bhooai/nexus-data`, …) directly.
217
138
 
218
- Remove the database, registration, and project directory:
139
+ ## Maintenance mode
219
140
 
220
- ```bash
221
- npx nexus uninstall --purge
222
141
  ```
223
-
224
- Skip confirmations or keep the database:
225
-
226
- ```bash
227
- npx nexus uninstall --purge --force
228
- npx nexus uninstall --keep-db
142
+ nexus down --message "Quick upgrade"
143
+ nexus up
229
144
  ```
230
145
 
231
- Uninstall does not remove the framework package, MongoDB's `nexus_projects` database, or other projects.
232
-
233
- ## Project Layout
234
-
235
- ```text
236
- packages/ Framework packages (@bhooai/nexus-*)
237
- apps/backend/ Node.js backend
238
- apps/frontend/ React + Vite frontend
239
- apps/admin/ React + Vite admin host
240
- apps/ai-server/ Python FastAPI AI service
241
- bin/ CLI entry point
242
- contracts/ Node-to-Python API contracts
243
- plugins/ Project plugins
244
- tests/ Cross-service tests
245
- docs/ Architecture, improvements, and screenshots
246
- ```
146
+ All requests return 503 + Retry-After except `/health`.
247
147
 
248
- ## Testing
148
+ ## Tests
249
149
 
250
150
  ```bash
251
151
  npx vitest run
252
- cd apps/ai-server
253
- python -m pip install -r requirements.txt
254
- pytest
255
152
  ```
256
153
 
257
- Run Playwright end-to-end tests from the framework root:
258
-
259
- ```bash
260
- npx playwright test --config=playwright.config.ts
261
- ```
262
-
263
- ## Docker
264
-
265
- ```powershell
266
- .\docker.ps1 build
267
- .\docker.ps1 run
268
- .\docker.ps1 logs
269
- .\docker.ps1 stop
270
- ```
271
-
272
- Development endpoints are frontend `http://localhost:3000`, admin `http://localhost:3300`, and backend `http://localhost:4000/health`.
273
-
274
- ## Documentation
275
-
276
- - [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) — architecture and data flow
277
- - [`docs/IMPROVEMENTS.md`](docs/IMPROVEMENTS.md) — improvement history
278
- - [`docs/troubleshooting.html`](docs/troubleshooting.html) — common errors and fixes
279
- - [`docs/screenshots/README.md`](docs/screenshots/README.md) — screenshot catalog
280
- - [`apps/ai-server/README.md`](apps/ai-server/README.md) — Python AI service
281
- - Package documentation under `packages/nexus-*/README.md`
154
+ Current suite covers: app factory, event bus, policies, generators name normalization,
155
+ EJS templating. 27 tests, all green.
282
156
 
283
- ## Design Principles
157
+ ## Status
284
158
 
285
- BhooAI Nexus avoids Apollo, Express, and Mongoose where direct control is required. The HTTP server, trie router, ODM, federation layer, and plugin sandbox are implemented in the workspace. Established libraries are used for standards and infrastructure, including GraphQL.js, MongoDB, Redis, WebSockets, Nodemailer, Jose, and mediasoup.
159
+ - P0–P12 shipped (skeleton, app factory, abstractions, storage, CLI, plugins, db, queue,
160
+ generators, port registry, examples, docker, admin strip + Apps tab)
161
+ - Admin rebuilt as a fresh Apps-tab-first SPA with live backend endpoints
162
+ (registry, health, request logs, config, users, payments, AI proxy)
163
+ - `bhooai-nexus` is the publishable main package — umbrella import + auto-installing init
164
+ - v1's test suite has 97 pre-existing tsc errors (unrelated to v2 src; tracked separately)
286
165
 
287
166
  ## License
288
167
 
289
- BhooAI Nexus is released under the [MIT License](LICENSE).
168
+ MIT
package/bin/nexus.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * BhooAI Nexus CLI entry.
3
+ * BhooAI Nexus v2 CLI entry.
4
4
  *
5
- * Thin ESM shim: loads the compiled `@bhooai/nexus-cli` dist if present,
6
- * otherwise runs the TypeScript source via tsx's programmatic API (which
7
- * rewrites .js import specifiers to .ts). This keeps the framework usable
8
- * with `node bin/nexus.js ...` and no build step.
5
+ * Thin ESM shim: loads compiled `packages/nexus-cli/dist/index.js` if
6
+ * present, otherwise runs the TypeScript source via tsx (which rewrites .js
7
+ * import specifiers to .ts). Keeps `node bin/nexus.js ...` working with
8
+ * no build step.
9
9
  */
10
10
  import { pathToFileURL } from 'node:url';
11
11
  import { existsSync } from 'node:fs';
@@ -20,13 +20,8 @@ async function main() {
20
20
  const { tsImport } = await import('tsx/esm/api');
21
21
  let mod;
22
22
  if (existsSync(srcEntry)) {
23
- // Prefer source in the monorepo and in the published package so the CLI
24
- // does not depend on a stale or omitted build artifact.
25
23
  mod = await tsImport(pathToFileURL(srcEntry).href, import.meta.url);
26
24
  } else if (existsSync(distEntry)) {
27
- // Workspace packages export TypeScript sources with `.js` specifiers.
28
- // Keep tsx in the chain even when the CLI dist exists so Node can resolve
29
- // those source imports during development and after partial builds.
30
25
  mod = await tsImport(pathToFileURL(distEntry).href, import.meta.url);
31
26
  } else {
32
27
  mod = await tsImport(pathToFileURL(srcEntry).href, import.meta.url);
@@ -36,9 +31,6 @@ async function main() {
36
31
  await mod.run(cmd, rest);
37
32
  }
38
33
 
39
- /** True when a rejected promise was the user pressing Ctrl+C during an
40
- * interactive prompt (node:readline/promises rejects the open question with an
41
- * AbortError). A cancelled wizard is not a failure — no error dump. */
42
34
  function isUserCancel(err) {
43
35
  if (!err) return false;
44
36
  if (err.name === 'AbortError') return true;