This PR fixes a tiny grammar mistake on the [**How to set up Vitest with
Next.js**](https://nextjs.org/docs/app/guides/testing/vitest) page:
Before | After
--- | ---
[...] we recommend using an **E2E tests** for `async` components. |
[...] we recommend using **E2E tests** for `async` components.
The article "an" should not be used before a plural noun.
### Why?
Our docs mention the `'use client'` directive to "designate a Client Component," but this can easily lead to misunderstanding that the users need to mark the directive to write a Client Component. This chains to ambiguity on the concept that the entry point Client Components' props must be serializable.
It is essential to emphasize that this directive serves as the **entry point** for the client-server **boundary**, not a Client Component opt-in feature.
### Why?
Most of the code snippets were using single quotes, so unify and match the usage.
Also, React [docs](https://react.dev/reference/rsc/use-client) uses a single quote.
This PR fixes a grammar mistake on the [**Static
Exports**](https://nextjs.org/docs/pages/guides/static-exports) page:
Before | After
--- | ---
How to create **an** static export of your Next.js application | How to
create **a** static export of your Next.js application
This is erroneously showing the app router docs for pages router,
however nonce handling was not added to pages router (support is being
added in #78936) and the included examples are using server components.
Added documentation for the new Build Lifecycle Hooks feature in the
Next.js Compiler, specifically the `runAfterProductionCompile` hook.
https://github.com/vercel/next.js/pull/77345
To serve the static content from the right application you also need a
rewrite rule for the static assets and not only the actual content.
Fixes: #78811
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Thanks for adding a link to the Cloudflare adapter.
This PR updates the link to the adapter to link the adapter based on
OpenNext which is our current recommended solution to deploy to
Cloudflare Workers.
(The existing link was to Next on Pages which was our former solution).
Co-authored-by: JJ Kasper <jj@jjsweb.site>
Hello from the RavenDB team (https://github.com/ravendb/ravendb)
We've seen multiple reports of issues with Next.js and our ravendb
package. This PR resolves those issues by adding ravendb package to
`server-external-package.json`.
i've included one library.
- [ravendb](https://www.npmjs.com/package/ravendb)
let me know if any changes are needed.
This PR prunes references to Vercel in the documentation. Some of the
mentions were egregious and unneeded. Others were documenting specific
behavior for how Next.js runs on Vercel, which is better suited for the
Vercel documentation.
It also restructures our deployment documentation to remove any previous
bias toward Vercel. Rather than separating self-hosting (Node.js server,
Docker, static export) into its own section from managed platforms, it
now lists them all together. Vercel is listed under "Adapters",
alongside Netlify, Cloudflare, and AWS Amplify (in alphabetical order).
These are the companies we're working with on the [Deployment Adapters
API](https://github.com/vercel/next.js/discussions/77740), who currently
maintain their own adapters and will eventually migrate to use this new
API. We've [started working
on](https://github.com/vercel/next.js/pull/78166) that API.
For different features in the docs, like ISR or Middleware, this PR also
adds a new feature matrix that shows the different deployment options
and whether this feature is supported. For example, features that
require using the server are not supported with static exports.
Additionally, when there is configuration possible (like changing the
caching behavior of ISR) we link back to our guide which explains these
options in detail.

This PR also updates the Middleware section of the self-hosting guide to
mention [Node.js runtime
support](https://nextjs.org/blog/next-15-2#nodejs-middleware-experimental).
I've also removed the "Managed Next.js (Vercel)" entry for the docs
sidebar, as it is not necessary and Vercel should not have additional
priority there over other providers.

Netlify has confirmed they're okay with the specific feature matrix link
included in the adapters section, and I did my best to include the
Cloudflare and Amplify versions based on their documentation. If any of
the providers want to see changes to those links, please let me know and
I'll open a PR.
This removes the `--turbopack` and `--turbo` flags from `next start`, as
it correctly launches the server to handle Turbopack builds without the
flag.
It also removes this section from the documentation.
This is a breaking change, but Turbopack-powered builds are
experimental, so this can probably go out with the next stable release.
### What?
Updates the `userAgent` middleware example in the documentation to
accurately reflect all possible values of `device.type` and demonstrate
proper handling of desktop browsers (undefined case).
### Why?
The current example shows a binary mobile/desktop check which doesn't
accurately reflect the API's capabilities. The `device.type` property
can actually return multiple values ('mobile', 'tablet', 'console',
'smarttv', 'wearable', 'embedded', or undefined), but the example only
shows handling of 'mobile', which could mislead developers.
### How?
- Updated both TypeScript and JavaScript examples to:
1. Add comprehensive comments documenting all possible `device.type`
values
2. Use proper undefined handling with the OR operator for desktop
browsers
3. Maintain consistency between TS and JS versions
4. Better align with the documented behavior in the API reference
- Ran `pnpm prettier-fix` to ensure proper formatting
- Followed the [Docs Contribution
Guide](https://nextjs.org/docs/community/contribution-guide)
The changes help developers better understand:
- The full range of device types they can detect
- How desktop browsers return undefined
- The proper way to handle device type detection
- Consistency with the rest of the API documentation
### Checklist
- [x] Read the [Docs Contribution
Guide](https://nextjs.org/docs/community/contribution-guide)
- [x] Ran `pnpm prettier-fix` to fix formatting issues
- [x] Ensured examples are clear and follow documentation best practices
- [x] Maintained consistency with existing documentation style
- [x] Verified the accuracy of the technical information
---------
Co-authored-by: JJ Kasper <jj@jjsweb.site>