@bleedingdev/modern-js-create 3.2.0-ultramodern.9 → 3.2.0-ultramodern.91

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 (51) hide show
  1. package/README.md +152 -35
  2. package/dist/index.js +4700 -608
  3. package/dist/types/locale/en.d.ts +3 -0
  4. package/dist/types/locale/zh.d.ts +3 -0
  5. package/dist/types/ultramodern-workspace.d.ts +11 -0
  6. package/package.json +6 -6
  7. package/template/.codex/hooks.json +16 -0
  8. package/template/.github/renovate.json +53 -0
  9. package/template/.github/workflows/ultramodern-gates.yml.handlebars +34 -10
  10. package/template/.mise.toml.handlebars +2 -0
  11. package/template/AGENTS.md +9 -6
  12. package/template/README.md +60 -34
  13. package/template/api/effect/index.ts.handlebars +8 -3
  14. package/template/config/public/locales/cs/translation.json +39 -0
  15. package/template/config/public/locales/en/translation.json +39 -0
  16. package/template/lefthook.yml +10 -0
  17. package/template/modern.config.ts.handlebars +39 -24
  18. package/template/oxfmt.config.ts +11 -3
  19. package/template/oxlint.config.ts +11 -4
  20. package/template/package.json.handlebars +43 -34
  21. package/template/pnpm-workspace.yaml +29 -0
  22. package/template/rstest.config.mts +5 -0
  23. package/template/scripts/bootstrap-agent-skills.mjs +160 -35
  24. package/template/scripts/check-i18n-strings.mjs +94 -0
  25. package/template/scripts/validate-ultramodern.mjs.handlebars +387 -35
  26. package/template/shared/effect/api.ts.handlebars +1 -2
  27. package/template/src/modern-app-env.d.ts +2 -0
  28. package/template/src/modern.runtime.ts.handlebars +17 -3
  29. package/template/src/routes/[lang]/page.tsx.handlebars +211 -0
  30. package/template/src/routes/index.css.handlebars +14 -3
  31. package/template/src/routes/layout.tsx.handlebars +2 -1
  32. package/template/tailwind.config.ts.handlebars +1 -1
  33. package/template/tests/tsconfig.json +7 -0
  34. package/template/tests/ultramodern.contract.test.ts.handlebars +78 -0
  35. package/template-workspace/.agents/agent-reference-repos.json +24 -0
  36. package/template-workspace/.agents/skills-lock.json +19 -0
  37. package/template-workspace/.codex/hooks.json +16 -0
  38. package/template-workspace/.github/renovate.json +29 -0
  39. package/template-workspace/.github/workflows/ultramodern-workspace-gates.yml.handlebars +54 -0
  40. package/template-workspace/.gitignore.handlebars +5 -0
  41. package/template-workspace/.mise.toml.handlebars +2 -0
  42. package/template-workspace/AGENTS.md +36 -5
  43. package/template-workspace/README.md.handlebars +61 -11
  44. package/template-workspace/lefthook.yml +10 -0
  45. package/template-workspace/oxfmt.config.ts +13 -3
  46. package/template-workspace/oxlint.config.ts +12 -4
  47. package/template-workspace/pnpm-workspace.yaml +26 -8
  48. package/template-workspace/scripts/bootstrap-agent-skills.mjs +184 -26
  49. package/template-workspace/scripts/setup-agent-reference-repos.mjs +368 -0
  50. package/template/src/routes/page.tsx.handlebars +0 -119
  51. package/template-workspace/scripts/validate-ultramodern-workspace.mjs.handlebars +0 -403
package/README.md CHANGED
@@ -12,85 +12,122 @@
12
12
 
13
13
  Please follow [Quick Start](https://modernjs.dev/en/guides/get-started/quick-start) to get started with Modern.js.
14
14
 
15
- For UltraModern.js, use the BleedingDev create package. It defaults to the
16
- canonical SuperApp workspace and published BleedingDev package aliases:
15
+ For UltraModern.js, use the BleedingDev create package. It defaults to a
16
+ production-ready single app with `presetUltramodern(...)`, TanStack Router,
17
+ Tailwind CSS v4, i18n, Effect BFF, generated quality gates, and published
18
+ BleedingDev package aliases:
17
19
 
18
20
  ```bash
19
- pnpm dlx @bleedingdev/modern-js-create my-super-app
21
+ pnpm dlx @bleedingdev/modern-js-create my-app
20
22
  ```
21
23
 
22
- ### Router Template
24
+ To initialize the empty directory you are already in, pass `.` explicitly:
25
+
26
+ ```bash
27
+ pnpm dlx @bleedingdev/modern-js-create .
28
+ ```
23
29
 
24
- You can scaffold a TanStack Router first template:
30
+ The default is the full UltraModern single-app setup. Create a SuperApp
31
+ workspace explicitly when you need independently owned verticals:
25
32
 
26
33
  ```bash
27
- npx @modern-js/create my-app --router tanstack
34
+ pnpm dlx @bleedingdev/modern-js-create my-super-app --ultramodern-workspace
28
35
  ```
29
36
 
30
- ### Tailwind Template
37
+ The workspace starts shell-only so the first commit has no fake business
38
+ domains to delete. It generates:
39
+
40
+ - `apps/shell-super-app` as the Module Federation host and topology owner.
41
+ - `verticals/*` empty until you add a real domain with `--vertical`.
42
+ - `packages/shared-*` placeholders for shared contracts, tokens, and API
43
+ support.
44
+ - `.modernjs/ultramodern-generated-contract.json` with MF, Effect, i18n,
45
+ federated CSS, Cloudflare, and Zephyr dependency metadata.
31
46
 
32
- You can scaffold Tailwind CSS v4 setup (PostCSS + starter utility classes):
47
+ Validate the generated workspace before making application changes:
33
48
 
34
49
  ```bash
35
- npx @modern-js/create my-app --tailwind
50
+ cd my-super-app
51
+ mise install
52
+ pnpm install
53
+ pnpm check
54
+ pnpm build
36
55
  ```
37
56
 
38
- You can combine both options:
57
+ ### Router Template
58
+
59
+ TanStack Router is generated by default. Choose React Router only as an explicit
60
+ compatibility lane:
39
61
 
40
62
  ```bash
41
- npx @modern-js/create my-app --router tanstack --tailwind
63
+ pnpm dlx @bleedingdev/modern-js-create my-app --router react-router
42
64
  ```
43
65
 
44
- ### BFF Runtime Template
66
+ ### Tailwind Template
45
67
 
46
- You can scaffold BFF APIs with the current default runtime:
68
+ Tailwind CSS v4 setup is generated by default. Disable it explicitly when you
69
+ need a plain CSS starter:
47
70
 
48
71
  ```bash
49
- npx @modern-js/create my-app --bff
72
+ pnpm dlx @bleedingdev/modern-js-create my-app --no-tailwind
50
73
  ```
51
74
 
52
- You can explicitly scaffold Effect HttpApi runtime for BFF:
75
+ TanStack Router and Tailwind CSS work together without extra flags:
53
76
 
54
77
  ```bash
55
- npx @modern-js/create my-app --bff-runtime effect
78
+ pnpm dlx @bleedingdev/modern-js-create my-app
79
+ ```
80
+
81
+ ### BFF Runtime Template
82
+
83
+ UltraModern app scaffolds include Effect HttpApi BFF by default:
84
+
85
+ ```bash
86
+ pnpm dlx @bleedingdev/modern-js-create my-app
56
87
  ```
57
88
 
58
89
  To scaffold Hono runtime explicitly:
59
90
 
60
91
  ```bash
61
- npx @modern-js/create my-app --bff-runtime hono
92
+ pnpm dlx @bleedingdev/modern-js-create my-app --bff-runtime hono
62
93
  ```
63
94
 
64
95
  Generated starters expose `presetUltramodern(...)` as the public opinionated
65
96
  config wrapper when you want the full Ultramodern setup surface in
66
97
  `modern.config.ts`.
67
98
 
68
- You can combine TanStack Router + Tailwind + Effect BFF in one command:
99
+ TanStack Router, default Tailwind, and Effect BFF are included without extra
100
+ flags. For local monorepo dependency testing, add `--workspace`:
69
101
 
70
102
  ```bash
71
- npx @modern-js/create my-app --router tanstack --tailwind --bff-runtime effect
103
+ pnpm dlx @bleedingdev/modern-js-create my-app --workspace
72
104
  ```
73
105
 
74
- ### Micro Vertical Workspace Recipes
106
+ ### Vertical Workspace Recipes
75
107
 
76
- Use the existing create flags to scaffold packages inside a Micro Vertical
77
- workspace. The shell and remotes use TanStack Router; services use Effect by
78
- default, with Hono kept as an explicit compatibility lane.
108
+ Use the workspace add flow from the UltraModern workspace root. It derives the
109
+ package path, package name, port, Module Federation name, topology entry, local
110
+ overlay, ownership entry, Effect BFF surface, and root `dev:*` script from the
111
+ requested vertical name.
79
112
 
80
113
  ```bash
81
- npx @modern-js/create apps/shell --router tanstack --tailwind --workspace --sub
82
- npx @modern-js/create apps/remotes/catalog --router tanstack --tailwind --workspace --sub
83
- npx @modern-js/create apps/remotes/design-system --router tanstack --tailwind --workspace --sub
84
- npx @modern-js/create services/catalog-api --bff-runtime effect --workspace --sub
85
- npx @modern-js/create services/legacy-api --bff-runtime hono --workspace --sub
114
+ pnpm dlx @bleedingdev/modern-js-create catalog --vertical
86
115
  ```
87
116
 
88
- When a design system needs independent deployment, treat it as a horizontal
89
- Module Federation remote with the same topology, trust, SSR, compatibility, and
90
- fallback expectations as feature remotes. Otherwise shared packages should be
91
- regular workspace packages for tokens, primitives, generated clients, or
92
- domain-neutral utilities. Keep feature composites and workflow logic owned by a
93
- shell, remote, or service package.
117
+ Use this decision table before adding a vertical:
118
+
119
+ | Need | Keep inside current vertical | Create a new vertical |
120
+ | --- | --- | --- |
121
+ | Route or widget changes with the same product owner, release train, and fallback behavior | Yes | No |
122
+ | Route subtree needs independent rollout, rollback, or incident ownership | No | `--vertical` |
123
+ | UI and Effect BFF must version, deploy, and roll back together | No | `--vertical` |
124
+ | Design tokens, primitives, generated clients, or domain-neutral utilities | Yes | Use an ordinary workspace package, not a vertical |
125
+ | Feature composites or workflow state shared across verticals | No | Revisit ownership; do not hide it in shared code |
126
+
127
+ The lower-level `--router react-router`, `--workspace`, and `--sub` flags remain
128
+ available for compatibility and local package scaffolding, but UltraModern
129
+ vertical additions should use `--vertical` so paths, topology, Effect BFF
130
+ contracts, and local overlays stay consistent.
94
131
 
95
132
  See
96
133
  `docs/super-app-rfc-adr/WORKSPACE-0001-micro-vertical-workspace-scaffolding.md`
@@ -101,13 +138,93 @@ UltraModern.js entrypoint. The lower-level `--ultramodern-*` flags remain
101
138
  available for release engineering and local package-source testing, but users
102
139
  should not need them for normal app creation.
103
140
 
141
+ ### SuperApp Architecture Contracts
142
+
143
+ The generated shell owns route assembly and policy. Each vertical added with
144
+ `--vertical` owns its route subtree, MF exposes, Effect BFF contract, generated
145
+ client, `localisedUrls`, locale JSON, CSS layer, and Cloudflare Worker output.
146
+ The shell consumes vertical UI through MF manifests and vertical APIs through
147
+ generated Effect clients exported by the vertical packages.
148
+
149
+ Route localization is route-owned. Each app writes
150
+ `src/routes/ultramodern-route-metadata` and passes
151
+ `ultramodernLocalisedUrls` into `@modern-js/plugin-i18n`. Locale JSON is served
152
+ from `/locales/{{lng}}/{{ns}}.json`; Czech and English routes are generated from
153
+ the route owner, not from shell rewrites.
154
+
155
+ CSS federation is explicit:
156
+
157
+ - `packages/shared-design-tokens` exports `./tokens.css` and owns
158
+ `ultramodern-shared-tokens`.
159
+ - The shell owns shell base and overlay CSS only.
160
+ - Verticals own their vertical CSS layer and `[data-app-id="<vertical>"]`
161
+ root marker.
162
+ - Tailwind CSS v4 is configured per app through `@tailwindcss/postcss`.
163
+ - Duplicate base styles are forbidden; SSR first paint depends on shared token
164
+ CSS plus Modern/Rspack-emitted app CSS.
165
+ - Apps should not inject remote `async-index.css` paths, hardcode remote
166
+ stylesheet links, or disable filename hashing to make CSS URLs predictable.
167
+ UltraModern SSR resolves federated CSS from build output and MF manifests so
168
+ generated shells and demos can keep normal hashed assets.
169
+
170
+ Version switching evidence must keep UI, Effect API, CSS, i18n JSON, and MF
171
+ manifest markers in lockstep for the same vertical version.
172
+
173
+ ### Cloudflare And Zephyr Proof
174
+
175
+ Each generated workspace app has:
176
+
177
+ - `cloudflare:build`, `cloudflare:deploy`, `cloudflare:preview`, and
178
+ `cloudflare:proof` scripts.
179
+ - Cloudflare metadata in `.modernjs/ultramodern-generated-contract.json`.
180
+ - `zephyr:dependencies` for any consumed verticals.
181
+ - `zephyr-rspack-plugin` wired through the generated Modern.js Rspack bridge.
182
+
183
+ Deploy first, then pass each deployed app's generated public URL env key into
184
+ the proof step. Shell-only workspaces only need the shell URL; added verticals
185
+ use the same `ULTRAMODERN_PUBLIC_URL_<APP_ID>` pattern with hyphens converted
186
+ to underscores and uppercased:
187
+
188
+ ```bash
189
+ pnpm cloudflare:deploy
190
+ ULTRAMODERN_PUBLIC_URL_SHELL_SUPER_APP=https://shell-super-app.example.workers.dev \
191
+ ULTRAMODERN_PUBLIC_URL_TRANSPORTATION=https://transportation.example.workers.dev \
192
+ pnpm cloudflare:proof -- --require-public-urls
193
+ ```
194
+
195
+ Without public URLs and credentials, use local `pnpm check` and `pnpm build`
196
+ evidence only; do not claim live Cloudflare or Zephyr selection has been
197
+ proven.
198
+
199
+ ### Troubleshooting
200
+
201
+ | Symptom | Current check | Owner |
202
+ | --- | --- | --- |
203
+ | Package cohort mismatch | Regenerate with one package source strategy, run `mise install`, then rerun `pnpm install` from the activated shell. | Generated workspace package source metadata |
204
+ | Install failure | Check the active Node/pnpm from `mise install`; rerun `pnpm install` after the shell sees the pinned versions. | Toolchain setup |
205
+ | Build failure | Run `pnpm check` before `pnpm build`; fix reported format, lint, type, skill, i18n, or generated-contract failures first. | Owning package or generated contract |
206
+ | Missing public URL | Set the env key from `.modernjs/ultramodern-generated-contract.json`, for example `ULTRAMODERN_PUBLIC_URL_SHELL_SUPER_APP`. | Deployment operator |
207
+ | Cloudflare credentials | Confirm Wrangler credentials before `pnpm cloudflare:deploy`; local checks do not prove live Worker access. | Deployment operator |
208
+ | Asset or CSS 404 | Rebuild with `pnpm build` or `pnpm cloudflare:deploy` and inspect emitted Modern/Rspack asset paths instead of hardcoding CSS URLs. | Framework/runtime asset pipeline |
209
+ | Federation manifest failure | Run the shell and vertical build scripts, then check each deployed `/mf-manifest.json` URL used by the shell. | Module Federation owner |
210
+
104
211
  ### Local Monorepo Testing
105
212
 
106
213
  When testing unreleased Modern.js packages from a local monorepo checkout, use
107
214
  workspace protocol dependencies:
108
215
 
109
216
  ```bash
110
- npx @modern-js/create my-app --router tanstack --bff-runtime effect --workspace
217
+ pnpm dlx @bleedingdev/modern-js-create my-app --workspace
218
+ ```
219
+
220
+ For package-source validation of the full SuperApp workspace, generate with the
221
+ workspace package source, then run the generated contract gate:
222
+
223
+ ```bash
224
+ pnpm dlx @bleedingdev/modern-js-create my-super-app --ultramodern-workspace --ultramodern-package-source workspace
225
+ cd my-super-app
226
+ pnpm install
227
+ pnpm check
111
228
  ```
112
229
 
113
230
  ## Documentation