@rsc-kit/mcp 0.41.0 → 0.42.1

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 +18 -2
  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 -252
  7. package/guides/bap-vs-inertia.md +67 -25
  8. package/guides/blueprints.md +300 -169
  9. package/guides/bun.md +42 -25
  10. package/guides/caching.md +46 -49
  11. package/guides/coming-from-inertia.md +2 -2
  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 -542
  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 +270 -216
  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 +269 -147
  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 -539
  59. package/guides/laravel.md +0 -787
  60. package/guides/your-own-backend.md +0 -602
package/guides/offline.md CHANGED
@@ -2,7 +2,10 @@
2
2
 
3
3
  > Knowing when the server cannot be reached, and carrying on without it.
4
4
 
5
- ```tsx
5
+ `useOffline()` tells a component when the server can't be reached. Show a
6
+ banner with it:
7
+
8
+ ```tsx title="src/components/ConnectionBanner.tsx"
6
9
  'use client'
7
10
 
8
11
  import { useOffline } from '@rsc-kit/core/useOffline'
@@ -16,31 +19,13 @@ export function ConnectionBanner() {
16
19
  }
17
20
  ```
18
21
 
19
- ## What "online" means here
20
-
21
- Whether the **router could reach the server**, as of its last attempt — not
22
- `navigator.onLine`.
23
-
24
- That distinction matters. `navigator.onLine` only tells you the network
25
- interface is up — a laptop on café wifi that needs a login is "online" by that
26
- measure and can reach nothing.
27
-
28
- This reports what the router actually observed on its own requests, which is
29
- what a person means by offline.
22
+ To keep the app working with no network at all, turn on the service worker
23
+ with `rscKit({ offline: true })`.
30
24
 
31
- It follows that the value only changes when something is attempted. A tab
32
- sitting idle with a dead connection reports online until the next navigation,
33
- prefetch or action tries and fails.
25
+ ## Showing that the app is offline
34
26
 
35
- ## On the server
36
-
37
- `useOffline()` returns `false` during a server render, and deliberately: the
38
- server can reach itself. Returning anything else would render an offline state
39
- into the HTML and then mismatch when the browser hydrated and disagreed.
40
-
41
- ## `useOnline`
42
-
43
- The same reading, the other way round, for when that is what the markup wants:
27
+ `useOffline()` is `true` when the router's last request failed to reach the
28
+ server. `useOnline()` is the same reading the other way round:
44
29
 
45
30
  ```tsx
46
31
  'use client';
@@ -52,132 +37,100 @@ export function Status() {
52
37
  }
53
38
  ```
54
39
 
55
- It returns `true` on the server, for the same reason `useOffline()` returns
56
- `false` there. Both read the one store, so they cannot disagree.
40
+ Both read one store, so they never disagree.
41
+
42
+ ### What "offline" means here
43
+
44
+ It is whether the router could reach the server on its last attempt, not
45
+ `navigator.onLine`. A laptop on café wifi that needs a login is "online" to
46
+ `navigator.onLine` and can reach nothing. The router reports what it actually
47
+ saw, which is what a person means by offline.
48
+
49
+ So the value only changes when something is tried. A tab sitting idle on a
50
+ dead connection reports online until the next navigation, prefetch or action
51
+ fails.
52
+
53
+ ### During a server render
54
+
55
+ `useOffline()` returns `false` on the server, and `useOnline()` returns `true`.
56
+ The server can reach itself, and any other answer would render an offline
57
+ state into the HTML that the browser then disagreed with on hydration.
57
58
 
58
59
  ## Working with no network at all
59
60
 
60
- The hooks above report. A service worker is what lets the app keep working,
61
- and it is off by default:
61
+ Turn on the service worker in the plugin options. It is off by default:
62
62
 
63
63
  ```ts title="vite.config.ts"
64
64
  rscKit({ offline: true })
65
65
  ```
66
66
 
67
- The build writes `sw.js` beside the assets and the generated entry registers
68
- it — once the page has loaded, or at once if it already has by the time the
69
- runtime boots. With it on, a page you have visited survives a full reload
70
- with no network at all — not just a navigation, a reload — and comes back
71
- interactive.
67
+ The build writes `sw.js` beside the assets, and the generated entry registers
68
+ it once the page has loaded. With it on, a page you have visited survives a
69
+ full reload with no network, and comes back interactive.
72
70
 
73
- Everything else lives in one page's memory — the pages a boundary keeps
74
- mounted, the prefetch cache. Reload with no network and the browser shows its
75
- own error page: no script runs, so nothing held in JavaScript is reachable.
71
+ Without it, everything lives in one page's memory: the pages a boundary keeps
72
+ mounted, and the prefetch cache. A reload with no network shows the browser's
73
+ own error page, because no script runs. A service worker is the only thing
74
+ that survives that.
76
75
 
77
- A service worker is the only thing that survives that.
78
-
79
- Nothing of it runs in development. A worker is registered per origin, and one
80
- a production run left on `localhost:3000` would otherwise sit in front of the
81
- dev server on the same port — a stored page is cache-first, so a refresh would
82
- bring back yesterday's document and a `504 Outdated Optimize Dep` for each of
83
- its modules. The dev server answers `/sw.js` with a worker that removes the old
84
- one, its caches, and reloads the pages it held; the browser asks for that file
85
- on every navigation, so it happens on the first load.
76
+ The first visit still needs a reload. A worker doesn't control the page that
77
+ registered it, so the first visit caches what it needs, and the *second* is the
78
+ one that survives being offline. That is how service workers work everywhere.
86
79
 
87
80
  ### What is cached, and when
88
81
 
89
82
  | | |
90
83
  | --- | --- |
91
- | what boots the app | at install: the scripts, stylesheets, fonts, manifest and icons, plus `/` and the offline page with the payloads they boot from. Not an image, a wasm module or the share card — those are cached the first time they are used, so an install costs what a first page costs and not a megabyte more |
92
- | any other hashed asset | the first time it is asked for, and from the cache forever after — the name changes when the bytes do |
84
+ | what boots the app | at install: the scripts, stylesheets, fonts, manifest and icons, plus `/` and the offline page with the payloads they boot from |
85
+ | images, wasm, the share card | the first time they are used, so an install costs what a first page costs |
86
+ | any other hashed asset | the first time it is asked for, then from the cache forever — the name changes when the bytes do |
93
87
  | a page you loaded | its document, and the payload it boots from |
94
88
  | a page you reached by link | its payload, and its document fetched once to go with it |
95
89
  | a page you never visited | nothing |
96
90
 
97
- The last two rows are the same mechanism from either end. A hard load fetches a
98
- document and never the payload; a link fetches a payload and never the document.
99
- Either alone is half a page.
100
-
101
- So whichever arrives first fetches the other, **once per url**. A page costs one
102
- extra request the first time you reach it, and none after.
103
-
104
- A url you have never opened cannot be served, and is not faked. An earlier
105
- version answered with the cached root, which put the home page's markup under
106
- the address someone asked for and did not hydrate — a wrong page pretending to
107
- be the right one. It fails now, which is true.
108
-
109
- ### When a deploy changes a stored page
110
-
111
- The worker's version is a hash of everything it serves cache-first: the
112
- precached files and the pages the build stored. A deploy that changes a
113
- stored page is a new worker, which sweeps the old copies. The version used to
114
- cover the file names alone, so a deploy that changed a stored page and no
115
- client script left the worker as it was, and the first load after it showed
116
- the previous build's page from the cache.
91
+ A hard load fetches a document and never the payload; a link fetches a payload
92
+ and never the document. Either alone is half a page, so whichever arrives first
93
+ fetches the other, **once per url**. A page costs one extra request the first
94
+ time you reach it, and none after.
117
95
 
118
- An app that writes the build time into a stored page gets a new worker on
119
- every deploy, because its stored pages really do differ each time.
96
+ A url you have never opened can't be served offline, and isn't faked with
97
+ another page. Add an [offline page](#showing-a-page-when-nothing-can-answer)
98
+ for those.
120
99
 
121
- ### What is deliberately not cached
100
+ ### Keeping private data out of the cache
122
101
 
123
- Anything the server sent with `Cache-Control: no-store`, whatever else it is.
124
-
125
- The Cache API files responses by url and knows nothing about who asked. So a
102
+ Anything the server sent with `Cache-Control: no-store` is never cached. The
103
+ Cache API files responses by url and knows nothing about who asked, so a
126
104
  guarded page, or a [query](/guides/queries/) that read the session, would be
127
- handed to whoever opens the app next on that machine — signed in as someone
128
- else. `no-store` is the server saying so, and the worker obeys it.
105
+ handed to whoever opens the app next on that machine.
129
106
 
130
- This is why a query does **not** work offline by default. Queries answer
131
- `private, no-store` precisely because they may read the session, and widening
132
- that is a decision about who may see the answer:
107
+ That is why a query doesn't work offline by default: queries answer
108
+ `private, no-store`, because they may read the session. Widen one only when
109
+ the answer is the same for everyone:
133
110
 
134
- ```ts
135
- // Cacheable, and offline, because the answer is the same for everyone.
111
+ ```ts title="src/queries/pricing.ts"
112
+ // Cacheable, and offline, because every visitor sees the same tiers.
136
113
  export const getPricing = query(async () => tiers(), { cache: "private", maxAge: 300 })
137
114
  ```
138
115
 
139
- For a personal read you want across reloads, do not widen it — persist your
140
- cache library instead. TanStack's `persistQueryClient` writes to storage that
141
- belongs to that browser, which gets you the same result without putting one
142
- visitor's data somewhere the next one can be served it.
143
-
144
- ### Updating
145
-
146
- The cache name is a hash of what it holds. A build that changed nothing keeps
147
- the same name and leaves a visitor's cache alone; a build that changed anything
148
- gets a new one, and the new worker sweeps the old caches away.
149
-
150
- There is no version to set, and no way to strand someone on a stale worker.
151
-
152
- A new worker takes over as soon as it installs rather than waiting for every
153
- tab to close. That is safe here because assets are addressed by content: a page
154
- already open goes on asking for the names it was built with.
116
+ For a personal read you want across reloads, persist your cache library
117
+ instead of widening the query. TanStack's `persistQueryClient` writes to
118
+ storage that belongs to that browser, so one visitor's data is never served to
119
+ the next.
155
120
 
156
- <Aside type="note" title="The first visit still needs a reload">
157
- A worker does not control the page that registered it. So the first visit
158
- caches what it needs and the *second* is the one that survives being offline.
159
- That is how service workers work everywhere, not something particular here.
121
+ ### While developing
160
122
 
161
- Development is left alone entirely — a worker answering from a cache in front
162
- of the dev server turns every edit into a question about which copy you are
163
- looking at.
164
- </Aside>
165
-
166
- <Aside type="caution" title="It can hide a server that is down">
167
- Serving from a cache asks nothing of the network, so an app can look healthy
168
- while its backend is not. That is the same edge the reveal window has, and it
169
- is what `useOffline()` above is for: with this on, saying so in the interface
170
- stops being a nicety.
171
- </Aside>
172
-
173
- ## When nothing can answer
123
+ Nothing of it runs in development. A worker is registered per origin, and one
124
+ a production run left on `localhost:3000` would sit in front of the dev server
125
+ on the same port and serve yesterday's pages. The dev server answers `/sw.js`
126
+ with a worker that removes the old one and its caches, then reloads the pages
127
+ it held. The browser asks for that file on every navigation, so the cleanup
128
+ happens on the first load.
174
129
 
175
- A reload with no network, on a page the worker has never cached, fails. It does
176
- not fall back to the cached home page — that was tried, and it was worse than
177
- failing: the document *is* the page here, so the visitor got the home page's
178
- markup under the address they asked for, and it did not hydrate.
130
+ ## Showing a page when nothing can answer
179
131
 
180
- Add a route at `/offline` and that page is served instead:
132
+ Add a route at `/offline`. A navigation the worker can't answer, such as a
133
+ page this browser never visited, is served that page instead:
181
134
 
182
135
  ```tsx title="src/app/offline/page.tsx"
183
136
  export default function Offline() {
@@ -190,36 +143,29 @@ export default function Offline() {
190
143
  }
191
144
  ```
192
145
 
193
- Nothing in the file makes it special. It is an ordinary route, and what makes it
194
- the fallback is that the build stored it and the worker precached it. It is also
195
- the one page that can honestly stand in for another, because it is about being
196
- offline rather than about the url it appears under. It stands in for every
197
- navigation nothing can answer — a page the build stored but this browser
198
- never visited included.
146
+ It is an ordinary route. It becomes the fallback because the build stored it
147
+ and the worker precached it.
199
148
 
200
- **It has to be static.** A fallback that renders per request cannot be served
201
- when there is no request to be made, so the build checks and says when it will
202
- not work:
149
+ **It has to be static.** A page rendered per request can't be served with no
150
+ network, so the build checks and says so:
203
151
 
204
152
  ```text
205
153
  [rsc-kit] offline: /offline cannot be the fallback, because it called cookies(),
206
154
  headers(). A fallback has to be servable with no network at all.
207
155
  ```
208
156
 
209
- It is served for navigations only — a payload request answered with a document
210
- would be handed to the Flight decoder, which throws.
211
-
212
- ## When a new version is live
157
+ It is served for navigations only. A payload request answered with a document
158
+ would reach the Flight decoder, which throws.
213
159
 
214
- The worker takes over as soon as it installs rather than waiting for every tab
215
- to close, and taking over sweeps the previous build's cache. A page that has
216
- been open across a deploy is therefore running javascript whose remaining chunks
217
- are gone. It works until it navigates somewhere that needs one.
160
+ ## Telling visitors a new version is live
218
161
 
219
- Only the worker knows this happened, so it says so:
162
+ A new worker takes over as soon as it installs and sweeps the previous build's
163
+ cache. A page left open across a deploy keeps running, but the chunks it hasn't
164
+ loaded yet are gone. `useAppUpdate()` says when that happened:
220
165
 
221
- ```tsx
166
+ ```tsx title="src/components/UpdateBanner.tsx"
222
167
  'use client'
168
+
223
169
  import { useAppUpdate } from '@rsc-kit/core/useAppUpdate'
224
170
 
225
171
  export function UpdateBanner() {
@@ -231,22 +177,41 @@ export function UpdateBanner() {
231
177
  }
232
178
  ```
233
179
 
234
- Reported rather than acted on. Reloading out from under someone mid-form is
235
- worse than the staleness it fixes, so this package will not do it for you.
236
-
237
- What it does do is stop navigating as if nothing had changed. Once the
238
- worker has said a newer build is live, the next navigation is a document
239
- load, from the new build — the page's own javascript cannot load what the
240
- new build's payloads name. And whether or not a worker said anything, every
241
- document says which build it is, the client says it back on every
242
- navigation, and a server on another build answers `409` and the client
243
- loads the document. Under a worker that is not a window of seconds: the
244
- worker serves the previous build's document first, from its cache, while
245
- the new one installs, so it is every returning visitor's first navigation
246
- after a deploy — and without this it ended on the route's error boundary
247
- with "client reference not found".
248
-
249
- ## Going further
180
+ Put it in the root layout beside the connection banner. The reload is left to
181
+ the visitor, because reloading out from under someone mid-form is worse than
182
+ the staleness it fixes.
183
+
184
+ You don't need it for navigation to keep working. Once the worker has said a
185
+ newer build is live, the next navigation is a document load from the new build.
186
+
187
+ ## How it works
188
+
189
+ - **Versions.** The worker's version is a hash of everything it serves
190
+ cache-first: the precached files and the pages the build stored. A build that
191
+ changed nothing keeps the same version and leaves a visitor's cache alone. A
192
+ build that changed anything, a stored page included, is a new worker, which
193
+ sweeps the old caches. There is no version to set, and no way to strand
194
+ someone on a stale worker. An app that writes the build time into a stored
195
+ page gets a new worker on every deploy, because its pages really differ.
196
+ - **Taking over at once.** A new worker doesn't wait for every tab to close.
197
+ That is safe because assets are addressed by content: a page already open
198
+ goes on asking for the names it was built with.
199
+ - **A page from the previous build.** Every document says which build it is,
200
+ and the client says it back on every navigation. A server on another build
201
+ answers `409`, and the client loads the document instead. Under a worker this
202
+ is every returning visitor's first navigation after a deploy, because the
203
+ worker serves the previous build's document from its cache while the new one
204
+ installs. Without it, that navigation ended on the route's error boundary
205
+ with "client reference not found".
206
+ - **Why there is no fallback to `/`.** Answering an unknown url with the cached
207
+ home page was tried. The document *is* the page here, so the visitor got the
208
+ home page's markup under the address they asked for, and it didn't hydrate.
209
+
210
+ <Aside type="caution" title="It can hide a server that is down">
211
+ Serving from a cache asks nothing of the network, so an app can look healthy
212
+ while its backend is not. With the worker on, show `useOffline()` in the
213
+ interface.
214
+ </Aside>
250
215
 
251
216
  Installing, push notifications and background sync are in
252
217
  [Progressive web apps](/guides/pwa/).
package/guides/openapi.md CHANGED
@@ -3,9 +3,21 @@
3
3
  > A document derived from your route.ts files, and Scalar's page over it.
4
4
 
5
5
  Every `route.ts` already says what an OpenAPI operation needs: the methods it
6
- exports, and the `params`, `searchParams` and `body` schemas beside them. So
7
- the document is derived, not written — the way Elysia derives its from the
8
- schemas on its routes — and it cannot go stale.
6
+ exports, and the `params`, `searchParams` and `body` schemas beside them. Turn
7
+ the document on, and it is derived from your routes, so it can't go stale:
8
+
9
+ ```ts title="vite.config.ts"
10
+ rscKit({
11
+ openapi: true,
12
+ })
13
+ ```
14
+
15
+ The document answers at `/openapi.json`.
16
+
17
+ ## Describing the API
18
+
19
+ What no route can say — the title, where the API is served, how a caller
20
+ authenticates — goes in the plugin option:
9
21
 
10
22
  ```ts title="vite.config.ts"
11
23
  rscKit({
@@ -18,9 +30,14 @@ rscKit({
18
30
  })
19
31
  ```
20
32
 
21
- `openapi: true` is the same with defaults. The document answers at
22
- `/openapi.json` (`path` moves it), as an api route the build stores, without
23
- middleware — a document exists to be read.
33
+ `openapi: true` is the same with defaults. `path` moves the document:
34
+
35
+ ```ts
36
+ rscKit({ openapi: { path: '/api/openapi.json' } })
37
+ ```
38
+
39
+ It is an api route the build stores, and it runs without middleware: a
40
+ document exists to be read.
24
41
 
25
42
  ## What a route contributes
26
43
 
@@ -53,23 +70,68 @@ export async function PATCH(request: Request, { params, body }: RouteContext<typ
53
70
  | `export const openapi` | anything else an operation may say — `summary`, `description`, `tags`, `responses` — shared, or per method under `GET`/`POST`/… |
54
71
 
55
72
  A schema contributes by describing itself as JSON Schema (Standard JSON
56
- Schema): Zod 4 and ArkType do; Valibot needs its own converter and
57
- contributes nothing yet. Response bodies are what a route declares in
58
- `openapi.responses` — a handler returns `Response`, so nothing else knows the
59
- shape — until a typed response helper carries it.
73
+ Schema). Zod 4 and ArkType do. Valibot needs its own converter and
74
+ contributes nothing yet.
60
75
 
61
- `export const openapi = false` leaves a route out: the page that renders the
62
- document, a webhook meant for one caller. `{ DELETE: false }` leaves one
63
- method out. An app whose routes are mostly webhooks turns the default
64
- around with `rscKit({ openapi: { include: 'declared' } })`: only a route
65
- that exports `openapi` is documented, and a callback needs no line. `HEAD` and `OPTIONS` are never documented — the engine answers
66
- them for every route, and a file exporting `OPTIONS` for a CORS preflight is
67
- not describing an operation.
76
+ ## Describing a response
68
77
 
69
- ## The page
78
+ A handler returns a `Response`, so nothing else knows the shape. Declare it in
79
+ `openapi.responses`:
80
+
81
+ ```ts title="src/app/api/orders/[id]/route.ts"
82
+ export const openapi = {
83
+ GET: {
84
+ summary: 'Read an order',
85
+ responses: {
86
+ 200: {
87
+ description: 'The order',
88
+ content: {
89
+ 'application/json': {
90
+ schema: {
91
+ type: 'object',
92
+ properties: { id: { type: 'integer' }, title: { type: 'string' } },
93
+ },
94
+ },
95
+ },
96
+ },
97
+ 404: { description: 'No such order' },
98
+ },
99
+ },
100
+ }
101
+ ```
102
+
103
+ ## Leaving a route out
104
+
105
+ ```ts title="src/app/api/webhooks/stripe/route.ts"
106
+ export const openapi = false
107
+ ```
108
+
109
+ `false` leaves the whole route out: the page that renders the document, a
110
+ webhook meant for one caller. `{ DELETE: false }` leaves one method out:
111
+
112
+ ```ts
113
+ export const openapi = { DELETE: false }
114
+ ```
115
+
116
+ `HEAD` and `OPTIONS` are never documented. The engine answers them for every
117
+ route, and a file exporting `OPTIONS` for a CORS preflight isn't describing an
118
+ operation.
119
+
120
+ ### Documenting only some routes
121
+
122
+ An app whose routes are mostly webhooks turns the default around:
123
+
124
+ ```ts title="vite.config.ts"
125
+ rscKit({ openapi: { include: 'declared' } })
126
+ ```
127
+
128
+ Only a route that exports `openapi` is documented, and a callback needs no
129
+ line.
130
+
131
+ ## Showing a reference page
70
132
 
71
133
  Scalar's API Reference renders from a single function, so the page is one
72
- file and none of it is ours:
134
+ file:
73
135
 
74
136
  ```sh
75
137
  bun add @scalar/client-side-rendering
@@ -85,24 +147,27 @@ export const GET = () =>
85
147
  export const openapi = false
86
148
  ```
87
149
 
88
- Not `@scalar/nextjs-api-reference`: it is this same call plus a theme, and it
89
- names `next` as a peer dependency, which npm, pnpm and bun install for you, so
90
- the app gains a copy of Next.js it never runs. `renderApiReference` takes the
91
- rest of Scalar's options too: `pageTitle`, `cdn` to pin a version, and
92
- `nonce` for a strict content security policy.
150
+ `renderApiReference` takes the rest of Scalar's options too: `pageTitle`,
151
+ `cdn` to pin a version, and `nonce` for a strict
152
+ [content security policy](/guides/content-security-policy).
153
+
154
+ The page is stored at build, like any route that reads nothing per request.
155
+ Scalar is the app's dependency, at the app's version; the engine ships no UI
156
+ and no dependency for it.
93
157
 
94
- Stored at build like any route that reads nothing per request. Scalar's
95
- package is the app's dependency and the app's version; the engine ships no
96
- UI and no dependency for it, whether or not the document is on.
158
+ Use `@scalar/client-side-rendering`, not `@scalar/nextjs-api-reference`. The
159
+ Next.js package is this same call plus a theme, and it names `next` as a peer
160
+ dependency, which npm, pnpm and bun install for you, so the app gains a copy
161
+ of Next.js it never runs.
97
162
 
98
163
  ## Coming from a hand-written spec
99
164
 
100
- A spec kept in a file has three parts, and two of them move:
165
+ A spec kept in a file has three parts, and each moves:
101
166
 
102
- - the `paths` — delete them; they are the routes and their schemas now, and
103
- the same `body` schema validates the request at runtime, which the
104
- hand-written spec never did
105
- - `info`, `servers`, `security`, `components.securitySchemes` — into
106
- `rscKit({ openapi })`
107
- - a route's `summary`, `tags` and response shapes — into its
108
- `export const openapi`
167
+ - **the `paths`**: delete them. They are the routes and their schemas now,
168
+ and the same `body` schema validates the request at runtime, which the
169
+ hand-written spec never did.
170
+ - **`info`, `servers`, `security`, `components.securitySchemes`**: into
171
+ `rscKit({ openapi })`.
172
+ - **a route's `summary`, `tags` and response shapes**: into its
173
+ `export const openapi`.