@multisystemsuite/create-mf-app 1.0.8 → 1.0.10

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 CHANGED
@@ -16,6 +16,7 @@ Inspired by **Nx**, **Turborepo**, **Backstage**, and **Module Federation** —
16
16
  - [Custom child & shared app names](#custom-child--shared-app-names)
17
17
  - [Enterprise platform flags](#enterprise-platform-flags)
18
18
  - [Generated monorepo structure](#generated-monorepo-structure)
19
+ - [Infrastructure & deployment (parent workspaces)](#infrastructure--deployment-parent-workspaces)
19
20
  - [MF Platform CLI (inside generated projects)](#mf-platform-cli-inside-generated-projects)
20
21
  - [Using corelib (shared library)](#using-corelib-shared-library)
21
22
  - [Enterprise design system & theming](#enterprise-design-system--theming)
@@ -50,6 +51,14 @@ Or use the short binary name (same package):
50
51
  npx create-mf-app my-platform --type=parent --children=billing,orders --shared=corelib
51
52
  ```
52
53
 
54
+ **Contributors:** `npx` installs the **published npm package**. To test unreleased generator changes from this repo, build and run locally — see [Develop & publish this package](#develop--publish-this-package).
55
+
56
+ ```bash
57
+ npm run build
58
+ node dist/index.js my-platform --control-plane -y
59
+ node dist/index.js my-platform --type=parent --children=admin,billing --shared=corelib -y
60
+ ```
61
+
53
62
  **Global install** (optional):
54
63
 
55
64
  ```bash
@@ -270,6 +279,8 @@ npx create-mf-app <project-name> [options]
270
279
  | `--shared=corelib` | Shared federated lib folder name (default: `sharedlib`) |
271
280
  | `--docker=true\|false` | Generate Dockerfiles (default: `true`) |
272
281
  | `--federation=true\|false` | Module Federation (default: `true`) |
282
+ | `--control-plane` | Workflow Designer & Monitoring preset (6 apps + corelib, control-plane API, mf-* packages) |
283
+ | `--federation-os` | Full Enterprise Federation OS preset (10 apps + corelib, runtime, observability stack) |
273
284
  | `-y`, `--yes` | Non-interactive (use defaults where applicable) |
274
285
  | `-h`, `--help` | Show help |
275
286
 
@@ -284,12 +295,16 @@ npx create-mf-app <project-name> [options]
284
295
 
285
296
  1. Project name
286
297
  2. Application type (parent / child)
287
- 3. Child applications (checkboxes: admin, qc, inventory, shopfloor)
288
- 4. Shared applications (comma-separated, default `sharedlib`)
289
- 5. Template (tsx / jsx)
290
- 6. Port
291
- 7. Module Federation on/off
292
- 8. Docker on/off
298
+ 3. **Parent only:** Workflow Designer & Monitoring (`--control-plane`)?
299
+ 4. **Parent only (if not control-plane):** Full Enterprise Federation OS (`--federation-os`)?
300
+ 5. Child applications checkbox pick **or auto-filled** when a preset is selected
301
+ 6. Shared applications — comma-separated **or auto-filled** when a preset is selected
302
+ 7. Template (tsx / jsx)
303
+ 8. Port (child mode; presets assign ports from 3000 sequentially)
304
+ 9. Module Federation on/off
305
+ 10. Docker on/off
306
+
307
+ **Preset behavior:** choosing `--control-plane` or `--federation-os` skips manual child/shared selection and applies the fixed app list documented below.
293
308
 
294
309
  ---
295
310
 
@@ -341,6 +356,101 @@ Optional modules for **parent monorepos** (core modules are always included):
341
356
  | `--testing` | Vitest workspace + Playwright + Cypress configs |
342
357
  | `--pwa` | PWA manifest placeholder |
343
358
  | `--plugin-system` | Runtime plugin registry in `apps/corelib/src/plugins/` |
359
+ | `--federation-os` | **Full Enterprise Federation OS** — see below |
360
+ | `--control-plane` | **Workflow Designer & Monitoring Platform** — see below |
361
+
362
+ ### Workflow Designer & Monitoring (`--control-plane`)
363
+
364
+ Focused enterprise control plane matching the Micro Frontend Workflow Designer spec:
365
+
366
+ ```bash
367
+ npx @multisystemsuite/create-mf-app my-control-plane --control-plane -y
368
+ ```
369
+
370
+ | Layer | Generated |
371
+ |-------|-----------|
372
+ | **6 apps + corelib** | shell (`main`), admin, analytics, auth, workflow-monitor-app, federation-registry-app, corelib |
373
+ | **5 packages** | `@scope/shared-ui`, `mf-monitor`, `mf-workflow`, `mf-devtools`, `mf-registry` |
374
+ | **Services** | `services/control-plane-api` (Express + Socket.IO + MongoDB) |
375
+ | **UI** | React Flow designer, real-time monitor, registry, deployments, analytics, environments |
376
+
377
+ ![Enterprise Federation Control Plane — Workflow Designer](https://raw.githubusercontent.com/Abhishek2122/create-mf-app/main/docs/images/control-plane-workflow-designer.png)
378
+
379
+ *Workflow Designer tab at `http://localhost:3004` (or via shell at `/workflow-monitor-app`) — federation topology with live node health, auto-layout, and save/scan controls.*
380
+
381
+ ![Enterprise Federation Control Plane — Federation Monitor](https://raw.githubusercontent.com/Abhishek2122/create-mf-app/main/docs/images/control-plane-federation-monitor.png)
382
+
383
+ *Federation Monitor tab — healthy/unhealthy summary cards and real-time remote health stream (Socket.IO from control-plane API on `:4000`).*
384
+
385
+ ```bash
386
+ npm run control-plane
387
+ npm run mss-mf -- generate workflow
388
+ npm run mss-mf -- generate monitor
389
+ npm run mss-mf -- scan federation
390
+ npm run mss-mf -- add remote analytics-app
391
+ npm run mss-mf -- generate env prod
392
+ ```
393
+
394
+ **Default ports (`--control-plane`):**
395
+
396
+ | App | Port |
397
+ |-----|------|
398
+ | `main` (shell) | 3000 |
399
+ | `admin-app` | 3001 |
400
+ | `analytics-app` | 3002 |
401
+ | `auth-app` | 3003 |
402
+ | `workflow-monitor-app` | 3004 |
403
+ | `federation-registry-app` | 3005 |
404
+ | `corelib` | 3006 |
405
+ | Control-plane API | 4000 |
406
+
407
+ ### Enterprise Federation OS (`--federation-os`)
408
+
409
+ One flag scaffolds the complete control plane platform:
410
+
411
+ ```bash
412
+ npx @multisystemsuite/create-mf-app my-federation-platform --federation-os -y
413
+ ```
414
+
415
+ | Layer | Generated |
416
+ |-------|-----------|
417
+ | **10 applications** | Shell (`main`), admin, analytics, auth, workflow-designer, federation-monitor, federation-registry, federation-runtime, federation-governance, deployment-control-plane + `corelib` |
418
+ | **10 packages** | `@scope/mf-runtime`, `mf-monitor`, `mf-workflow`, `mf-registry`, `mf-devtools`, `mf-observability`, `mf-security`, `mf-governance`, `mf-ai-assistant`, `shared-ui` |
419
+ | **Services** | `services/control-plane-api` — Express + Socket.IO + REST (registry, monitor, workflow, deployments, governance, AI) |
420
+ | **Runtime** | `runtime/` — dynamic remote loading + auto-discovery |
421
+ | **Monitoring** | Prometheus + Grafana + OpenTelemetry configs |
422
+ | **Infrastructure** | `docker-compose.federation-os.yml`, Kubernetes manifests, CI pipeline |
423
+ | **Architecture protection** | `.mss-protected.json` + `mss-mf protect` / `delete` guards |
424
+
425
+ **Federation OS CLI:**
426
+
427
+ ```bash
428
+ npm run control-plane # API on :4000
429
+ npm run federation-os:infra # MongoDB, Redis, Postgres, Prometheus, Grafana
430
+ npm run mss-mf -- federation scan # Auto-discover federation configs
431
+ npm run mss-mf -- federation validate
432
+ npm run mss-mf -- runtime start
433
+ npm run mss-mf -- deploy prod
434
+ ```
435
+
436
+ **Default ports (`--federation-os`):**
437
+
438
+ | App | Port |
439
+ |-----|------|
440
+ | `main` (shell) | 3000 |
441
+ | `admin-app` | 3001 |
442
+ | `analytics-app` | 3002 |
443
+ | `auth-app` | 3003 |
444
+ | `workflow-designer-app` | 3004 |
445
+ | `federation-monitor-app` | 3005 |
446
+ | `federation-registry-app` | 3006 |
447
+ | `federation-runtime-app` | 3007 |
448
+ | `federation-governance-app` | 3008 |
449
+ | `deployment-control-plane-app` | 3009 |
450
+ | `corelib` | 3010 |
451
+ | Control-plane API | 4000 |
452
+
453
+ See generated `docs/FEDERATION_OS.md` for full architecture.
344
454
 
345
455
  **Always included** for federated parent workspaces (no flag needed):
346
456
 
@@ -362,6 +472,12 @@ Optional modules for **parent monorepos** (core modules are always included):
362
472
 
363
473
  ```text
364
474
  my-platform/
475
+ ├── infrastructure/ # Auto-generated nginx, apache, docker, k8s, ssl
476
+ │ ├── nginx/nginx.conf
477
+ │ ├── apache/httpd.conf
478
+ │ ├── compose/docker-compose.yml
479
+ │ ├── kubernetes/ingress.yaml
480
+ │ └── scripts/generate-routing.js
365
481
  ├── mf.json # Workspace config (like nx.json)
366
482
  ├── apps/
367
483
  │ ├── main/ # Host shell (port 3000)
@@ -404,6 +520,44 @@ my-platform/
404
520
 
405
521
  ---
406
522
 
523
+ ## Infrastructure & deployment (parent workspaces)
524
+
525
+ Every **parent + federation** workspace auto-generates `infrastructure/` with:
526
+
527
+ | Path | Contents |
528
+ |------|----------|
529
+ | `infrastructure/nginx/` | `nginx.conf`, federation routing, upstreams, WebSocket, per-env server blocks |
530
+ | `infrastructure/apache/` | `httpd.conf`, federation vhosts, WebSocket proxy |
531
+ | `infrastructure/docker/` | Gateway Dockerfile + per-app production Dockerfiles |
532
+ | `infrastructure/compose/` | `docker-compose.yml` + DEV/QA/UAT/PROD overlays |
533
+ | `infrastructure/kubernetes/` | `deployment.yaml`, `ingress.yaml`, services, HPA |
534
+ | `infrastructure/ssl/` | Self-signed + Certbot scripts, env cert folders |
535
+ | `infrastructure/scripts/` | Auto-routing, remote detection, deploy scripts |
536
+
537
+ **Deployment modes:**
538
+
539
+ ```bash
540
+ # Container — nginx gateway + all MFE containers
541
+ npm run infra:gateway
542
+ npm run infra:deploy:dev
543
+ npm run infra:deploy:qa
544
+ npm run infra:deploy:uat
545
+ npm run infra:deploy:prod
546
+
547
+ # Normal server — Vite apps + bare-metal nginx upstreams
548
+ npm run dev
549
+ npm run infra:health
550
+ # use infrastructure/nginx/conf.d/upstreams-bare.conf
551
+
552
+ # Auto-detect remotes → routing manifest
553
+ npm run infra:detect
554
+ npm run infra:routing
555
+ ```
556
+
557
+ Features: federation-aware reverse proxy, dynamic remote routing (`/remotes/<name>/`), SSL-ready configs, load balancing, health checks, WebSocket for control plane, runtime env injection per environment.
558
+
559
+ ---
560
+
407
561
  ## MF Platform CLI (inside generated projects)
408
562
 
409
563
  After scaffolding, use the **`mf`** CLI inside your monorepo:
@@ -457,9 +611,37 @@ node tools/mf-cli/bin/mf.js <command>
457
611
  | `mf federation doctor` | Check host/remotes/shared lib wiring |
458
612
  | `mf federation graph` | Export federation dependency graph |
459
613
  | `mf federation sync` | Sync remote manifests from `mf.json` |
460
- | `mf doctor` | Workspace health (circular deps, boundaries, mf.json) |
614
+ | `mf doctor` | Workspace health (circular deps, boundaries, mf.json, architecture protection) |
461
615
  | `npm run federation:verify` | HEAD-check remoteEntry URLs (`MF_REMOTES` env) |
462
616
 
617
+ ### Architecture protection (`mss-mf`)
618
+
619
+ Enterprise parent workspaces include `.mss-protected.json` — a guardrail config that prevents accidental deletion or modification of federation OS core infrastructure.
620
+
621
+ | Tier | Examples | CLI behavior |
622
+ |------|----------|--------------|
623
+ | **Hard protected** | `runtime/`, `tools/mf-cli/`, `governance/`, federation packages | Cannot delete |
624
+ | **Soft protected** | `apps/main`, `apps/corelib`, `plugins/` | Requires `--force` |
625
+ | **Non-critical apps** | Child remotes under `apps/*` | Requires `--force` |
626
+
627
+ | Command | Description |
628
+ |---------|-------------|
629
+ | `mss-mf delete <path>` | Delete path (blocked if protected) |
630
+ | `mss-mf delete runtime` | ❌ `Cannot delete protected folder: runtime` |
631
+ | `mss-mf delete apps/billing --force` | Remove non-critical child remote |
632
+ | `mss-mf protect validate` | Workspace structure + staged-change validation |
633
+ | `mss-mf protect snapshot` | Capture recovery snapshot in `.mss/snapshots/` |
634
+ | `mss-mf protect recover` | Restore missing paths from latest snapshot |
635
+ | `mss-mf protect list` | List hard/soft protected paths and readonly packages |
636
+ | `mss-mf protect status` | Quick integrity summary |
637
+
638
+ Git hooks (when `.mss-protected.json` exists):
639
+
640
+ - **pre-commit** — blocks staged deletion/modification of protected paths
641
+ - **pre-push** — structure validation + dependency integrity
642
+
643
+ Emergency architect override: `MSS_PROTECT_OVERRIDE=1 mss-mf delete <path> --architect-override`
644
+
463
645
  ### npm script shortcuts (generated)
464
646
 
465
647
  ```json
@@ -467,7 +649,11 @@ node tools/mf-cli/bin/mf.js <command>
467
649
  "mf:graph": "node tools/mf-cli/bin/mf.js graph",
468
650
  "mf:affected": "node tools/mf-cli/bin/mf.js affected build",
469
651
  "mf:doctor": "node tools/mf-cli/bin/mf.js doctor",
470
- "mf:federation": "node tools/mf-cli/bin/mf.js federation doctor"
652
+ "mf:federation": "node tools/mf-cli/bin/mf.js federation doctor",
653
+ "mss-mf": "node tools/mf-cli/bin/mf.js",
654
+ "mf:protect": "node tools/mf-cli/bin/mf.js protect validate",
655
+ "mf:protect:snapshot": "node tools/mf-cli/bin/mf.js protect snapshot",
656
+ "mf:protect:recover": "node tools/mf-cli/bin/mf.js protect recover"
471
657
  ```
472
658
 
473
659
  ---
@@ -786,7 +972,9 @@ Husky: lint-staged + type-check + tests on pre-commit; lint + tests on pre-push.
786
972
  | `preview:<app>` | Vite preview for one app |
787
973
  | `release` / `release:minor` / `release:major` | Version bump + build |
788
974
  | `federation:verify` | Remote entry health check |
789
- | `mf`, `mf:graph`, `mf:affected`, `mf:doctor` | Platform CLI shortcuts |
975
+ | `mf`, `mf:graph`, `mf:affected`, `mf:doctor`, `mss-mf`, `mf:protect` | Platform CLI + architecture protection |
976
+ | `infra:gateway`, `infra:deploy:{dev,qa,uat,prod}`, `infra:detect`, `infra:routing`, `infra:health` | Auto-generated reverse proxy + deployment (parent workspaces) |
977
+ | `control-plane`, `federation-os:infra` | Control-plane API + Federation OS observability stack |
790
978
 
791
979
  ### Per-module dev (dynamic — one script per `--children` name)
792
980
 
@@ -836,6 +1024,8 @@ For container-to-container federation, replace `localhost` remote URLs with Dock
836
1024
  | `README.md` | Ports, quick start, Docker, quality scripts |
837
1025
  | `docs/ENTERPRISE_ARCHITECTURE.md` | Design system, RBAC, federation, SDK, deployment |
838
1026
  | `docs/PLATFORM_ARCHITECTURE.md` | MF CLI, graph, cache, plugins, CI/CD |
1027
+ | `docs/CONTROL_PLANE.md` | Workflow designer, monitor, registry (with `--control-plane`) |
1028
+ | `docs/FEDERATION_OS.md` | Full Federation OS architecture (with `--federation-os`) |
839
1029
  | `mf.json` | Project registry, tags, federation config |
840
1030
  | `templates/README.md` | Template marketplace usage |
841
1031
  | `ai/README.md` | AI layer integration guide |
@@ -896,11 +1086,18 @@ git clone https://github.com/your-org/create-mf-app
896
1086
  cd create-mf-app
897
1087
  npm install
898
1088
  npm run build # tsup → dist/
899
- npm run dev # run dist/index.js locally
1089
+ npm run dev # run dist/index.js locally (pass args after --)
900
1090
 
901
- # test code changes
1091
+ # test generator changes locally (uses dist/, not published npm)
1092
+ node dist/index.js my-platform --control-plane -y
1093
+ node dist/index.js my-platform --type=parent --children=admin,billing --shared=corelib -y
1094
+ node dist/index.js my-federation-platform --federation-os -y
902
1095
  node dist/index.js test-app --type=child --port=3001 --template=tsx
903
1096
 
1097
+ # optional: link CLI globally
1098
+ npm link
1099
+ create-mf-app my-platform --control-plane -y
1100
+
904
1101
  # dry-run npm pack contents
905
1102
  npm run pack:check
906
1103
 
@@ -920,13 +1117,18 @@ npm publish --access public
920
1117
  | Layer | How you use it |
921
1118
  |-------|----------------|
922
1119
  | **Scaffold** | `npx create-mf-app <name> --type=parent --children=… --shared=corelib` |
1120
+ | **Control plane preset** | `--control-plane` → workflow designer, monitor, registry, API |
1121
+ | **Federation OS preset** | `--federation-os` → full runtime, governance, observability stack |
923
1122
  | **Daily dev** | `npm run local` (all apps) or `npm run billing` (one module) |
924
1123
  | **Shared UI / theme** | Import from `corelib/*` federation exposes |
925
1124
  | **New remote** | `npm run mf -- generate app <name>` |
926
1125
  | **Enterprise modules** | Flags: `--auth`, `--charts`, `--i18n`, … |
927
1126
  | **Monorepo platform** | `mf graph`, `mf affected build`, `mf doctor` |
1127
+ | **Architecture protection** | `.mss-protected.json` + `mss-mf protect` / `delete` guards |
1128
+ | **Infrastructure** | Auto `infrastructure/` — nginx, docker, k8s, SSL, env deploy scripts |
928
1129
  | **Federation** | Host :3000 loads remotes; shared React/MUI singletons |
929
1130
  | **Design system** | `AppConfigProvider` + tokens + runtime theme toggle |
930
- | **Deploy** | `npm run build` → CDN dist + Helm / Docker |
1131
+ | **Deploy** | `npm run build` → CDN dist + `infra:deploy:*` / Helm / Docker |
1132
+ | **Local CLI dev** | `npm run build` then `node dist/index.js <name> [flags]` |
931
1133
 
932
1134
  **Module Federation + Vite — React-first, enterprise-grade, plugin-driven.**