bhooai-nexus 2.0.9 → 2.0.11

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 (46) hide show
  1. package/README.md +50 -0
  2. package/package.json +1 -1
  3. package/packages/nexus-admin/package.json +1 -1
  4. package/packages/nexus-admin/src/App.tsx +214 -214
  5. package/packages/nexus-ads/package.json +1 -1
  6. package/packages/nexus-ai-client/package.json +1 -1
  7. package/packages/nexus-auth/package.json +1 -1
  8. package/packages/nexus-cache/package.json +1 -1
  9. package/packages/nexus-cli/package.json +1 -1
  10. package/packages/nexus-cli/src/commands/add.ts +122 -59
  11. package/packages/nexus-cli/src/commands/init.ts +169 -6
  12. package/packages/nexus-cli/src/devPanel.ts +44 -31
  13. package/packages/nexus-cli/src/devServiceManager.ts +13 -2
  14. package/packages/nexus-cli/src/dispatcher.ts +1 -1
  15. package/packages/nexus-cli/src/launcher.ts +14 -2
  16. package/packages/nexus-cli/src/templating/tree.ts +4 -2
  17. package/packages/nexus-cli/src/tui.ts +74 -15
  18. package/packages/nexus-cli/src/util.ts +11 -5
  19. package/packages/nexus-cli/src/wizard.ts +4 -5
  20. package/packages/nexus-cli/templates/base/package.json.ejs +2 -1
  21. package/packages/nexus-cli/templates/features/realtime/apps/backend/src/ws/chat.room.ts +34 -35
  22. package/packages/nexus-core/package.json +1 -1
  23. package/packages/nexus-core/src/app/createNexusApp.ts +114 -0
  24. package/packages/nexus-crypto/package.json +1 -1
  25. package/packages/nexus-data/package.json +1 -1
  26. package/packages/nexus-email/package.json +1 -1
  27. package/packages/nexus-examples/examples/blog-crud/apps/backend/src/routes/posts.ts +2 -2
  28. package/packages/nexus-examples/examples/chat/apps/backend/src/routes/chat.ts +14 -4
  29. package/packages/nexus-examples/examples/chat/apps/backend/src/ws/chat.room.ts +34 -19
  30. package/packages/nexus-examples/examples/chat/apps/frontend/src/main.tsx +58 -16
  31. package/packages/nexus-examples/examples/checkout/apps/backend/src/mail/templates/order-confirmation.ejs +3 -3
  32. package/packages/nexus-examples/examples/multi-app/_setup.mjs +39 -0
  33. package/packages/nexus-examples/examples/multi-app/apps/backend-api/src/routes/users.ts +18 -1
  34. package/packages/nexus-examples/examples/multi-app/apps/backend-shop/src/routes/products.ts +18 -1
  35. package/packages/nexus-examples/examples/multi-app/apps/frontend-shop/src/main.tsx +63 -0
  36. package/packages/nexus-examples/examples/multi-app/apps/frontend-web/src/main.tsx +70 -0
  37. package/packages/nexus-examples/examples/multi-app/apps/frontend-web/vite.config.ts +17 -0
  38. package/packages/nexus-examples/examples/saas-starter/apps/backend/src/middleware/auth.ts +2 -1
  39. package/packages/nexus-examples/package.json +2 -2
  40. package/packages/nexus-graphql/package.json +1 -1
  41. package/packages/nexus-payments/package.json +1 -1
  42. package/packages/nexus-plugins/package.json +1 -1
  43. package/packages/nexus-postcss/package.json +2 -2
  44. package/packages/nexus-realtime/package.json +1 -1
  45. package/packages/nexus-safe-goto/package.json +2 -2
  46. package/packages/nexus-telemetry/package.json +1 -1
package/README.md CHANGED
@@ -192,6 +192,56 @@ seeder · migration · provider · plugin
192
192
  | `file-storage` | local + S3 storage, signed private URLs |
193
193
  | `multi-app` | two backends, two frontends, one admin |
194
194
 
195
+ ### Multi-app example — how to use
196
+
197
+ Nexus as a platform: two backends (`shop` + `api`) and two frontends (`web` + `shop`) in one project, single admin. The overlay ships only two route files; actual `apps/` are scaffolded via `nexus add`.
198
+
199
+ **Option A — fresh project (wizard):**
200
+
201
+ ```bash
202
+ npx nexus init my-platform
203
+ # wizard: Starter -> Examples -> pick "multi-app" -> Admin? Yes -> Features/Ports/Infra -> Review & create
204
+ cd my-platform
205
+
206
+ # scaffold the extra backends (ports auto-assigned in .nexus-ports.json)
207
+ npx nexus add backend shop
208
+ npx nexus add backend api
209
+
210
+ # wire frontends to chosen backends (--for sets Vite proxy /api, /uploads, /ws)
211
+ npx nexus add frontend shop --for backend-shop
212
+ npx nexus add frontend web --for backend
213
+
214
+ npx nexus dev
215
+ ```
216
+
217
+ Or non-interactively: `npx nexus init my-platform --example multi-app` then run the same `add` commands.
218
+
219
+ **Option B — existing project:**
220
+
221
+ ```bash
222
+ npx nexus add backend shop
223
+ npx nexus add backend api
224
+ # if project wasn't inited with multi-app, copy the two demo routes manually:
225
+ # apps/backend-shop/src/routes/products.ts -> GET /api/products, GET /api/products/:id
226
+ # apps/backend-api/src/routes/users.ts -> GET /api/users, GET /api/users/:id
227
+ npx nexus add frontend shop --for backend-shop
228
+ ```
229
+
230
+ **What you end up with:**
231
+
232
+ ```
233
+ apps/
234
+ backend/ # default backend from init
235
+ backend-shop/ # storefront API -> routes/products.ts
236
+ backend-api/ # shared API -> routes/users.ts
237
+ frontend/ # default frontend
238
+ frontend-shop/ # proxies to backend-shop
239
+ frontend-web/ # proxies to backend
240
+ admin/ # single admin aggregating health/logs across all backends
241
+ ```
242
+
243
+ Each `apps/backend-*` is an isolated `createNexusApp()` with its own `src/routes`, `src/ws`, `src/models`, etc. auto-discovered. Verify with `curl http://localhost:4010/api/products` and `curl http://localhost:4011/api/users` after `nexus dev` prints the port map. See `packages/nexus-examples/examples/multi-app/README.md`.
244
+
195
245
  ## Storage
196
246
 
197
247
  Per-backend `storage/` folder with `local` + `s3` drivers shipped:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhooai-nexus",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
4
4
  "description": "BhooAI Nexus - a Node-based full-stack framework (websockets, GraphQL federation, inbuilt security, custom ODM, OAuth, payments, WebRTC, AI, plugins). v2: multi-app, Laravel-style folders, Docker-based scaling.",
5
5
  "license": "MIT",
6
6
  "author": "BhooAI",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bhooai/nexus-admin",
3
- "version": "2.0.11",
3
+ "version": "2.0.12",
4
4
  "description": "BhooAI Nexus v2 admin SPA — Apps-tab-first, live registry/health/logs/config/users/payments/AI",
5
5
  "type": "module",
6
6
  "license": "MIT",