bhooai-nexus 2.0.13 → 3.0.4
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.
- package/README.md +113 -43
- package/package.json +23 -14
- package/packages/nexus-admin/package.json +1 -1
- package/packages/nexus-admin/src/App.tsx +280 -37
- package/packages/nexus-admin/src/api.ts +56 -0
- package/packages/nexus-admin/src/index.css +10 -1
- package/packages/nexus-ads/package.json +1 -1
- package/packages/nexus-ai-client/package.json +22 -20
- package/packages/nexus-ai-client/src/client.ts +3 -0
- package/packages/nexus-auth/package.json +1 -1
- package/packages/nexus-cache/package.json +1 -1
- package/packages/nexus-cli/package.json +6 -3
- package/packages/nexus-cli/src/commands/add.ts +32 -10
- package/packages/nexus-cli/src/commands/dev.ts +206 -127
- package/packages/nexus-cli/src/commands/init.ts +45 -12
- package/packages/nexus-cli/src/commands/license.ts +174 -0
- package/packages/nexus-cli/src/devPanel.ts +1381 -990
- package/packages/nexus-cli/src/devServiceManager.ts +416 -40
- package/packages/nexus-cli/src/features.ts +58 -11
- package/packages/nexus-cli/src/fusion/server.ts +251 -0
- package/packages/nexus-cli/src/index.ts +2 -0
- package/packages/nexus-cli/src/launcher.ts +35 -3
- package/packages/nexus-cli/src/ports.ts +112 -61
- package/packages/nexus-cli/src/tui.ts +272 -15
- package/packages/nexus-cli/src/wizard.ts +210 -23
- package/packages/nexus-cli/templates/base/apps/admin/vite.config.ts.ejs +15 -9
- package/packages/nexus-cli/templates/base/apps/backend/package.json.ejs +1 -0
- package/packages/nexus-cli/templates/base/apps/backend/src/live/root.live.js.ejs +26 -0
- package/packages/nexus-cli/templates/base/apps/backend/src/main.ts +1 -1
- package/packages/nexus-cli/templates/base/apps/backend/src/routes/index.ts.ejs +2 -0
- package/packages/nexus-cli/templates/base/apps/backend/src/routes/upload.ts.ejs +31 -0
- package/packages/nexus-cli/templates/base/apps/frontend/index.html.ejs +1 -0
- package/packages/nexus-cli/templates/base/apps/frontend/src/App.tsx.ejs +7 -2
- package/packages/nexus-cli/templates/base/apps/frontend/src/NotFound.tsx.ejs +56 -0
- package/packages/nexus-cli/templates/base/apps/frontend/vite.config.ts.ejs +15 -8
- package/packages/nexus-cli/templates/base/apps/pyserver/main.py.ejs +19 -0
- package/packages/nexus-cli/templates/base/apps/pyserver/requirements.txt.ejs +20 -0
- package/packages/nexus-cli/templates/base/apps/pyserver/routers/.gitkeep +0 -0
- package/packages/nexus-cli/templates/base/apps/pyserver/scripts/chat.py.ejs +40 -0
- package/packages/nexus-cli/templates/base/apps/pyserver/scripts/hello.py.ejs +5 -0
- package/packages/nexus-cli/templates/base/dockerignore +0 -1
- package/packages/nexus-cli/templates/base/gitignore +4 -1
- package/packages/nexus-cli/templates/base/nexus.config.ts.ejs +37 -1
- package/packages/nexus-cli/templates/base/package.json.ejs +12 -11
- package/packages/nexus-core/package.json +3 -2
- package/packages/nexus-core/src/app/Storage.ts +616 -9
- package/packages/nexus-core/src/app/Upload.ts +114 -0
- package/packages/nexus-core/src/app/adminModule.ts +256 -52
- package/packages/nexus-core/src/app/authModule.ts +56 -30
- package/packages/nexus-core/src/app/createNexusApp.ts +171 -28
- package/packages/nexus-core/src/app/databaseAdminModule.ts +171 -2
- package/packages/nexus-core/src/app/discover.ts +4 -2
- package/packages/nexus-core/src/app/errorPages.ts +21 -5
- package/packages/nexus-core/src/app/fusionEngine.ts +53 -0
- package/packages/nexus-core/src/app/index.ts +3 -0
- package/packages/nexus-core/src/app/preflightModule.ts +41 -4
- package/packages/nexus-core/src/app/userStore.ts +321 -0
- package/packages/nexus-core/src/certs/generator.ts +224 -0
- package/packages/nexus-core/src/config/dbAccess.ts +26 -0
- package/packages/nexus-core/src/config/defaults.ts +34 -4
- package/packages/nexus-core/src/config/index.ts +1 -0
- package/packages/nexus-core/src/config/schema.ts +72 -6
- package/packages/nexus-core/src/config/types.ts +94 -1
- package/packages/nexus-core/src/http/Server.ts +27 -3
- package/packages/nexus-core/src/http/static.ts +1 -1
- package/packages/nexus-crypto/package.json +1 -1
- package/packages/nexus-crypto/src/index.ts +2 -1
- package/packages/nexus-crypto/src/license.ts +141 -0
- package/packages/nexus-data/package.json +1 -1
- package/packages/nexus-data/src/errors.ts +11 -3
- package/packages/nexus-data/src/model/Model.ts +25 -1
- package/packages/nexus-data/src/schema/Schema.ts +1 -1
- package/packages/nexus-email/package.json +1 -1
- package/packages/nexus-examples/examples/chat/apps/backend/src/ws/chat.room.ts +11 -0
- package/packages/nexus-examples/examples/emotion-garden/apps/backend/src/live/_nav.js +17 -0
- package/packages/nexus-examples/examples/emotion-garden/apps/backend/src/live/garden.live.js +105 -0
- package/packages/nexus-examples/examples/file-storage/README.md +22 -4
- package/packages/nexus-examples/examples/file-storage/apps/backend/src/graphql/app.graph.ts +60 -2
- package/packages/nexus-examples/examples/file-storage/apps/backend/src/handlers/file.handler.ts +164 -6
- package/packages/nexus-examples/examples/file-storage/apps/frontend/src/main.tsx +32 -7
- package/packages/nexus-examples/examples/fusion-tree/README.md +169 -0
- package/packages/nexus-examples/examples/fusion-tree/apps/backend/src/handlers/ai.handler.ts +368 -0
- package/packages/nexus-examples/examples/fusion-tree/apps/backend/src/handlers/cache.handler.ts +79 -0
- package/packages/nexus-examples/examples/fusion-tree/apps/backend/src/handlers/fusion.handler.ts +437 -0
- package/packages/nexus-examples/examples/fusion-tree/apps/backend/src/routes/cache.ts +21 -0
- package/packages/nexus-examples/examples/fusion-tree/apps/backend/src/routes/fusion.ts +40 -0
- package/packages/nexus-examples/examples/fusion-tree/apps/backend/src/services/AiService.ts +184 -0
- package/packages/nexus-examples/examples/fusion-tree/apps/backend/src/services/CacheService.ts +65 -0
- package/packages/nexus-examples/examples/fusion-tree/apps/backend/src/services/FusionService.ts +141 -0
- package/packages/nexus-examples/examples/fusion-tree/apps/backend/src/services/QueryCache.ts +169 -0
- package/packages/nexus-examples/examples/fusion-tree/apps/frontend/src/AiPanel.tsx +179 -0
- package/packages/nexus-examples/examples/fusion-tree/apps/frontend/src/CachePanel.tsx +114 -0
- package/packages/nexus-examples/examples/fusion-tree/apps/frontend/src/main.tsx +412 -0
- package/packages/nexus-examples/examples/future-more/apps/backend/src/live/_nav.js +29 -0
- package/packages/nexus-examples/examples/future-more/apps/backend/src/live/ai.live.js +84 -0
- package/packages/nexus-examples/examples/future-more/apps/backend/src/live/all-examples.live.js +42 -0
- package/packages/nexus-examples/examples/future-more/apps/backend/src/live/chat.live.js +32 -0
- package/packages/nexus-examples/examples/future-more/apps/backend/src/live/counter.live.js +24 -0
- package/packages/nexus-examples/examples/future-more/apps/backend/src/live/gallery.live.js +46 -0
- package/packages/nexus-examples/examples/future-more/apps/backend/src/live/posts.live.js +32 -0
- package/packages/nexus-examples/examples/future-more/apps/backend/src/live/presence.live.js +47 -0
- package/packages/nexus-examples/examples/future-more/apps/backend/src/live/stats.live.js +50 -0
- package/packages/nexus-examples/examples/image-lab/README.md +26 -0
- package/packages/nexus-examples/examples/image-lab/apps/backend/src/routes/images.ts +184 -0
- package/packages/nexus-examples/examples/image-lab/apps/frontend/src/App.tsx +235 -0
- package/packages/nexus-examples/examples/image-lab/apps/frontend/src/main.tsx +6 -0
- package/packages/nexus-examples/examples/mario-platformer/README.md +13 -0
- package/packages/nexus-examples/examples/mario-platformer/apps/backend/src/live/_nav.js +16 -0
- package/packages/nexus-examples/examples/mario-platformer/apps/backend/src/live/root.live.js +178 -0
- package/packages/nexus-examples/examples/morph-ui/apps/backend/src/live/_nav.js +19 -0
- package/packages/nexus-examples/examples/morph-ui/apps/backend/src/live/cards.live.js +58 -0
- package/packages/nexus-examples/examples/morph-ui/apps/backend/src/live/list.live.js +84 -0
- package/packages/nexus-examples/examples/morph-ui/apps/backend/src/live/morphui.live.js +189 -0
- package/packages/nexus-examples/examples/python-bridge/README.md +12 -0
- package/packages/nexus-examples/examples/python-bridge/_setup.mjs +27 -0
- package/packages/nexus-examples/examples/python-bridge/apps/backend/src/routes/python-bridge.ts +120 -0
- package/packages/nexus-examples/examples/python-bridge/apps/frontend/src/App.tsx +61 -0
- package/packages/nexus-examples/examples/python-bridge-future/README.md +10 -0
- package/packages/nexus-examples/examples/python-bridge-future/_setup.mjs +27 -0
- package/packages/nexus-examples/examples/python-bridge-future/apps/backend/src/live/_nav.js +16 -0
- package/packages/nexus-examples/examples/python-bridge-future/apps/backend/src/live/p.live.js +12 -0
- package/packages/nexus-examples/examples/python-bridge-future/apps/backend/src/live/p1.live.js +13 -0
- package/packages/nexus-examples/examples/python-bridge-future/apps/backend/src/live/root.live.js +53 -0
- package/packages/nexus-examples/examples/saas-starter/apps/backend/src/graphql/app.graph.ts +4 -3
- package/packages/nexus-examples/examples/saas-starter/apps/frontend/src/main.tsx +6 -3
- package/packages/nexus-examples/package.json +1 -1
- package/packages/nexus-examples/src/index.ts +84 -1
- package/packages/nexus-fusion/package.json +41 -0
- package/packages/nexus-fusion/src/adapters/MongoMirror.ts +115 -0
- package/packages/nexus-fusion/src/adapters/RedisBridge.ts +89 -0
- package/packages/nexus-fusion/src/adapters/index.ts +3 -0
- package/packages/nexus-fusion/src/cache/FusionCache.ts +422 -0
- package/packages/nexus-fusion/src/cache/index.ts +2 -0
- package/packages/nexus-fusion/src/firebase/offlineQueue.ts +89 -0
- package/packages/nexus-fusion/src/firebase/onSnapshot.ts +98 -0
- package/packages/nexus-fusion/src/firebase/refs.ts +422 -0
- package/packages/nexus-fusion/src/firebase/securityRules.ts +121 -0
- package/packages/nexus-fusion/src/firebase/transforms.ts +73 -0
- package/packages/nexus-fusion/src/firebase/types.ts +45 -0
- package/packages/nexus-fusion/src/index.ts +248 -0
- package/packages/nexus-fusion/src/native/index.d.ts +0 -0
- package/packages/nexus-fusion/src/native/loader.ts +168 -0
- package/packages/nexus-fusion/src/playground/playgroundHtml.ts +461 -0
- package/packages/nexus-fusion/src/realtime/Emitter.ts +30 -0
- package/packages/nexus-fusion/src/schemas/auth.ts +32 -0
- package/packages/nexus-fusion/src/schemas/cms.ts +40 -0
- package/packages/nexus-fusion/src/schemas/core.ts +155 -0
- package/packages/nexus-fusion/src/schemas/ecommerce.ts +46 -0
- package/packages/nexus-fusion/src/schemas/index.ts +19 -0
- package/packages/nexus-fusion-core/package.json +20 -0
- package/packages/nexus-fusion-core/src/cache.rs +196 -0
- package/packages/nexus-fusion-core/src/engine.rs +772 -0
- package/packages/nexus-fusion-core/src/errors.rs +51 -0
- package/packages/nexus-fusion-core/src/idgen.rs +100 -0
- package/packages/nexus-fusion-core/src/lib.rs +17 -0
- package/packages/nexus-fusion-core/src/napi_glue.rs +333 -0
- package/packages/nexus-fusion-core/src/query.rs +513 -0
- package/packages/nexus-fusion-core/src/tree.rs +282 -0
- package/packages/nexus-fusion-core/src/types.rs +147 -0
- package/packages/nexus-fusion-core/src/wal.rs +1877 -0
- package/packages/nexus-future/LICENSE +21 -0
- package/packages/nexus-future/package.json +63 -0
- package/packages/nexus-future/src/ai/autoui.js +229 -0
- package/packages/nexus-future/src/ai/crud.js +144 -0
- package/packages/nexus-future/src/ai/fields.js +141 -0
- package/packages/nexus-future/src/ai/http.js +180 -0
- package/packages/nexus-future/src/ai/index.js +132 -0
- package/packages/nexus-future/src/ai/mock.js +14 -0
- package/packages/nexus-future/src/html/index.js +22 -0
- package/packages/nexus-future/src/html/signals.js +191 -0
- package/packages/nexus-future/src/html/template.js +459 -0
- package/packages/nexus-future/src/index.js +50 -0
- package/packages/nexus-future/src/live/client.js +580 -0
- package/packages/nexus-future/src/live/index.js +5 -0
- package/packages/nexus-future/src/live/morph.js +198 -0
- package/packages/nexus-future/src/live/rpc.js +53 -0
- package/packages/nexus-future/src/live/server.js +464 -0
- package/packages/nexus-future/src/live/stream.js +104 -0
- package/packages/nexus-future/src/page/index.js +180 -0
- package/packages/nexus-future/src/server/mount.js +192 -0
- package/packages/nexus-future/src/ui/canvas.js +142 -0
- package/packages/nexus-future/src/ui/index.js +2 -0
- package/packages/nexus-future/src/ui/sense.js +233 -0
- package/packages/nexus-graphql/package.json +1 -1
- package/packages/nexus-payments/package.json +23 -22
- package/packages/nexus-payments/src/index.ts +4 -0
- package/packages/nexus-plugins/package.json +1 -1
- package/packages/nexus-postcss/package.json +1 -1
- package/packages/nexus-realtime/package.json +1 -1
- package/packages/nexus-safe-goto/package.json +1 -1
- package/packages/nexus-telemetry/package.json +1 -1
- package/src/index.js +34 -0
- package/docs/ARCHITECTURE.md +0 -169
- package/docs/CLI.md +0 -147
- package/docs/CONVENTIONS.md +0 -243
- package/docs/MULTI_APP.md +0 -107
- package/docs/STORAGE.md +0 -118
- package/src/index.ts +0 -53
package/README.md
CHANGED
|
@@ -2,9 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
A production-ready Node.js full-stack framework. One config file, one CLI, multi-app monorepo.
|
|
4
4
|
|
|
5
|
-
>
|
|
6
|
-
>
|
|
7
|
-
> convention layer on top.
|
|
5
|
+
> **v3.0.x** — a fresh workspace that reuses v1's packages, drops the cluster
|
|
6
|
+
> subsystem (Docker handles scaling), rewrites the CLI, and adds a Laravel-style
|
|
7
|
+
> convention layer on top. It also ships **Fusion**, a from-scratch embedded
|
|
8
|
+
> database, and the zero-build **future** stack (`live()`).
|
|
9
|
+
|
|
10
|
+
## Highlights
|
|
11
|
+
|
|
12
|
+
- **Multi-app monorepo** — N backends × N frontends, one admin SPA, config-driven ports.
|
|
13
|
+
- **Auto-discovery** — drop files in `routes/`, `graphql/`, `ws/`, `models/`, … and they mount.
|
|
14
|
+
- **Two data engines** — a Mongo-style ODM (`nexus-data`) **and** an embedded Rust-backed DB (`nexus-fusion`).
|
|
15
|
+
- **Batteries included** — auth (JWT/OAuth), GraphQL federation, WebSocket realtime, payments, email, storage (local/S3), AI client, WebRTC, telemetry, admin.
|
|
16
|
+
- **Zero-build `future` stack** — `live()` server functions, HTML + auto-WS updates, AI streaming, no VDOM.
|
|
17
|
+
- **Docker-native scaling** — `docker compose up --scale backend=4`.
|
|
8
18
|
|
|
9
19
|
## Quick start
|
|
10
20
|
|
|
@@ -28,7 +38,7 @@ cd my-app
|
|
|
28
38
|
npm run dev
|
|
29
39
|
```
|
|
30
40
|
|
|
31
|
-
The wizard walks you through: project name, starter (empty or one of
|
|
41
|
+
The wizard walks you through: project name, starter (empty or one of **18 examples**), whether to include the admin panel, optional features (auth, realtime, GraphQL, payments, email, storage, queue, AI server), port detection + auto-assignment, and infrastructure (MongoDB / Redis / AI providers). Run bare `nexus` for a welcome launcher.
|
|
32
42
|
|
|
33
43
|
Skip dependency install for offline use:
|
|
34
44
|
|
|
@@ -38,7 +48,7 @@ nexus init my-app --no-install
|
|
|
38
48
|
|
|
39
49
|
## Architecture at a glance
|
|
40
50
|
|
|
41
|
-
N backends × N frontends, all discovered by a single admin SPA. Each backend is an isolated `createNexusApp()` instance with its own port, routes folder, storage root, and per-app config. Docker handles horizontal scaling — `docker compose up --scale backend
|
|
51
|
+
N backends × N frontends, all discovered by a single admin SPA. Each backend is an isolated `createNexusApp()` instance with its own port, routes folder, storage root, and per-app config. Docker handles horizontal scaling — `docker compose up --scale backend=4` — so the v1 cluster subsystem (master/slave mesh, node agents, autoscaler, load balancer) is gone entirely.
|
|
42
52
|
|
|
43
53
|
```
|
|
44
54
|
┌─────────────────────── Docker Host ───────────────────────┐
|
|
@@ -57,11 +67,11 @@ N backends × N frontends, all discovered by a single admin SPA. Each backend is
|
|
|
57
67
|
│ └──────────┬───────┴──────────────────┘ │
|
|
58
68
|
│ ▼ │
|
|
59
69
|
│ ┌────────┬────────┬──────────┬─────────┬───────────┐ │
|
|
60
|
-
│ │ MongoDB│ Redis
|
|
70
|
+
│ │ MongoDB│ Fusion │ Redis │ storage/│ S3/CDN │ │
|
|
71
|
+
│ │ (opt.) │ (opt.) │ (opt.) │ │ │ │
|
|
61
72
|
│ └────────┴────────┴──────────┴─────────┴───────────┘ │
|
|
62
73
|
│ │
|
|
63
|
-
│
|
|
64
|
-
│ nexus.config.ts ← single source of truth │
|
|
74
|
+
│ nexus.config.ts ← single source of truth (incl. apps[])│
|
|
65
75
|
│ docker-compose.yml ← orchestration │
|
|
66
76
|
└────────────────────────────────────────────────────────────┘
|
|
67
77
|
```
|
|
@@ -78,6 +88,8 @@ apps/
|
|
|
78
88
|
└── ai-server/ FastAPI sidecar (optional)
|
|
79
89
|
```
|
|
80
90
|
|
|
91
|
+
Ports are declared in `nexus.config.ts` under `apps[]` (`{ name, port, enabled }`) — the single source of truth for `nexus dev`. There is no `.nexus-ports.json` registry.
|
|
92
|
+
|
|
81
93
|
### Per-backend `src/` convention (Laravel-style)
|
|
82
94
|
|
|
83
95
|
Each backend lives under `apps/<backend>/` and follows a flat, auto-discovered folder convention inspired by Laravel. `createNexusApp()` scans these folders at boot — no manual registration.
|
|
@@ -102,6 +114,7 @@ apps/<backend>/src/
|
|
|
102
114
|
├── services/ # business logic layer
|
|
103
115
|
├── repositories/ # DB query layer (encapsulates ODM calls)
|
|
104
116
|
├── controllers/ # optional route extraction (thin handlers)
|
|
117
|
+
├── handlers/ # extracted route handlers — *.handler.ts
|
|
105
118
|
├── middleware/ # route-level middleware
|
|
106
119
|
├── validators/ # zod schemas
|
|
107
120
|
├── jobs/ # queue jobs — *Job.ts
|
|
@@ -119,7 +132,7 @@ apps/<backend>/src/
|
|
|
119
132
|
│
|
|
120
133
|
├── providers/ # *ServiceProvider.ts — DI registration (register + boot)
|
|
121
134
|
├── plugins/ # project-local plugins — <name>/index.ts
|
|
122
|
-
├── types/ # shared TS types
|
|
135
|
+
├── types/ # shared TS types — *.types.ts
|
|
123
136
|
└── constants/ # app constants
|
|
124
137
|
```
|
|
125
138
|
|
|
@@ -144,21 +157,22 @@ apps/<backend>/src/
|
|
|
144
157
|
| `plugins/<name>/index.ts` | folder | Local plugins |
|
|
145
158
|
| `config/*.ts` | folder | Merged into app config |
|
|
146
159
|
|
|
147
|
-
**
|
|
160
|
+
**Per-backend `storage/` only** (gitignored, no `storage/` at project root or `src/storage`):
|
|
148
161
|
|
|
149
162
|
```
|
|
150
|
-
apps/<backend>/storage/
|
|
151
|
-
├── uploads/ # PUBLIC —
|
|
163
|
+
apps/<backend>/storage/ ← only storage (no project-root storage)
|
|
164
|
+
├── uploads/ # PUBLIC — GET /uploads/*
|
|
152
165
|
├── private/ # signed-URL only — GET /files/:id?sig=…
|
|
153
166
|
├── temp/ # multipart assembly chunks (cleaned up)
|
|
154
167
|
├── cache/
|
|
155
168
|
└── logs/
|
|
156
169
|
```
|
|
170
|
+
`sha256` dedup — single `uploads` doc per content, `placements[]` per directory, physical symlink to canonical (Local; S3 reuses key). Placeholder `POST /api/files` is always mounted.
|
|
157
171
|
|
|
158
172
|
## CLI
|
|
159
173
|
|
|
160
174
|
```
|
|
161
|
-
Project init · dev · build · test · doctor · sync · uninstall · down · up
|
|
175
|
+
Project init · dev · build · test · doctor · sync · uninstall · pysetup · down · up
|
|
162
176
|
Multi-app add backend <name>
|
|
163
177
|
add frontend <name> [--for <backend>]
|
|
164
178
|
add route <name> --app <backend>
|
|
@@ -167,30 +181,39 @@ Multi-app add backend <name>
|
|
|
167
181
|
Data db:seed · db:migrate · db:rollback
|
|
168
182
|
Queue queue:work · queue:retry
|
|
169
183
|
Plugins plugin new · install · remove · list
|
|
184
|
+
License license add · status · verify · remove
|
|
170
185
|
|
|
171
|
-
Generators (make:*) —
|
|
186
|
+
Generators (make:*) — 22 total:
|
|
172
187
|
route · controller · model · service · repository · middleware · validator ·
|
|
173
|
-
job · event · listener · policy · resource · request · mail ·
|
|
174
|
-
seeder · migration · provider · plugin
|
|
188
|
+
handler · types · job · event · listener · policy · resource · request · mail ·
|
|
189
|
+
room · subgraph · seeder · migration · provider · plugin
|
|
175
190
|
```
|
|
176
191
|
|
|
177
192
|
## Examples
|
|
178
193
|
|
|
179
|
-
|
|
194
|
+
**18 examples** ship in `packages/nexus-examples/` (plus the `empty` bare scaffold) and are overlayable via `nexus init --example`:
|
|
180
195
|
|
|
181
196
|
| Example | Demos |
|
|
182
197
|
|---|---|
|
|
183
198
|
| `empty` | bare scaffold |
|
|
184
199
|
| `chat` | realtime rooms, presence, typing |
|
|
185
|
-
| `video-call` | WebRTC signaling, 1:1
|
|
186
|
-
| `checkout` |
|
|
187
|
-
| `livestream` | broadcaster/viewer roles
|
|
188
|
-
| `ai-chat` | streaming LLM via
|
|
189
|
-
| `saas-starter` | auth +
|
|
190
|
-
| `blog-crud` | ODM models
|
|
191
|
-
| `dashboard` | admin-metrics demo,
|
|
192
|
-
| `file-storage` | local + S3 storage, signed private URLs |
|
|
200
|
+
| `video-call` | WebRTC signaling + mediasoup SFU, 1:1 call |
|
|
201
|
+
| `checkout` | Razorpay + PayPal payments, mailables, HMAC webhook verify |
|
|
202
|
+
| `livestream` | broadcaster/viewer roles via mediasoup + chat overlay |
|
|
203
|
+
| `ai-chat` | streaming LLM via nexus-ai-client + provider switching |
|
|
204
|
+
| `saas-starter` | auth + billing + teams + policies + admin tab |
|
|
205
|
+
| `blog-crud` | ODM models deep dive + GraphQL federation subgraph |
|
|
206
|
+
| `dashboard` | admin-metrics demo, telemetry dashboards |
|
|
207
|
+
| `file-storage` | local + S3 storage, signed private URLs, image variants |
|
|
208
|
+
| `image-lab` | resize / upscale (Real-ESRGAN) / quality via PythonBridge |
|
|
193
209
|
| `multi-app` | two backends, two frontends, one admin |
|
|
210
|
+
| `future-more` | `future` stack — 7 live pages with shared navbar |
|
|
211
|
+
| `morph-ui` | canvas FLIP morphing — kanban / list / cards |
|
|
212
|
+
| `emotion-garden` | mood (LLM) + time + weather morph a canvas garden |
|
|
213
|
+
| `mario-platformer` | full-page Three.js side-scroller |
|
|
214
|
+
| `python-bridge` | React page ↔ backend bridge → Python chat/stream/embeddings |
|
|
215
|
+
| `python-bridge-future` | `future` live() chat with store + SSE via PythonBridge |
|
|
216
|
+
| `fusion-tree` | interactive `@bhooai/nexus-fusion` explorer + licensed AI |
|
|
194
217
|
|
|
195
218
|
### Multi-app example — how to use
|
|
196
219
|
|
|
@@ -203,7 +226,7 @@ npx nexus init my-platform
|
|
|
203
226
|
# wizard: Starter -> Examples -> pick "multi-app" -> Admin? Yes -> Features/Ports/Infra -> Review & create
|
|
204
227
|
cd my-platform
|
|
205
228
|
|
|
206
|
-
# scaffold the extra backends (ports
|
|
229
|
+
# scaffold the extra backends (ports are added to nexus.config.ts apps[])
|
|
207
230
|
npx nexus add backend shop
|
|
208
231
|
npx nexus add backend api
|
|
209
232
|
|
|
@@ -242,17 +265,41 @@ apps/
|
|
|
242
265
|
|
|
243
266
|
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
267
|
|
|
245
|
-
##
|
|
268
|
+
## Fusion — embedded database
|
|
246
269
|
|
|
247
|
-
|
|
270
|
+
`@bhooai/nexus-fusion` is a from-scratch embedded database: a **Rust core** (branched decomposition tree, append-only WAL with a binary format + field-name interning, query engine, LRU/TTL cache, sortable id generation) exposed through a **Firebase-style TypeScript API**.
|
|
271
|
+
|
|
272
|
+
```ts
|
|
273
|
+
import { fusion } from 'bhooai-nexus/fusion';
|
|
274
|
+
|
|
275
|
+
const db = fusion('main', 'prod', { dir: 'storage/fusion' });
|
|
276
|
+
const users = db.collection('users');
|
|
277
|
+
await users.add({ name: 'Ada', city: 'London' });
|
|
278
|
+
|
|
279
|
+
const q = users.where('city', '==', 'London').orderByField('name').limit(10);
|
|
280
|
+
q.onSnapshot((snap) => console.log(snap.docs));
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
- **Offline queue** — optimistic overlay with retry/sync (`queueSet`/`queueUpdate`/`sync`).
|
|
284
|
+
- **Security rules** — pattern DSL with `{param}` capture, most-specific match, default-deny.
|
|
285
|
+
- **Declarative schemas** — `@bhooai/nexus-fusion/schemas` for auth / cms / ecommerce field specs.
|
|
286
|
+
- **`FusionCache`** — a Redis-like API (strings, hashes, lists, sets, `keys`/`expire`) over the same engine, on-disk or in-RAM (`bhooai-nexus/fusion`).
|
|
287
|
+
- **Adapters** — optional `MongoMirror` and `RedisBridge` for migration / fan-out.
|
|
288
|
+
- **Playground** — a 3D tree explorer + JSON command console, shipped in the `fusion-tree` example.
|
|
289
|
+
|
|
290
|
+
Config lives under `db.active: 'mongodb' | 'fusion'` plus `fusion`/`cache` blocks in `nexus.config.ts`. See `docs/FUSION.md` and `docs/fusion-stores-and-cache.md`.
|
|
291
|
+
|
|
292
|
+
## Storage (per-backend only)
|
|
293
|
+
|
|
294
|
+
Per-backend `storage/` folder (`apps/<backend>/storage`, no project-root `storage/`) with `local` + `s3` drivers:
|
|
248
295
|
|
|
249
296
|
```ts
|
|
250
297
|
import { storage } from 'bhooai-nexus';
|
|
251
|
-
await storage.disk('uploads').put('avatars', file);
|
|
298
|
+
await storage.disk('uploads').put('avatars', file); // → apps/backend/storage/uploads/avatars/YYYY/MM/<id>
|
|
252
299
|
const url = await storage.disk('private').signedUrl('invoices/1.pdf');
|
|
253
300
|
```
|
|
254
301
|
|
|
255
|
-
|
|
302
|
+
Per-placement `YYYY/MM` + `sha256` single `uploads` doc (`placements[]` per directory, symlink to canonical, millions-scale). EXIF-stripped. Python Pillow + Real-ESRGAN (no sharp) via `POST /images/variants` (`NEXUS_IMAGES_URL`), placeholder `POST /api/files` always mounted.
|
|
256
303
|
|
|
257
304
|
## Importing the framework
|
|
258
305
|
|
|
@@ -263,26 +310,29 @@ import { createNexusApp, storage, model, Schema, AiClient, defineRoutes } from '
|
|
|
263
310
|
```
|
|
264
311
|
|
|
265
312
|
Prefer narrower imports for smaller bundles? Use the sub-path exports
|
|
266
|
-
(`bhooai-nexus/core`, `bhooai-nexus/data`, `bhooai-nexus/ai-client`, …) or the
|
|
313
|
+
(`bhooai-nexus/core`, `bhooai-nexus/data`, `bhooai-nexus/ai-client`, `bhooai-nexus/fusion`, …) or the
|
|
267
314
|
scoped packages (`@bhooai/nexus-core`, `@bhooai/nexus-data`, …) directly.
|
|
268
315
|
|
|
269
316
|
## Packages
|
|
270
317
|
|
|
271
|
-
|
|
318
|
+
**21 workspace packages** ship under `packages/`, each independently versioned and re-exported by the umbrella `bhooai-nexus` package.
|
|
272
319
|
|
|
273
320
|
| Package | Scope | Import path | Purpose |
|
|
274
321
|
|---|---|---|---|
|
|
275
|
-
| nexus-admin | `@bhooai/nexus-admin` | `bhooai-nexus/admin` | Admin SPA — Apps-tab-first, live registry/health/logs/config/users/payments/AI |
|
|
322
|
+
| nexus-admin | `@bhooai/nexus-admin` | `bhooai-nexus/admin` | Admin SPA — Apps-tab-first, live registry/health/logs/config/users/payments/AI/uploads |
|
|
276
323
|
| nexus-ads | `@bhooai/nexus-ads` | — | Advertising module |
|
|
277
324
|
| nexus-ai-client | `@bhooai/nexus-ai-client` | `bhooai-nexus/ai-client` | AI provider client (streaming, provider switching) |
|
|
278
325
|
| nexus-auth | `@bhooai/nexus-auth` | `bhooai-nexus/auth` | Authentication (JWT, OAuth, sessions, refresh tokens) |
|
|
279
326
|
| nexus-cache | `@bhooai/nexus-cache` | `bhooai-nexus/cache` | Caching layer (Redis-backed) |
|
|
280
|
-
| nexus-cli | `@bhooai/nexus-cli` | `bhooai-nexus/cli` | CLI — init, dev, build, test, scaffolding, plugins, queue, db |
|
|
327
|
+
| nexus-cli | `@bhooai/nexus-cli` | `bhooai-nexus/cli` | CLI — init, dev, build, test, scaffolding, plugins, queue, db, license |
|
|
281
328
|
| nexus-core | `@bhooai/nexus-core` | `bhooai-nexus/core` | Core — `createNexusApp()`, auto-discovery, HTTP, storage facade, abstractions |
|
|
282
|
-
| nexus-crypto | `@bhooai/nexus-crypto` | `bhooai-nexus/crypto` | Cryptography utilities |
|
|
329
|
+
| nexus-crypto | `@bhooai/nexus-crypto` | `bhooai-nexus/crypto` | Cryptography utilities + license key derivation (HKDF-SHA256) |
|
|
283
330
|
| nexus-data | `@bhooai/nexus-data` | `bhooai-nexus/data` | Custom ODM for MongoDB (schemas, hooks, populate) |
|
|
284
331
|
| nexus-email | `@bhooai/nexus-email` | `bhooai-nexus/email` | Email sending (Mailable classes, EJS templates) |
|
|
285
|
-
| nexus-examples | `@bhooai/nexus-examples` | `bhooai-nexus/examples` |
|
|
332
|
+
| nexus-examples | `@bhooai/nexus-examples` | `bhooai-nexus/examples` | 18 working examples, each demoing a framework slice |
|
|
333
|
+
| nexus-fusion | `@bhooai/nexus-fusion` | `bhooai-nexus/fusion` | Embedded database — Firebase-style TS API (onSnapshot, offline queue, rules) over a Rust core |
|
|
334
|
+
| nexus-fusion-core | `nexus-fusion-core` | — | The Rust crate (NAPI addon) powering `nexus-fusion` |
|
|
335
|
+
| nexus-future | `@bhooai/nexus-future` | `bhooai-nexus/future` | Zero-build stack — `live()` HTML + auto-WS updates + AI streaming, signals, `page()`, `autoui()` |
|
|
286
336
|
| nexus-graphql | `@bhooai/nexus-graphql` | `bhooai-nexus/graphql` | GraphQL federation layer (subgraphs, supergraph) |
|
|
287
337
|
| nexus-payments | `@bhooai/nexus-payments` | `bhooai-nexus/payments` | Payments (Razorpay, PayPal, HMAC webhook verify) |
|
|
288
338
|
| nexus-plugins | `@bhooai/nexus-plugins` | `bhooai-nexus/plugins` | Plugin system (new/install/remove/list) |
|
|
@@ -291,6 +341,19 @@ scoped packages (`@bhooai/nexus-core`, `@bhooai/nexus-data`, …) directly.
|
|
|
291
341
|
| nexus-safe-goto | `@bhooai/nexus-safe-goto` | `bhooai-nexus/safe-goto` | Safe external-link navigation (noopener/noreferrer, confirm dialog) |
|
|
292
342
|
| nexus-telemetry | `@bhooai/nexus-telemetry` | `bhooai-nexus/telemetry` | Telemetry / observability |
|
|
293
343
|
|
|
344
|
+
Two greenfield libraries also ship alongside the packages: the Python `bhooai-nexus-ai` service (`libraries/python`, FastAPI: chat/embeddings/models/lint/preflight + Pillow/Real-ESRGAN images) and the Node `@bhooai/nexus-bridge` client (`libraries/node/nexus-bridge`). See `docs/LIBRARIES.md`.
|
|
345
|
+
|
|
346
|
+
## License system
|
|
347
|
+
|
|
348
|
+
`nexus-crypto` implements the framework-side license flow: a master key is verified against the authority and stored at `~/.nexus/license.json`, then each package derives its own key with HKDF-SHA256. Gated features (payments, AI) call `requireLicense()` and throw until a key is present. Minting happens only in the site backend; the framework only consumes/verifies.
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
nexus license add <key> # verify against the authority, then cache
|
|
352
|
+
nexus license status # source, fingerprint, live validity
|
|
353
|
+
nexus license verify # re-check the stored key
|
|
354
|
+
nexus license remove # delete the stored key
|
|
355
|
+
```
|
|
356
|
+
|
|
294
357
|
## Maintenance mode
|
|
295
358
|
|
|
296
359
|
```
|
|
@@ -303,19 +366,26 @@ All requests return 503 + Retry-After except `/health`.
|
|
|
303
366
|
## Tests
|
|
304
367
|
|
|
305
368
|
```bash
|
|
306
|
-
npx vitest run
|
|
369
|
+
npx vitest run # root suite (tests/)
|
|
370
|
+
npx vitest run --root packages/nexus-fusion # per-package suites
|
|
307
371
|
```
|
|
308
372
|
|
|
309
|
-
|
|
310
|
-
|
|
373
|
+
The root suite covers app factory, event bus, policies, generators, templating,
|
|
374
|
+
examples, layout, features, and ports (**51 tests**). Per-package suites cover
|
|
375
|
+
core, auth, crypto, data, fusion, graphql, payments, realtime, and more.
|
|
376
|
+
|
|
377
|
+
> Known stale tests: `tests/unit/features.test.ts` still asserts the removed
|
|
378
|
+
> `defaultPortFor()` helper (from the `.nexus-ports.json` → config `apps[]`
|
|
379
|
+
> migration) — 3 assertions fail, tracked for cleanup.
|
|
311
380
|
|
|
312
381
|
## Status
|
|
313
382
|
|
|
314
383
|
- P0–P12 shipped (skeleton, app factory, abstractions, storage, CLI, plugins, db, queue,
|
|
315
|
-
generators, port registry
|
|
316
|
-
-
|
|
317
|
-
-
|
|
318
|
-
|
|
384
|
+
generators, port registry → config `apps[]`, examples, docker, admin strip + Apps tab)
|
|
385
|
+
- Fusion embedded database shipped (`nexus-fusion` + `nexus-fusion-core`) — WAL v3,
|
|
386
|
+
repeat-query cache, and a licensed AI layer
|
|
387
|
+
- License system (`nexus-crypto`) + `nexus license` CLI
|
|
388
|
+
- `future` zero-build stack (`live()`, `page()`, `autoui()`) with its own examples
|
|
319
389
|
- `bhooai-nexus` is the publishable main package — umbrella import + auto-installing init
|
|
320
390
|
- v1's test suite has 97 pre-existing tsc errors (unrelated to v2 src; tracked separately)
|
|
321
391
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bhooai-nexus",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.4",
|
|
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
|
-
"author": "BhooAI",
|
|
6
|
+
"author": "BhooAI - oravianando",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"fullstack",
|
|
9
9
|
"framework",
|
|
@@ -18,25 +18,26 @@
|
|
|
18
18
|
"ai",
|
|
19
19
|
"admin",
|
|
20
20
|
"cli",
|
|
21
|
+
"monorepo",
|
|
21
22
|
"scaffold"
|
|
22
23
|
],
|
|
23
24
|
"repository": {
|
|
24
25
|
"type": "git",
|
|
25
|
-
"url": "https://github.com/
|
|
26
|
+
"url": "https://github.com/oravianando/BhooAI-Nexus.git"
|
|
26
27
|
},
|
|
27
|
-
"homepage": "https://github.com/
|
|
28
|
+
"homepage": "https://github.com/oravianando/BhooAI-Nexus#readme",
|
|
28
29
|
"bugs": {
|
|
29
|
-
"url": "https://github.com/
|
|
30
|
+
"url": "https://github.com/oravianando/BhooAI-Nexus/issues"
|
|
30
31
|
},
|
|
31
32
|
"funding": {
|
|
32
33
|
"type": "github",
|
|
33
|
-
"url": "https://github.com/sponsors/
|
|
34
|
+
"url": "https://github.com/sponsors/oravianando"
|
|
34
35
|
},
|
|
35
36
|
"bin": {
|
|
36
37
|
"nexus": "bin/nexus.js"
|
|
37
38
|
},
|
|
38
39
|
"exports": {
|
|
39
|
-
".": "./src/index.
|
|
40
|
+
".": "./src/index.js",
|
|
40
41
|
"./core": "./packages/nexus-core/src/index.ts",
|
|
41
42
|
"./core/http": "./packages/nexus-core/src/http/index.ts",
|
|
42
43
|
"./auth": "./packages/nexus-auth/src/index.ts",
|
|
@@ -59,6 +60,16 @@
|
|
|
59
60
|
"./graphql": "./packages/nexus-graphql/src/index.ts",
|
|
60
61
|
"./graphql/hello": "./packages/nexus-graphql/src/builtin/helloSubgraph.ts",
|
|
61
62
|
"./graphql/builtin": "./packages/nexus-graphql/src/builtin/index.ts",
|
|
63
|
+
"./future": "./packages/nexus-future/src/index.js",
|
|
64
|
+
"./future/html": "./packages/nexus-future/src/html/index.js",
|
|
65
|
+
"./future/live": "./packages/nexus-future/src/live/index.js",
|
|
66
|
+
"./future/page": "./packages/nexus-future/src/page/index.js",
|
|
67
|
+
"./future/ai": "./packages/nexus-future/src/ai/index.js",
|
|
68
|
+
"./future/server": "./packages/nexus-future/src/server/mount.js",
|
|
69
|
+
"./future/mock": "./packages/nexus-future/src/ai/mock.js",
|
|
70
|
+
"./future/ui": "./packages/nexus-future/src/ui/index.js",
|
|
71
|
+
"./fusion": "./packages/nexus-fusion/src/index.ts",
|
|
72
|
+
"./fusion/schemas": "./packages/nexus-fusion/src/schemas/index.ts",
|
|
62
73
|
"./package.json": "./package.json"
|
|
63
74
|
},
|
|
64
75
|
"files": [
|
|
@@ -68,8 +79,7 @@
|
|
|
68
79
|
"packages/*/src/**",
|
|
69
80
|
"packages/*/package.json",
|
|
70
81
|
"packages/nexus-cli/templates/**",
|
|
71
|
-
"packages/nexus-examples/examples/**"
|
|
72
|
-
"docs/"
|
|
82
|
+
"packages/nexus-examples/examples/**"
|
|
73
83
|
],
|
|
74
84
|
"type": "module",
|
|
75
85
|
"engines": {
|
|
@@ -77,7 +87,8 @@
|
|
|
77
87
|
},
|
|
78
88
|
"workspaces": [
|
|
79
89
|
"packages/*",
|
|
80
|
-
"apps/*"
|
|
90
|
+
"apps/*",
|
|
91
|
+
"libraries/node/*"
|
|
81
92
|
],
|
|
82
93
|
"scripts": {
|
|
83
94
|
"build": "node bin/nexus.js build",
|
|
@@ -101,7 +112,9 @@
|
|
|
101
112
|
"@bhooai/nexus-graphql": "^2.0.1",
|
|
102
113
|
"@bhooai/nexus-telemetry": "^2.0.1",
|
|
103
114
|
"@bhooai/nexus-admin": "^2.0.1",
|
|
115
|
+
"@bhooai/nexus-future": "^3.0.0",
|
|
104
116
|
"@bhooai/nexus-examples": "^2.0.1",
|
|
117
|
+
"@bhooai/nexus-fusion": "^0.1.0",
|
|
105
118
|
"bcryptjs": "^2.4.3",
|
|
106
119
|
"jose": "^5.9.6",
|
|
107
120
|
"mongodb": "^6.9.0",
|
|
@@ -109,13 +122,9 @@
|
|
|
109
122
|
"zod": "^3.23.8"
|
|
110
123
|
},
|
|
111
124
|
"peerDependencies": {
|
|
112
|
-
"sharp": "^0.33.0",
|
|
113
125
|
"@aws-sdk/client-s3": "^3.0.0"
|
|
114
126
|
},
|
|
115
127
|
"peerDependenciesMeta": {
|
|
116
|
-
"sharp": {
|
|
117
|
-
"optional": true
|
|
118
|
-
},
|
|
119
128
|
"@aws-sdk/client-s3": {
|
|
120
129
|
"optional": true
|
|
121
130
|
}
|