@bleedingdev/modern-js-main-doc 3.8.2-ultramodern.9 → 3.8.3-ultramodern.2
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/docs/en/community/showcase.mdx +4 -5
- package/docs/en/components/init-app.mdx +8 -7
- package/docs/en/components/init-rspack-app.mdx +1 -3
- package/docs/en/components/prerequisites.mdx +1 -1
- package/docs/en/configure/app/bff/effect.mdx +7 -7
- package/docs/en/guides/advanced-features/bff/frameworks.mdx +1 -1
- package/docs/en/guides/basic-features/deploy.mdx +2 -2
- package/docs/en/guides/get-started/quick-start.mdx +1 -1
- package/docs/en/guides/get-started/tech-stack.mdx +1 -1
- package/docs/en/guides/get-started/ultramodern.mdx +123 -38
- package/docs/en/guides/troubleshooting/cli.mdx +1 -1
- package/docs/en/tutorials/examples/csr-auth.mdx +3 -1
- package/docs/zh/community/showcase.mdx +4 -5
- package/docs/zh/components/init-app.mdx +7 -7
- package/docs/zh/components/init-rspack-app.mdx +1 -3
- package/docs/zh/components/prerequisites.mdx +1 -1
- package/docs/zh/configure/app/bff/effect.mdx +7 -7
- package/docs/zh/guides/basic-features/deploy.mdx +2 -2
- package/docs/zh/guides/get-started/quick-start.mdx +1 -1
- package/docs/zh/guides/get-started/tech-stack.mdx +1 -1
- package/docs/zh/guides/get-started/ultramodern.mdx +116 -38
- package/docs/zh/guides/troubleshooting/cli.mdx +1 -1
- package/docs/zh/tutorials/examples/csr-auth.mdx +3 -1
- package/package.json +3 -2
- package/rspress.config.ts +16 -54
- package/src/sandbox/csr-auth/src/routes/Auth-tsx.txt +13 -3
- package/src/sandbox/csr-auth/src/routes/layout-tsx.txt +3 -3
- package/src/sandbox/csr-auth/src/routes/login/page-tsx.txt +7 -3
- package/ultramodern-preset/assets/img/ultramodern-logo-dark.svg +7 -0
- package/ultramodern-preset/assets/img/ultramodern-social-card.png +0 -0
- package/ultramodern-preset/package.json +19 -0
- package/ultramodern-preset/src/index.ts +127 -0
- package/static/img/social-card.svg +0 -12
- /package/{static/img/logo.svg → ultramodern-preset/assets/img/ultramodern-logo-light.svg} +0 -0
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
sidebar_position: 0
|
|
3
|
+
title: Ecosystem
|
|
3
4
|
---
|
|
4
5
|
|
|
5
|
-
#
|
|
6
|
+
# Ecosystem
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
UltraModern.js builds on a focused ecosystem of frameworks and tools. These projects provide the Effect, TanStack Router, build, documentation, and Module Federation foundations used by the fork.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## The Cases
|
|
10
|
+
## Projects
|
|
12
11
|
|
|
13
12
|
import { ShowcaseList } from '@site/src/components/ShowcaseList';
|
|
14
13
|
|
|
@@ -3,26 +3,27 @@ workspaces. It does not require global installation and can be run on-demand
|
|
|
3
3
|
using `pnpm dlx`.
|
|
4
4
|
|
|
5
5
|
The supported pnpm command is the scoped package specifier:
|
|
6
|
-
`pnpm dlx @bleedingdev/modern-js-create <target>`. Do not shorten it
|
|
7
|
-
`pnpm dlx modern-js-create`; there is no unscoped package by
|
|
6
|
+
`pnpm dlx @bleedingdev/modern-js-ultramodern-create <target>`. Do not shorten it
|
|
7
|
+
to `pnpm dlx modern-js-ultramodern-create`; there is no unscoped package by
|
|
8
|
+
that name.
|
|
8
9
|
|
|
9
10
|
You can initialize the empty directory you are already in:
|
|
10
11
|
|
|
11
12
|
```bash
|
|
12
13
|
mkdir myapp && cd myapp
|
|
13
|
-
pnpm dlx @bleedingdev/modern-js-create .
|
|
14
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create .
|
|
14
15
|
```
|
|
15
16
|
|
|
16
17
|
You can also create a project directly in a new directory:
|
|
17
18
|
|
|
18
19
|
```bash
|
|
19
|
-
pnpm dlx @bleedingdev/modern-js-create my-super-app
|
|
20
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create my-super-app
|
|
20
21
|
```
|
|
21
22
|
|
|
22
23
|
To initialize with workspace protocol dependencies (for local monorepo testing of unreleased Modern.js packages):
|
|
23
24
|
|
|
24
25
|
```bash
|
|
25
|
-
pnpm dlx @bleedingdev/modern-js-create my-super-app --workspace
|
|
26
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create my-super-app --workspace
|
|
26
27
|
```
|
|
27
28
|
|
|
28
29
|
The BleedingDev create package will directly create the application without providing an interactive Q & A interface:
|
|
@@ -73,13 +74,13 @@ The default workspace starts shell-only and installs the published BleedingDev
|
|
|
73
74
|
package aliases:
|
|
74
75
|
|
|
75
76
|
```bash
|
|
76
|
-
pnpm dlx @bleedingdev/modern-js-create my-super-app
|
|
77
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create my-super-app
|
|
77
78
|
```
|
|
78
79
|
|
|
79
80
|
From a generated SuperApp workspace, add a business MicroVertical in place:
|
|
80
81
|
|
|
81
82
|
```bash
|
|
82
|
-
pnpm dlx @bleedingdev/modern-js-create transportation --vertical
|
|
83
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create transportation --vertical
|
|
83
84
|
```
|
|
84
85
|
|
|
85
86
|
The `--vertical` command mutates the current workspace: it adds the vertical
|
|
@@ -54,7 +54,7 @@ would give your app a second Effect identity. Before setting
|
|
|
54
54
|
`/effect-server`, `/effect-edge` or `/effect-client`, install the exact cohort:
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
|
-
pnpm add effect@4.0.0-
|
|
57
|
+
pnpm add effect@4.0.0-rc.112 @effect/opentelemetry@4.0.0-rc.112
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
The pin is exact because UltraModern ships Effect as one lockstep cohort. Apps
|
|
@@ -219,17 +219,17 @@ generated apps use:
|
|
|
219
219
|
|
|
220
220
|
```yaml
|
|
221
221
|
trustPolicyExclude:
|
|
222
|
-
- 'effect@4.0.0-
|
|
223
|
-
- '@effect/opentelemetry@4.0.0-
|
|
222
|
+
- 'effect@4.0.0-rc.112'
|
|
223
|
+
- '@effect/opentelemetry@4.0.0-rc.112'
|
|
224
224
|
|
|
225
225
|
overrides:
|
|
226
|
-
'@effect/opentelemetry': 4.0.0-
|
|
227
|
-
'@effect/vitest': 4.0.0-
|
|
228
|
-
effect: 4.0.0-
|
|
226
|
+
'@effect/opentelemetry': 4.0.0-rc.112
|
|
227
|
+
'@effect/vitest': 4.0.0-rc.112
|
|
228
|
+
effect: 4.0.0-rc.112
|
|
229
229
|
```
|
|
230
230
|
|
|
231
231
|
Do not add a different direct `effect` version in an app package. A mismatched
|
|
232
|
-
Effect
|
|
232
|
+
Effect prerelease can fail while building layers or HTTP middleware because runtime
|
|
233
233
|
services come from different package instances. The strict 24-hour release-age
|
|
234
234
|
gate applies to installed packages; the current cohort has no Effect age
|
|
235
235
|
exemption, and override-only `@effect/vitest` is not an installed approval
|
|
@@ -122,7 +122,7 @@ const response = await api.client.hello.ping({});
|
|
|
122
122
|
|
|
123
123
|
The `api.client.*` surface is materialized by the BFF loader for `@api/index` imports. Do not import `api/index` directly and expect `client` to run in server code, scripts, or tests; direct entry imports expose the server runtime definition, and `client` is only a typed placeholder there.
|
|
124
124
|
|
|
125
|
-
For UltraModern, Effect `HttpApi` plus Effect BFF is the single blessed authored HTTP path. Use `HttpApi` endpoints with `query`, `params`, `payload`, `success`, and declared errors such as `HttpApiSchema.status(...)`; implement them with `HttpApiBuilder.group(...).handle(...)` and `HttpApiBuilder.layer(...).pipe(Layer.provide(...))`, then default-export the entry as `defineEffectBff({ api, layer })`. See `packages/
|
|
125
|
+
For UltraModern, Effect `HttpApi` plus Effect BFF is the single blessed authored HTTP path. Use `HttpApi` endpoints with `query`, `params`, `payload`, `success`, and declared errors such as `HttpApiSchema.status(...)`; implement them with `HttpApiBuilder.group(...).handle(...)` and `HttpApiBuilder.layer(...).pipe(Layer.provide(...))`, then default-export the entry as `defineEffectBff({ api, layer })`. See `packages/server/bff-effect/tests/effect-edge-runtime.test.ts` for the live runtime shape.
|
|
126
126
|
|
|
127
127
|
Hono and `api/lambda/**` are internal compatibility only and feature-frozen.
|
|
128
128
|
|
|
@@ -267,11 +267,11 @@ First, you need to configure the **Root Directory** as `packages/app` on the Ver
|
|
|
267
267
|
|
|
268
268
|
<img src="https://sf16-sg.tiktokcdn.com/obj/eden-sg/lmeh7nuptpfnuhd/vercel-root-directory.png" />
|
|
269
269
|
|
|
270
|
-
Specify Node.js runtime as `
|
|
270
|
+
Specify Node.js runtime as `26.7.0` or newer:
|
|
271
271
|
|
|
272
272
|
```json title="package.json"
|
|
273
273
|
"engines": {
|
|
274
|
-
"node": "
|
|
274
|
+
"node": ">=26.7.0"
|
|
275
275
|
}
|
|
276
276
|
```
|
|
277
277
|
|
|
@@ -27,7 +27,7 @@ import DebugApp from '@site-docs-en/components/debug-app';
|
|
|
27
27
|
|
|
28
28
|
## Configuration
|
|
29
29
|
|
|
30
|
-
In an UltraModern.js project created using `@bleedingdev/modern-js-create`, a `modern.config.ts` file is generated by default.
|
|
30
|
+
In an UltraModern.js project created using `@bleedingdev/modern-js-ultramodern-create`, a `modern.config.ts` file is generated by default.
|
|
31
31
|
|
|
32
32
|
You can modify the configuration through this file to override the default behavior of Modern.js. For example, to enable SSR, add the following configuration:
|
|
33
33
|
|
|
@@ -24,7 +24,7 @@ Modern.js provides two first-party routing frameworks:
|
|
|
24
24
|
When creating an UltraModern project, TanStack Router is included by default:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
pnpm dlx @bleedingdev/modern-js-create myapp
|
|
27
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create myapp
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
Modern.js supports conventional routing, self-controlled routing, or other routing schemes. Please refer to ["Routing"](/guides/basic-features/routes/routes) to make your choice.
|
|
@@ -69,9 +69,9 @@ For an older generated workspace, migrate by treating the published cohort as
|
|
|
69
69
|
the source of truth:
|
|
70
70
|
|
|
71
71
|
```bash
|
|
72
|
-
pnpm dlx @bleedingdev/modern-js-create@latest --help
|
|
73
|
-
pnpm dlx @bleedingdev/modern-js-create@latest catalog --vertical --dry-run
|
|
74
|
-
pnpm dlx @bleedingdev/modern-js-create@latest catalog --vertical
|
|
72
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create@latest --help
|
|
73
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create@latest catalog --vertical --dry-run
|
|
74
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create@latest catalog --vertical
|
|
75
75
|
mise install
|
|
76
76
|
mise exec -- pnpm install
|
|
77
77
|
mise exec -- pnpm check
|
|
@@ -91,8 +91,8 @@ package cohort together. Resolve the current cohort version first, then run
|
|
|
91
91
|
the matching migration:
|
|
92
92
|
|
|
93
93
|
```bash
|
|
94
|
-
COHORT="$(npm view @bleedingdev/modern-js-create version)"
|
|
95
|
-
pnpm dlx "@bleedingdev/modern-js-create@$COHORT" ultramodern \
|
|
94
|
+
COHORT="$(npm view @bleedingdev/modern-js-ultramodern-create version)"
|
|
95
|
+
pnpm dlx "@bleedingdev/modern-js-ultramodern-create@$COHORT" ultramodern \
|
|
96
96
|
migrate-strict-effect --version "$COHORT"
|
|
97
97
|
pnpm install
|
|
98
98
|
pnpm check
|
|
@@ -130,8 +130,8 @@ Before hand-editing package aliases or generated metadata, run the framework
|
|
|
130
130
|
migration command from the target workspace:
|
|
131
131
|
|
|
132
132
|
```bash
|
|
133
|
-
COHORT="$(npm view @bleedingdev/modern-js-create version)"
|
|
134
|
-
pnpm dlx "@bleedingdev/modern-js-create@$COHORT" ultramodern \
|
|
133
|
+
COHORT="$(npm view @bleedingdev/modern-js-ultramodern-create version)"
|
|
134
|
+
pnpm dlx "@bleedingdev/modern-js-ultramodern-create@$COHORT" ultramodern \
|
|
135
135
|
migrate-strict-effect --version "$COHORT"
|
|
136
136
|
pnpm api:check
|
|
137
137
|
pnpm contract:check
|
|
@@ -146,8 +146,8 @@ migration work: move code to `shared/api.ts`, `api/index.ts`, and
|
|
|
146
146
|
and `src/effect`.
|
|
147
147
|
|
|
148
148
|
Generated strict Effect workspaces pin the compatible Effect cohort with pnpm
|
|
149
|
-
overrides: `effect@4.0.0-
|
|
150
|
-
and `@effect/vitest@4.0.0-
|
|
149
|
+
overrides: `effect@4.0.0-rc.112`, `@effect/opentelemetry@4.0.0-rc.112`,
|
|
150
|
+
and `@effect/vitest@4.0.0-rc.112`. Do not add app-local direct Effect
|
|
151
151
|
versions that disagree with those overrides. The strict 24-hour release-age
|
|
152
152
|
gate applies to installed packages; this cohort carries no Effect age
|
|
153
153
|
exemption, and override-only `@effect/vitest` is not an installed approval
|
|
@@ -159,12 +159,21 @@ metadata transition; they are not release-age approvals.
|
|
|
159
159
|
|
|
160
160
|
| Surface | Pin |
|
|
161
161
|
| --- | --- |
|
|
162
|
-
| Effect runtime and test cohort | `effect`, `@effect/opentelemetry`, and `@effect/vitest`: `4.0.0-
|
|
163
|
-
| Effect compiler | `@effect/tsgo@0.
|
|
164
|
-
|
|
|
165
|
-
|
|
|
166
|
-
|
|
|
167
|
-
|
|
|
162
|
+
| Effect runtime and test cohort | `effect`, `@effect/opentelemetry`, and `@effect/vitest`: `4.0.0-rc.112` |
|
|
163
|
+
| Effect compiler | `@effect/tsgo@0.37.0` |
|
|
164
|
+
| Oxc and Ultracite | `oxlint@1.80.0`, `oxfmt@0.65.0`, `ultracite@7.10.6` |
|
|
165
|
+
| TanStack Router | `@tanstack/react-router@1.170.32`, `@tanstack/router-core@1.171.27`, `@tanstack/history@1.162.1` |
|
|
166
|
+
| Module Federation | `bridge-react`, `manifest`, `modern-js-v3`, and `rspack`: `2.9.0`; `@module-federation/node@2.7.50` |
|
|
167
|
+
| Tailwind CSS | `tailwindcss@4.3.3` |
|
|
168
|
+
| Node and package tooling | Node `26.7.0`, `@types/node@^26.2.0`, pnpm `11.24.0` |
|
|
169
|
+
|
|
170
|
+
Generated workspaces default to Module Federation bridge-react's router-free
|
|
171
|
+
base entry (`bridge.enableBridgeRouter: false`), with TanStack Router as the
|
|
172
|
+
application router. Declaring `react-router` (or `react-router-dom`) as a
|
|
173
|
+
direct dependency of an app marks it a React Router consumer: the
|
|
174
|
+
generator/migration then emit `enableBridgeRouter: true` for that app's
|
|
175
|
+
federation config, the workspace validator accepts it, and the UltraModern
|
|
176
|
+
preset aliases `react-router`'s entrypoints for the app's own routing.
|
|
168
177
|
|
|
169
178
|
Gradual migration means old, unmigrated Modern.js apps can keep their existing
|
|
170
179
|
runtime until they are converted. Once a surface is generated or migrated as
|
|
@@ -248,6 +257,94 @@ directories, and caches are isolated per app, build target, and Rspack
|
|
|
248
257
|
environment so local `build`, `cloudflare:build`, and multi-environment
|
|
249
258
|
compilers do not share mutable build state.
|
|
250
259
|
|
|
260
|
+
## Configure the public preset
|
|
261
|
+
|
|
262
|
+
Use `presetUltramodern(appConfig, presetOptions)` inside the normal Modern.js
|
|
263
|
+
`defineConfig` call:
|
|
264
|
+
|
|
265
|
+
```ts title="modern.config.ts"
|
|
266
|
+
import { defineConfig, presetUltramodern } from '@modern-js/app-tools';
|
|
267
|
+
|
|
268
|
+
export default defineConfig(
|
|
269
|
+
presetUltramodern(
|
|
270
|
+
{
|
|
271
|
+
output: {
|
|
272
|
+
precompress: false,
|
|
273
|
+
},
|
|
274
|
+
server: {
|
|
275
|
+
telemetry: {
|
|
276
|
+
failLoudStartup: true,
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
appId: 'catalog',
|
|
282
|
+
enableModuleFederationSSR: false,
|
|
283
|
+
enableTelemetryExporters: false,
|
|
284
|
+
},
|
|
285
|
+
),
|
|
286
|
+
);
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
The first argument is ordinary `AppUserConfig`. It contains app-owned config
|
|
290
|
+
and wins where it supplies an override. The second argument controls the
|
|
291
|
+
preset itself. Use its typed options, such as `enableBffRequestId: false`,
|
|
292
|
+
`enableTelemetry: false`, `enableTelemetryExporters: false`, and
|
|
293
|
+
`enableModuleFederationSSR: false`, to turn preset features off.
|
|
294
|
+
|
|
295
|
+
Composition follows the Modern.js config merge rules:
|
|
296
|
+
|
|
297
|
+
- Nested records merge, so changing one nested field keeps its preset
|
|
298
|
+
siblings.
|
|
299
|
+
- Scalars and `false` supplied by the app override preset values. Omitting a
|
|
300
|
+
field, or leaving it `undefined`, keeps the preset value.
|
|
301
|
+
- Arrays and config hooks compose in preset-first order. Non-function array
|
|
302
|
+
entries are deduplicated by deep equality, while function entries are all
|
|
303
|
+
retained. An empty array or empty record does not clear values already
|
|
304
|
+
supplied by the preset.
|
|
305
|
+
|
|
306
|
+
There is no generic reset sentinel. Use a typed preset option for preset-owned
|
|
307
|
+
behavior and a normal app config override for app-owned behavior.
|
|
308
|
+
|
|
309
|
+
`createPresetUltramodernConfig(options)` is an advanced API for inspecting or
|
|
310
|
+
materializing a fresh preset config. Do not spread its result into another
|
|
311
|
+
config object. Object spread is shallow, so replacing `server`, `output`, or
|
|
312
|
+
another nested record can silently discard preset siblings. Use
|
|
313
|
+
`presetUltramodern(...)` for authoring `modern.config.ts`.
|
|
314
|
+
|
|
315
|
+
### Bare preset and generated workspace policy
|
|
316
|
+
|
|
317
|
+
The preset and the workspace generator own different parts of the config:
|
|
318
|
+
|
|
319
|
+
| Source | Identity | Remaining config |
|
|
320
|
+
| --- | --- | --- |
|
|
321
|
+
| Bare `createPresetUltramodernConfig()` result | Uses `appId: 'app'` and has no `deliveryUnit` | Uses the preset defaults. Telemetry stays enabled, but no exporter is configured until its endpoint is set. |
|
|
322
|
+
| Generated app | Supplies the app-specific `appId` and stamped `deliveryUnit` | Inherits the other strict defaults from `presetUltramodern(...)`. |
|
|
323
|
+
| Application | Supplies the first `appConfig` argument | Overrides app-owned fields through the normal Modern.js merge. |
|
|
324
|
+
|
|
325
|
+
Keep the generated `appId` and `deliveryUnit` options intact. To change
|
|
326
|
+
preset-owned behavior, use typed options such as
|
|
327
|
+
`enableTelemetryExporters: false`,
|
|
328
|
+
`enableTelemetry: false`, `enableBffRequestId: false`, or
|
|
329
|
+
`enableModuleFederationSSR: false`. To change an app-owned field, put the
|
|
330
|
+
override in the first argument, as in the example above.
|
|
331
|
+
|
|
332
|
+
Telemetry exporter endpoints are unset by default:
|
|
333
|
+
|
|
334
|
+
- `MODERN_TELEMETRY_OTLP_ENDPOINT` enables only the OTLP exporter.
|
|
335
|
+
- `MODERN_TELEMETRY_VICTORIA_ENDPOINT` enables only the VictoriaMetrics
|
|
336
|
+
exporter.
|
|
337
|
+
- Setting both enables both. Leaving both unset keeps the telemetry pipeline
|
|
338
|
+
enabled without configuring an exporter.
|
|
339
|
+
|
|
340
|
+
The typed `otlpEndpoint` and `victoriaMetricsEndpoint` preset options provide
|
|
341
|
+
the same per-exporter behavior without environment variables.
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
MODERN_TELEMETRY_OTLP_ENDPOINT=https://otel.example.com/v1/logs \
|
|
345
|
+
mise exec -- pnpm dev
|
|
346
|
+
```
|
|
347
|
+
|
|
251
348
|
## Human Workflow
|
|
252
349
|
|
|
253
350
|
The public BleedingDev create package has one supported generated product. The
|
|
@@ -257,7 +354,7 @@ BFF, Module Federation topology, generated quality gates, and Cloudflare deploy
|
|
|
257
354
|
basics:
|
|
258
355
|
|
|
259
356
|
```bash
|
|
260
|
-
pnpm dlx @bleedingdev/modern-js-create myapp
|
|
357
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create myapp
|
|
261
358
|
cd myapp
|
|
262
359
|
mise install
|
|
263
360
|
mise exec -- pnpm install
|
|
@@ -269,10 +366,10 @@ generate a demo domain by default. Add real business MicroVerticals when they
|
|
|
269
366
|
become real ownership boundaries:
|
|
270
367
|
|
|
271
368
|
```bash
|
|
272
|
-
pnpm dlx @bleedingdev/modern-js-create transportation --vertical
|
|
273
|
-
pnpm dlx @bleedingdev/modern-js-create food-delivery --vertical
|
|
274
|
-
pnpm dlx @bleedingdev/modern-js-create payments --vertical
|
|
275
|
-
pnpm dlx @bleedingdev/modern-js-create maps --vertical
|
|
369
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create transportation --vertical
|
|
370
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create food-delivery --vertical
|
|
371
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create payments --vertical
|
|
372
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create maps --vertical
|
|
276
373
|
mise exec -- pnpm check
|
|
277
374
|
```
|
|
278
375
|
|
|
@@ -288,10 +385,10 @@ Automation can use explicit MicroVertical syntax instead of relying on the
|
|
|
288
385
|
positional form:
|
|
289
386
|
|
|
290
387
|
```bash
|
|
291
|
-
pnpm dlx @bleedingdev/modern-js-create --vertical=transportation
|
|
292
|
-
pnpm dlx @bleedingdev/modern-js-create --vertical-name transportation
|
|
293
|
-
pnpm dlx @bleedingdev/modern-js-create transportation --vertical --dry-run
|
|
294
|
-
pnpm dlx @bleedingdev/modern-js-create transportation --vertical \
|
|
388
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create --vertical=transportation
|
|
389
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create --vertical-name transportation
|
|
390
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create transportation --vertical --dry-run
|
|
391
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create transportation --vertical \
|
|
295
392
|
--codesmith-overlay ./generators/vertical-overlay
|
|
296
393
|
```
|
|
297
394
|
|
|
@@ -310,7 +407,7 @@ import {
|
|
|
310
407
|
addUltramodernVertical,
|
|
311
408
|
generateUltramodernWorkspace,
|
|
312
409
|
planUltramodernVertical,
|
|
313
|
-
} from '@modern-js/create/ultramodern-workspace';
|
|
410
|
+
} from '@modern-js/ultramodern-create/ultramodern-workspace';
|
|
314
411
|
|
|
315
412
|
const workspace = generateUltramodernWorkspace({
|
|
316
413
|
targetDir: '/tmp/my-workspace',
|
|
@@ -342,7 +439,7 @@ returns the same shape plus `dryRun`, `selectedPort`, `moduleFederationRemote`,
|
|
|
342
439
|
CodeSmith consumers can use the adapter subpath:
|
|
343
440
|
|
|
344
441
|
```ts
|
|
345
|
-
import ultramodernCodeSmith from '@modern-js/create/ultramodern-workspace/codesmith';
|
|
442
|
+
import ultramodernCodeSmith from '@modern-js/ultramodern-create/ultramodern-workspace/codesmith';
|
|
346
443
|
|
|
347
444
|
await ultramodernCodeSmith({
|
|
348
445
|
config: {
|
|
@@ -426,18 +523,6 @@ BleedingDev packages are published through GitHub Actions trusted publishing.
|
|
|
426
523
|
The public workflow is tokenless; do not publish packages manually from a
|
|
427
524
|
developer machine.
|
|
428
525
|
|
|
429
|
-
## Baseline Switches (Opt-out)
|
|
430
|
-
|
|
431
|
-
The generated `presetUltramodern(...)` starter enables strict platform contracts. Use these env switches to opt out per app or per environment:
|
|
432
|
-
|
|
433
|
-
- `MODERN_BASELINE_ENABLE_MF_SSR` (default: `true`): Enables app-level MF SSR baseline contract (`server.ssr.mode: 'stream'` + `moduleFederationAppSSR`). Disable when the app does not use app-level MF SSR, or when you need plain SSR/CSR behavior first.
|
|
434
|
-
- `MODERN_BASELINE_ENABLE_BFF_REQUEST_ID` (default: `true`): Enables default BFF producer identity contract (`bff.requestId`). Disable when the app does not need cross-project producer isolation.
|
|
435
|
-
- `MODERN_BASELINE_ENABLE_TELEMETRY_EXPORTERS` (default: `true`): Enables telemetry exporters in baseline config. Disable when the environment has no telemetry backend yet.
|
|
436
|
-
- `MODERN_BASELINE_APP_ID` (default: `basename(process.cwd())`): Overrides baseline `bff.requestId` identity. Set this when you need a fixed platform-wide producer ID convention.
|
|
437
|
-
- `MODERN_TELEMETRY_OTLP_ENDPOINT` (default: `http://127.0.0.1:4318/v1/logs`): OTLP exporter endpoint. Override when you route telemetry through a different collector endpoint.
|
|
438
|
-
- `MODERN_TELEMETRY_VICTORIA_ENDPOINT` (default: `http://127.0.0.1:8428/api/v1/import/prometheus`): VictoriaMetrics exporter endpoint. Override when you use a different VM ingress endpoint.
|
|
439
|
-
- `MODERN_TELEMETRY_FAIL_LOUD_STARTUP` (default: `true`): Fails startup if configured exporters fail startup health checks. Disable in local/dev environments where temporary telemetry outage should not block boot.
|
|
440
|
-
|
|
441
526
|
## Related Docs
|
|
442
527
|
|
|
443
528
|
- [BFF Runtime Frameworks](/guides/advanced-features/bff/frameworks)
|
|
@@ -35,5 +35,5 @@ pnpm run command --options
|
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
:::tip
|
|
38
|
-
|
|
38
|
+
UltraModern.js requires Node.js >= 26.7.0 and pnpm >= 11. Use the repository's pinned mise toolchain so the CLI and native TypeScript runtime stay aligned.
|
|
39
39
|
:::
|
|
@@ -4,7 +4,7 @@ title: Route Authorization
|
|
|
4
4
|
|
|
5
5
|
# Route Authorization
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
UltraModern.js uses convention-based routing backed by TanStack Router. For more details, please refer to [Routing](/guides/basic-features/routes/routes#routing).
|
|
8
8
|
|
|
9
9
|
In a web application, if there are multiple routes, we may need to authorize access to some of them before accessing them. For example, in the following scenario:
|
|
10
10
|
|
|
@@ -12,6 +12,7 @@ In a web application, if there are multiple routes, we may need to authorize acc
|
|
|
12
12
|
- Access to the `/protected` route requires authorization. If there is no authorization, it will automatically redirect to the `/login` route. After successful login, it returns to `/protected`.
|
|
13
13
|
|
|
14
14
|
import Sandpack from '@site/src/components/Sandpack';
|
|
15
|
+
import { ultramodernSandpackFiles } from '@modern-js/ultramodern-sandpack-profile';
|
|
15
16
|
import srcRoutesPageText from '../../../../src/sandbox/csr-auth/src/routes/page-tsx.txt';
|
|
16
17
|
import srcRoutesLayoutText from '../../../../src/sandbox/csr-auth/src/routes/layout-tsx.txt';
|
|
17
18
|
import srcRoutesAuthText from '../../../../src/sandbox/csr-auth/src/routes/Auth-tsx.txt';
|
|
@@ -20,6 +21,7 @@ import srcRoutesProtectedPageText from '../../../../src/sandbox/csr-auth/src/rou
|
|
|
20
21
|
import srcRoutesLoginPageText from '../../../../src/sandbox/csr-auth/src/routes/login/page-tsx.txt';
|
|
21
22
|
|
|
22
23
|
<Sandpack template="web-app" files={{
|
|
24
|
+
...ultramodernSandpackFiles,
|
|
23
25
|
'/src/routes/page.tsx': srcRoutesPageText,
|
|
24
26
|
'/src/routes/layout.tsx': srcRoutesLayoutText,
|
|
25
27
|
'/src/routes/Auth.tsx': srcRoutesAuthText,
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
sidebar_position: 0
|
|
3
|
+
title: 生态系统
|
|
3
4
|
---
|
|
4
5
|
|
|
5
|
-
#
|
|
6
|
+
# 生态系统
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
UltraModern.js 建立在一组聚焦的框架与工具之上。这些项目提供了本 fork 使用的 Effect、TanStack Router、构建、文档与 Module Federation 基础能力。
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## 案例
|
|
10
|
+
## 项目
|
|
12
11
|
|
|
13
12
|
import { ShowcaseList } from '@site/src/components/ShowcaseList';
|
|
14
13
|
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
UltraModern.js 提供 BleedingDev create 包来创建 SuperApp workspace,不需要全局安装,直接使用 `pnpm dlx` 按需运行即可。
|
|
2
2
|
|
|
3
3
|
pnpm 支持的命令契约是 scoped package specifier:
|
|
4
|
-
`pnpm dlx @bleedingdev/modern-js-create <target>`。不要简写成
|
|
5
|
-
`pnpm dlx modern-js-create`;npm 上没有这个未加 scope 的包。
|
|
4
|
+
`pnpm dlx @bleedingdev/modern-js-ultramodern-create <target>`。不要简写成
|
|
5
|
+
`pnpm dlx modern-js-ultramodern-create`;npm 上没有这个未加 scope 的包。
|
|
6
6
|
|
|
7
7
|
你可以在当前已有的空目录中初始化项目:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
mkdir myapp && cd myapp
|
|
11
|
-
pnpm dlx @bleedingdev/modern-js-create .
|
|
11
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create .
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
也可以直接用新目录创建项目:
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
pnpm dlx @bleedingdev/modern-js-create myapp
|
|
17
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create myapp
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
使用 workspace 协议依赖初始化(用于在本地 monorepo 中联调未发布的 Modern.js 包):
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
pnpm dlx @bleedingdev/modern-js-create myapp --workspace
|
|
23
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create myapp --workspace
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
BleedingDev create 包会直接创建应用,不再提供问答界面:
|
|
@@ -70,14 +70,14 @@ BleedingDev create 包会直接创建应用,不再提供问答界面:
|
|
|
70
70
|
默认 workspace 从 shell 起步,并安装已发布的 BleedingDev 包别名:
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
|
-
pnpm dlx @bleedingdev/modern-js-create my-super-app
|
|
73
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create my-super-app
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
在已生成的 SuperApp workspace 根目录中,可以就地添加业务
|
|
77
77
|
MicroVertical:
|
|
78
78
|
|
|
79
79
|
```bash
|
|
80
|
-
pnpm dlx @bleedingdev/modern-js-create transportation --vertical
|
|
80
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create transportation --vertical
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
`--vertical` 会修改当前 workspace:新增 vertical 包,并写入 topology、
|
|
@@ -53,7 +53,7 @@ import EnableBFFCaution from "@site-docs/components/enable-bff-caution";
|
|
|
53
53
|
`/effect-client` 之前,请安装精确版本的依赖组:
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
|
-
pnpm add effect@4.0.0-
|
|
56
|
+
pnpm add effect@4.0.0-rc.112 @effect/opentelemetry@4.0.0-rc.112
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
采用精确版本是因为 UltraModern 以锁步依赖组的方式发布 Effect。只使用
|
|
@@ -214,16 +214,16 @@ Effect 版本组。当前 UltraModern 版本组使用:
|
|
|
214
214
|
|
|
215
215
|
```yaml
|
|
216
216
|
trustPolicyExclude:
|
|
217
|
-
- 'effect@4.0.0-
|
|
218
|
-
- '@effect/opentelemetry@4.0.0-
|
|
217
|
+
- 'effect@4.0.0-rc.112'
|
|
218
|
+
- '@effect/opentelemetry@4.0.0-rc.112'
|
|
219
219
|
|
|
220
220
|
overrides:
|
|
221
|
-
'@effect/opentelemetry': 4.0.0-
|
|
222
|
-
'@effect/vitest': 4.0.0-
|
|
223
|
-
effect: 4.0.0-
|
|
221
|
+
'@effect/opentelemetry': 4.0.0-rc.112
|
|
222
|
+
'@effect/vitest': 4.0.0-rc.112
|
|
223
|
+
effect: 4.0.0-rc.112
|
|
224
224
|
```
|
|
225
225
|
|
|
226
|
-
不要在应用包里添加不同版本的直接 `effect` 依赖。Effect
|
|
226
|
+
不要在应用包里添加不同版本的直接 `effect` 依赖。Effect 预发布版本不一致时,Layer 或 HTTP
|
|
227
227
|
middleware 构建可能因为运行时 service 来自不同包实例而失败。严格的 24 小时发布年龄
|
|
228
228
|
门禁适用于实际安装的包;当前版本组没有 Effect 年龄豁免,且仅用于 override 的
|
|
229
229
|
`@effect/vitest` 不是已安装的审批目标。
|
|
@@ -258,11 +258,11 @@ Vercel 是一个面向现代 Web 应用的部署平台,它提供了丰富的
|
|
|
258
258
|
|
|
259
259
|
<img src="https://sf16-sg.tiktokcdn.com/obj/eden-sg/lmeh7nuptpfnuhd/vercel-root-directory.png" />
|
|
260
260
|
|
|
261
|
-
将 Node.js 运行时设置为 `
|
|
261
|
+
将 Node.js 运行时设置为 `26.7.0` 或更高版本:
|
|
262
262
|
|
|
263
263
|
```json title="package.json"
|
|
264
264
|
"engines": {
|
|
265
|
-
"node": "
|
|
265
|
+
"node": ">=26.7.0"
|
|
266
266
|
},
|
|
267
267
|
```
|
|
268
268
|
|
|
@@ -25,7 +25,7 @@ import DebugApp from '@site-docs/components/debug-app';
|
|
|
25
25
|
|
|
26
26
|
## 使用配置
|
|
27
27
|
|
|
28
|
-
通过 `@bleedingdev/modern-js-create` 创建的 UltraModern.js 项目中,会默认生成 `modern.config.ts` 文件。
|
|
28
|
+
通过 `@bleedingdev/modern-js-ultramodern-create` 创建的 UltraModern.js 项目中,会默认生成 `modern.config.ts` 文件。
|
|
29
29
|
|
|
30
30
|
你可以通过该配置文件修改配置,覆盖 Modern.js 的默认行为。例如添加如下配置,开启 SSR:
|
|
31
31
|
|
|
@@ -24,7 +24,7 @@ Modern.js 提供两套一方路由方案:
|
|
|
24
24
|
创建 UltraModern 项目时,默认会包含 TanStack Router:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
pnpm dlx @bleedingdev/modern-js-create myapp
|
|
27
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create myapp
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
Modern.js 支持约定式路由、自控式路由或其他路由方案,请参考 [页面入口](/guides/concept/entries) 进行选择。
|