@rsc-kit/mcp 0.40.0 → 0.42.0

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 (60) hide show
  1. package/dist/recipes.js +37 -20
  2. package/dist/recipes.js.map +1 -1
  3. package/guides/admin-plugins.md +206 -6
  4. package/guides/api-routes.md +159 -215
  5. package/guides/authorization.md +103 -114
  6. package/guides/backend-answered-pages.md +301 -250
  7. package/guides/bap-vs-inertia.md +67 -25
  8. package/guides/blueprints.md +307 -174
  9. package/guides/bun.md +42 -25
  10. package/guides/caching.md +46 -49
  11. package/guides/coming-from-inertia.md +5 -5
  12. package/guides/commands.md +251 -200
  13. package/guides/connection.md +50 -54
  14. package/guides/content-security-policy.md +133 -84
  15. package/guides/domains.md +190 -149
  16. package/guides/edge-caching.md +242 -268
  17. package/guides/emails.md +96 -45
  18. package/guides/errors.md +116 -137
  19. package/guides/feature-flags.md +100 -30
  20. package/guides/file-uploads.md +101 -26
  21. package/guides/fonts.md +139 -110
  22. package/guides/forms.md +520 -538
  23. package/guides/images.md +87 -28
  24. package/guides/index.json +13 -33
  25. package/guides/instrumentation.md +134 -95
  26. package/guides/isr.md +3 -3
  27. package/guides/live-data-in-production.md +695 -0
  28. package/guides/live-data.md +170 -839
  29. package/guides/mcp.md +83 -59
  30. package/guides/metadata.md +124 -179
  31. package/guides/navigation.md +118 -147
  32. package/guides/no-javascript.md +49 -57
  33. package/guides/offline.md +118 -153
  34. package/guides/openapi.md +100 -35
  35. package/guides/pages.md +160 -50
  36. package/guides/ppr.md +178 -256
  37. package/guides/pwa.md +251 -218
  38. package/guides/queries.md +171 -300
  39. package/guides/react-compiler.md +90 -50
  40. package/guides/redirects.md +141 -177
  41. package/guides/response-headers.md +76 -74
  42. package/guides/route-interception.md +112 -111
  43. package/guides/routing.md +216 -322
  44. package/guides/sections.md +63 -66
  45. package/guides/seo-files.md +127 -65
  46. package/guides/server-actions.md +285 -357
  47. package/guides/static-generation.md +131 -199
  48. package/guides/testing.md +272 -150
  49. package/guides/third-party-scripts.md +94 -47
  50. package/guides/typed-routes.md +115 -113
  51. package/guides/url-validation.md +113 -61
  52. package/guides/validation.md +53 -62
  53. package/guides/view-transitions.md +159 -132
  54. package/guides/where-it-runs.md +226 -162
  55. package/package.json +2 -2
  56. package/guides/admin.md +0 -520
  57. package/guides/deployment.md +0 -598
  58. package/guides/go.md +0 -538
  59. package/guides/laravel.md +0 -786
  60. package/guides/your-own-backend.md +0 -587
package/guides/domains.md CHANGED
@@ -2,66 +2,34 @@
2
2
 
3
3
  > A host as a route segment — admin.example.com reaches app/admin, a tenant's host binds [domain] — with nothing to rewrite.
4
4
 
5
- Next routes a subdomain with a `middleware.ts` that rewrites
6
- `acme.example.com/settings` to `/acme/settings` before matching, and the
7
- route tree never learns a host was involved. Here the same rule is the
8
- router's own, so the build can see it: typed routes, one stored page per
9
- tenant, and no middleware to write.
10
-
11
- ## The rule
12
-
13
- A request from a host that is not the site's own is matched **with the host
14
- in front of the path**:
15
-
16
- | request | matched as | file |
17
- | --- | --- | --- |
18
- | `example.com/admin` | `/admin` | `app/admin/page.tsx` |
19
- | `admin.example.com/` | `/admin` | `app/admin/page.tsx` — the same file |
20
- | `acme.example.com/settings` | `/acme/settings` | `app/[domain]/settings/page.tsx`, `domain: "acme"` |
21
- | `acme.com/settings` | `/acme.com/settings` | the same file, `domain: "acme.com"` |
22
-
23
- A subdomain of the site contributes its label; any other host contributes the
24
- whole host. The site's own hosts — the one in the root layout's
25
- `metadataBase`, `www.` of it, and any named in `rscKit({ hosts })` — contribute
26
- nothing, so the apex keeps path routing and an app adds tenants without moving
27
- a file. `localhost` and an ip address are always the site's own.
28
-
29
- Listing a subdomain in `hosts` makes it the site by path instead of a tenant —
30
- the "app on `app.example.com`, marketing on the apex" split — which is a
31
- choice, not a requirement.
32
-
33
- And only when a route could answer it: a `[domain]` (or `[host]`) directory at
34
- the top of `app/`, or a directory named for the host. Any other parameter
35
- name at the top of `app/` — `[collection]`, `[slug]` — is a path segment, as
36
- it is in Next. An app with no tenant tree routes every host by path, and a proxy that forwards to the app by an internal name is not
37
- read as a tenant called `internal`.
38
-
39
- A subdomain of the site with no directory of its name falls back the same
40
- way: with no `app/merchant/`, `merchant.example.com/` serves the home page.
41
- That keeps a preview deployment under the production domain working. The dev
42
- server says so once per host, naming the directory to add:
5
+ A subdomain is a folder. Name the site's own host once, and
6
+ `admin.example.com` is served by `app/admin/`, the same pages as
7
+ `example.com/admin`:
43
8
 
9
+ ```ts title="vite.config.ts"
10
+ rscKit({ hosts: ['example.com'] })
44
11
  ```
45
- [rsc-kit] merchant.example.test has no app/merchant/ - served by path, as the site's own. Add app/merchant/ to route the subdomain there.
12
+
13
+ ```text
14
+ src/app/
15
+ page.tsx example.com/
16
+ admin/
17
+ page.tsx admin.example.com/ and example.com/admin
18
+ [domain]/
19
+ settings/
20
+ page.tsx acme.example.com/settings, acme.com/settings
46
21
  ```
47
22
 
48
- The visitor's url is untouched: `acme.example.com/settings` stays in the
49
- address bar, and a link to `/billing` on that page goes to
50
- `acme.example.com/billing`. Only the match changed.
23
+ There is no middleware to write and no rewrite. The router matches the host
24
+ itself, so typed links, stored pages and the build all see it.
51
25
 
52
- ## The one step: name the site's host
26
+ ## Naming the site's host
53
27
 
54
- The router has to know which host is the site, and it learns it from either
55
- the root layout's `metadataBase` or `rscKit({ hosts })` — one is enough, and
56
- neither is needed for anything else here. Name neither and no host is the
57
- site's: `merchant.example.com` is then a foreign host whose segment is the
58
- whole name, no directory matches it, and it is served by path — the home page,
59
- with nothing said.
28
+ The router has to know which host is the site. It learns it from
29
+ `rscKit({ hosts })` or from the root layout's `metadataBase`. One is enough.
60
30
 
61
- `hosts` is the one to reach for when the address is in the environment, as a
62
- Laravel app's is in `APP_URL`. It is read by the build, so the address of the
63
- machine running it — `example.test` under Herd, the real domain in
64
- production — is the one named:
31
+ When the address is in the environment, as a Laravel app's is in `APP_URL`,
32
+ read it in the Vite config:
65
33
 
66
34
  ```ts title="vite.config.ts"
67
35
  import { defineConfig, loadEnv } from 'vite'
@@ -75,27 +43,80 @@ export default defineConfig(({ mode }) => {
75
43
  })
76
44
  ```
77
45
 
78
- `metadataBase` does the same when it is written as a literal, but it is for
79
- metadata — the base a relative Open Graph image or canonical url is made
80
- absolute against — and a computed one is not read for routing. An app with no
81
- such metadata needs none.
46
+ The build reads it, so the address of the machine running it is the one named:
47
+ `example.test` under Herd, the real domain in production.
82
48
 
83
- `hosts` also takes a name that is neither the apex nor a subdomain of it and
84
- is still the site rather than a tenant — a staging or internal name, or a
85
- second brand domain:
49
+ `hosts` also takes names that are the site rather than a tenant: a staging or
50
+ internal name, or a second brand domain:
86
51
 
87
52
  ```ts title="vite.config.ts"
88
- rscKit({ hosts: ['app.internal', 'example.co.uk'] })
53
+ rscKit({ hosts: ['example.com', 'app.internal', 'example.co.uk'] })
54
+ ```
55
+
56
+ A literal `metadataBase` works too, but a computed one isn't read for routing.
57
+ It's meant for metadata: the base a relative Open Graph image or canonical URL
58
+ is made absolute against.
59
+
60
+ If you name neither, no host is the site's. `merchant.example.com` is then a
61
+ foreign host, no folder matches it, and it is served by path: the home page,
62
+ with nothing said.
63
+
64
+ ## Serving a subdomain from a folder
65
+
66
+ Add a folder named for the subdomain:
67
+
68
+ ```text
69
+ src/app/
70
+ merchant/
71
+ page.tsx merchant.example.com/
72
+ orders/
73
+ page.tsx merchant.example.com/orders
74
+ ```
75
+
76
+ A request from a host that isn't the site's own is matched with the host in
77
+ front of the path:
78
+
79
+ | Request | Matched as | File |
80
+ | --- | --- | --- |
81
+ | `example.com/admin` | `/admin` | `app/admin/page.tsx` |
82
+ | `admin.example.com/` | `/admin` | `app/admin/page.tsx`, the same file |
83
+ | `acme.example.com/settings` | `/acme/settings` | `app/[domain]/settings/page.tsx`, `domain: "acme"` |
84
+ | `acme.com/settings` | `/acme.com/settings` | the same file, `domain: "acme.com"` |
85
+
86
+ - A subdomain of the site adds its label. Any other host adds the whole host.
87
+ - The site's own hosts add nothing, so the apex keeps routing by path. They
88
+ are the one in `metadataBase`, `www.` of it, and any named in `hosts`.
89
+ - `localhost` and an IP address are always the site's own.
90
+ - Listing a subdomain in `hosts` makes it the site, routed by path, rather than
91
+ a tenant. That's the "app on `app.example.com`, marketing on the apex" split.
92
+
93
+ The visitor's URL doesn't change. `acme.example.com/settings` stays in the
94
+ address bar, and a link to `/billing` on that page goes to
95
+ `acme.example.com/billing`. Only the match changed.
96
+
97
+ ### A subdomain with no folder
98
+
99
+ A subdomain of the site with no folder of its name is served by path, so
100
+ `merchant.example.com/` with no `app/merchant/` serves the home page. That
101
+ keeps a preview deployment under the production domain working. The dev server
102
+ says so once per host, naming the folder to add:
103
+
104
+ ```
105
+ [rsc-kit] merchant.example.test has no app/merchant/ - served by path, as the site's own. Add app/merchant/ to route the subdomain there.
89
106
  ```
90
107
 
91
- A directory then does the rest: `app/merchant/` is all `merchant.example.com`
92
- needs.
108
+ Host routing only applies when a route could answer it: a `[domain]` (or
109
+ `[host]`) folder at the top of `app/`, or a folder named for the host. Any
110
+ other parameter at the top of `app/`, such as `[collection]` or `[slug]`, is a
111
+ path segment. An app with no tenant tree routes every host by path, so a proxy
112
+ that forwards to the app by an internal name isn't read as a tenant called
113
+ `internal`.
93
114
 
94
- ## A tenant tree
115
+ ## Serving tenants from `[domain]`
95
116
 
96
- Whether the tenant exists is a guard, so it goes in `middleware.ts`. It runs
97
- before anything is sent, on every path, and its `notFound()` is a real 404.
98
- Its argument is the route's params:
117
+ A `[domain]` folder at the top of `app/` receives the tenant's host. Check that
118
+ the tenant exists in `middleware.ts`. It runs before anything is sent, on every
119
+ path, and its `notFound()` is a real 404. Its argument is the route's params:
99
120
 
100
121
  ```ts title="src/app/[domain]/middleware.ts"
101
122
  import { notFound } from '@rsc-kit/core/not-found';
@@ -106,10 +127,23 @@ export default async function knownTenant({ domain }) {
106
127
  }
107
128
  ```
108
129
 
109
- The layout is handed the same params, as a promise. A route that lists no
110
- urls is stored as one shell for every tenant, so what reads the tenant goes
111
- under `<Suspense>`; awaited above every boundary, there is no value to store
112
- the shell with, and the build says so and names the layout:
130
+ A page reads the tenant from `params`:
131
+
132
+ ```tsx title="src/app/[domain]/settings/page.tsx"
133
+ import { tenantByDomain } from '@/lib/tenants';
134
+
135
+ export default async function SettingsPage({ params }) {
136
+ const { domain } = await params;
137
+ const tenant = await tenantByDomain(domain);
138
+
139
+ return <h1>{tenant!.name} settings</h1>;
140
+ }
141
+ ```
142
+
143
+ The layout gets the same params, as a promise. A route that lists no URLs is
144
+ stored as one shell for every tenant, so put the part that reads the tenant
145
+ under `<Suspense>`. Awaited above every boundary, there's no value to store the
146
+ shell with, and the build says so and names the layout:
113
147
 
114
148
  ```tsx title="src/app/[domain]/layout.tsx"
115
149
  import { Suspense } from 'react';
@@ -135,33 +169,28 @@ export default function TenantLayout({ params, children }) {
135
169
  }
136
170
  ```
137
171
 
138
- A layout sees its own segments' params and those above it, never a deeper
139
- one's, and it is rendered again when one of its own values changes:
140
- `acme.example.com/settings` to `globex.example.com/settings` renders the
141
- tenant layout for globex, while the root layout above it stays mounted.
172
+ `[domain]` is an ordinary dynamic segment otherwise:
142
173
 
143
- `[domain]` is an ordinary dynamic segment: `params.domain` in every page and
144
- layout below it, `hostUrl(domain, '/settings')` to link to it (below), `loading.tsx`
145
- and `error.tsx` where you put them. A directory named for a host,
146
- `app/admin/`, wins over `[domain]` the way a static segment wins over a
147
- parameter anywhere else.
174
+ - `params.domain` is in every page and layout below it, and `error.tsx` and
175
+ `loading.tsx` work where you put them.
176
+ - A layout is rendered again when one of its own values changes.
177
+ `acme.example.com/settings` to `globex.example.com/settings` renders the
178
+ tenant layout for globex, and the root layout above it stays mounted.
179
+ - A folder named for a host, such as `app/admin/`, wins over `[domain]`, the
180
+ way a static segment wins over a parameter anywhere else.
148
181
 
149
- One difference from a parameter deeper in the tree: a `[domain]` at the top
150
- of `app/` binds **only from a host**, never from a path. `example.com/nope`
151
- is a 404, not a tenant called `nope`, and `acme.example.com/` cannot be
152
- reached as `example.com/acme`. Next has no such guard — its `[domain]` folder
153
- matches any path once the rewrite is in place — which is why Next apps tuck
154
- the tenant tree under a route group.
182
+ One difference: a `[domain]` at the top of `app/` binds **only from a host**,
183
+ never from a path. `example.com/nope` is a 404, not a tenant called `nope`, and
184
+ `acme.example.com/` can't be reached as `example.com/acme`.
155
185
 
156
186
  ## Linking to another host
157
187
 
158
- A typed `href` is a folder path: `/merchant/orders` is the page at
159
- `app/merchant/orders`, and that is the url a link to it goes to — the site,
160
- by path. Both addresses work, so nothing breaks; but when the page is meant
161
- to be seen on `merchant.example.com`, say so with `hostUrl`:
188
+ A typed `href` is a folder path, so `/merchant/orders` links to the site by
189
+ path. Both addresses work. When the page is meant to be seen on its subdomain,
190
+ link with `hostUrl`:
162
191
 
163
192
  ```tsx title="src/app/page.tsx"
164
- import { Link } from '@rsc-kit/core/link';
193
+ import Link from '@rsc-kit/core/Link';
165
194
  import { hostUrl } from '@rsc-kit/core/routes';
166
195
 
167
196
  <Link href={hostUrl('merchant', '/orders')}>Orders</Link> // //merchant.example.com/orders
@@ -171,65 +200,72 @@ import { hostUrl } from '@rsc-kit/core/routes';
171
200
  ```
172
201
 
173
202
  - The first argument autocompletes to the top-level folders of `app/`, and
174
- takes any other string too: a tenant's subdomain, read from the database
175
- at request time. A name with a dot is a whole domain, used as written.
203
+ takes any other string too, such as a tenant's subdomain read from the
204
+ database. A name with a dot is a whole domain, used as written.
176
205
  - The path is typed by what that host answers. For a folder it is the pages
177
- under it, with the folder taken off — `hostUrl('merchant', '/orders')`, not
206
+ under it, with the folder taken off: `hostUrl('merchant', '/orders')`, not
178
207
  `'/merchant/orders'`. For any other name it is the tenant tree's paths.
179
208
  - With one argument it is the site itself: the link back from a subdomain,
180
209
  where a plain `/pricing` would stay on the subdomain.
181
210
 
182
- The site's host is the first one `rscKit({ hosts })` names (a literal
183
- `metadataBase` otherwise), port and all, so `hosts: [new URL(env.APP_URL).host]`
184
- gives `merchant.example.test` under Herd and `merchant.example.com` in
185
- production. With no host named, a folder's url is its path,
186
- `/merchant/orders`, since every page is then reached by path.
211
+ It works in `visit()` and `redirect()` too:
187
212
 
188
- It is the same string on the server and in the browser, so the link hydrates
189
- as it was rendered, and it works in `visit()` and `redirect()` too. On the
190
- host it names already, Link navigates without a reload; to another host it is
191
- a full page load, as a link to another origin always is.
213
+ ```ts
214
+ redirect(hostUrl(tenant.slug, '/welcome'));
215
+ ```
216
+
217
+ The site's host is the first one `hosts` names (or a literal `metadataBase`),
218
+ port included. So `hosts: [new URL(env.APP_URL).host]` gives
219
+ `merchant.example.test` under Herd and `merchant.example.com` in production.
220
+ With no host named, a folder's URL is its path, `/merchant/orders`.
192
221
 
193
- Nothing redirects between the two addresses unless you name the folder, below.
222
+ The URL is the same string on the server and in the browser, so the link
223
+ hydrates as it was rendered. On the host it already names, `Link` navigates
224
+ without a reload. To another host it is a full page load, as any link to
225
+ another origin is.
194
226
 
195
- ## A folder that lives on its subdomain
227
+ ## Keeping a folder on its subdomain only
196
228
 
197
- When a folder is only ever meant to be seen on its subdomain - a merchant
198
- dashboard, an admin - name it, and its subdomain becomes the page's only url:
229
+ When a folder is only ever meant to be seen on its subdomain, such as a
230
+ merchant dashboard or an admin, name it in `subdomains`. Its subdomain becomes
231
+ the page's only URL:
199
232
 
200
233
  ```ts title="vite.config.ts"
201
234
  rscKit({ hosts: [new URL(env.APP_URL).host], subdomains: ['merchant'] })
202
235
  ```
203
236
 
204
237
  - `example.com/merchant/orders` answers 301 to `merchant.example.com/orders`,
205
- query kept. Only on the site's own host: on `localhost`, an address, a
206
- preview or a platform's own name (`<app>.homeport.run`) the path form still
207
- renders and links keep it, since there is no subdomain of those to go to.
238
+ with the query kept.
208
239
  - `<Link href="/merchant/orders">`, `visit('/merchant/orders')` and
209
- `redirect('/merchant/orders')` go to `merchant.example.com/orders`: the typed
210
- href stays the folder path, and the host is placed for you. No `hostUrl`.
211
- - On the subdomain, a root path that is not under the folder is the site's:
240
+ `redirect('/merchant/orders')` go to `merchant.example.com/orders`. The typed
241
+ href stays the folder path, and the host is added for you, with no `hostUrl`.
242
+ - On the subdomain, a root path that isn't under the folder is the site's:
212
243
  `<Link href="/pricing">` goes to `example.com/pricing`.
213
- - `edge.json` lists none of the folder's pages: an edge answers by path and
214
- would skip the 301. A `backendPaths` entry under the folder stops the build -
215
- visitors there send `/auth`, never `/merchant/auth`.
216
- - The build's route table lists the folder, so a backend that names routes
217
- puts them on the subdomain - Laravel's `route('merchant.orders')` is
244
+ - The build's route table lists the folder, so a backend that names routes puts
245
+ them on the subdomain. Laravel's `route('merchant.orders')` is
218
246
  `https://merchant.example.com/orders`.
219
247
 
220
- The trade is that `example.com/merchant` is no longer a page of the site: it
221
- is the subdomain's home page. A landing page about merchants goes in a folder
222
- of its own, such as `app/sell/`. It needs the site's host (`hosts`) and a
223
- folder of that name, or dev and the build stop and say which. `hostUrl` is
224
- still how you link to a tenant or a custom domain, and still works for a
225
- named folder.
248
+ The redirect and the links only apply on the site's own host. On `localhost`,
249
+ an IP address, a preview or a platform's own name (`<app>.homeport.run`), the
250
+ path form still renders and links keep it, since there is no subdomain of
251
+ those to go to.
252
+
253
+ `example.com/merchant` is then no longer a page of the site: it is the
254
+ subdomain's home page. Put a landing page about merchants in a folder of its
255
+ own, such as `app/sell/`. `subdomains` needs the site's host (`hosts`) and a
256
+ folder of that name, or dev and the build stop and say which is missing.
257
+
258
+ Two things the build enforces:
226
259
 
227
- ## Domains in a database
260
+ - `edge.json` lists none of the folder's pages. An edge answers by path and
261
+ would skip the 301.
262
+ - A `backendPaths` entry under the folder stops the build, because visitors
263
+ there send `/auth`, never `/merchant/auth`.
228
264
 
229
- `generateStaticParams` on the tenant route is the hook. The listed hosts are
230
- rendered at build and stored, one file per host; a host added afterwards
231
- falls through to the plain tree, or — if the page reads the request — renders
232
- on demand and resolves at request time:
265
+ ## Building a page per tenant
266
+
267
+ List the tenants in `generateStaticParams` on the tenant route. Each listed
268
+ host is rendered at build and stored, one file per host:
233
269
 
234
270
  ```ts title="src/app/[domain]/page.tsx"
235
271
  export async function generateStaticParams() {
@@ -239,41 +275,46 @@ export async function generateStaticParams() {
239
275
  }
240
276
  ```
241
277
 
242
- A tenant's page that reads `cookies()` or awaits `connection()` is dynamic
243
- for that tenant and stored for none, exactly as any page is.
278
+ A host added later falls through to the plain tree or, if the page reads the
279
+ request, renders on demand. A tenant's page that reads `cookies()` or awaits
280
+ `connection()` is dynamic for that tenant and stored for none, like any page.
281
+
282
+ ## Trying it locally
244
283
 
245
- ## Locally
284
+ `localhost` and an IP address are always the site's own, so a dev server
285
+ opened on one routes by path as usual. A local name such as `example.test`
286
+ under Herd or Valet is a host like any other: `merchant.example.test` reaches
287
+ `app/merchant/` only when `example.test` is named in `hosts`. Reading
288
+ `APP_URL`, as above, does that. A `metadataBase` fixed to the production host
289
+ names only that one.
246
290
 
247
- `localhost` and an ip address are always the site's own, so a dev server
248
- opened on one routes by path as it always did. A local name is not:
249
- `example.test` under Herd or Valet is a host like any other, and
250
- `merchant.example.test` reaches `app/merchant/` only when `example.test` is
251
- named in `hosts` — which reading `APP_URL`, as above, does. A `metadataBase`
252
- fixed to the production host names only that one. To try a tenant
253
- without DNS, send the host the router will see in production:
291
+ To try a tenant without DNS, send the host the router will see in production:
254
292
 
255
293
  ```bash
256
294
  curl -H 'X-Forwarded-Host: acme.example.com' http://localhost:3000/
257
295
  ```
258
296
 
259
- Or point `acme.example.com` at `127.0.0.1` in `/etc/hosts` and open it on
260
- the dev server's port in a browser.
297
+ Or point `acme.example.com` at `127.0.0.1` in `/etc/hosts` and open it on the
298
+ dev server's port.
261
299
 
262
300
  ## Behind a proxy
263
301
 
264
302
  The host is read from `X-Forwarded-Host` first, then `Host`. A load balancer
265
- that terminates TLS and forwards to the app by an internal name still routes
266
- by the name the visitor typed.
303
+ that terminates TLS and forwards to the app by an internal name still routes by
304
+ the name the visitor typed.
267
305
 
268
- ## Not for a static export
306
+ ## Static exports
269
307
 
270
308
  An export is served by a file server, which sees no host. Host routing is a
271
- server feature; an exported site is the site's own on every host it is
309
+ server feature, so an exported site is the site's own on every host it is
272
310
  served from.
273
311
 
274
312
  ## Coming from Next
275
313
 
276
- Delete the rewrite in `middleware.ts` and the `[domain]` directory works as
277
- it did; the segment binds the same value the rewrite put there. Next's
278
- `rewrite()` for anything else is not here — a host maps to a tree by file,
279
- not by code.
314
+ Next routes a subdomain with a `middleware.ts` that rewrites
315
+ `acme.example.com/settings` to `/acme/settings`. Delete that rewrite, and the
316
+ `[domain]` folder works as it did: the segment binds the same value. Next's
317
+ `[domain]` folder also matches any path once the rewrite is in place, which is
318
+ why Next apps tuck the tenant tree under a route group. Here it binds only from
319
+ a host, so it doesn't need one. Next's `rewrite()` for anything else isn't
320
+ here: a host maps to a tree by file, not by code.