What’s New in Next.js 16: Cache Components, Turbopack, proxy.ts and How to Upgrade
On this page
- Next.js 16 at a glance
- Cache Components: caching you choose
- Refreshing cached data
- Turbopack is now the default
- proxy.ts replaces middleware.ts
- Async request APIs: await params
- React 19.2 and the React Compiler
- Next.js DevTools MCP
- Requirements and removals
- How to upgrade an existing app
- Should you upgrade now?
- Frequently asked questions about Next.js 16
- Oh hi there 👋It’s nice to meet you.
- Sign up to receive awesome content in your inbox.
Next.js 16 is less about flashy new features and more about fixing the parts of Next.js that confused developers most: caching that happened implicitly, a bundler that was “almost” ready, and a middleware file whose behaviour was hard to predict. This guide explains what changed in Next.js 16, and shows each feature working: every example below was built with Next.js 16.4.6, the current release at the time of testing, and React 19.3.
Facts about the release come from the official Next.js 16 announcement; the build output quoted here is from real builds.
Next.js 16 at a glance
| Change | What it means for you |
|---|---|
| Cache Components | Caching is opt-in and explicit, with the 'use cache' directive |
| Turbopack by default | Faster builds and Fast Refresh without any configuration |
proxy.ts replaces middleware.ts |
A rename, plus a predictable Node.js runtime |
| React 19.2 and React Compiler support | Latest React features; automatic memoization available |
| New caching APIs | updateTag, refresh, and a changed revalidateTag |
| Next.js DevTools MCP | AI coding assistants can inspect your running app |
| Async request APIs | params, cookies() and headers() must be awaited |
Cache Components: caching you choose
In earlier versions, Next.js decided what to cache, which led to stale data and confusion about why a page didn’t update. Cache Components flip this around: nothing is cached unless you say so. You enable the model once in your config:
// next.config.mjs
const nextConfig = {
cacheComponents: true,
};
export default nextConfig;
Then you mark exactly what may be cached with the 'use cache' directive, choose how long with cacheLife, and label it with cacheTag so you can refresh it later:
// app/products/page.js
import { cacheLife, cacheTag } from 'next/cache';
async function getProducts() {
'use cache';
cacheLife('hours');
cacheTag('products');
return db.products.findMany();
}
export default async function ProductsPage() {
const products = await getProducts();
return <ul>{products.map((p) => <li key={p.id}>{p.name}</li>)}</ul>;
}
Building this on Next.js 16.4.6 confirmed the effect: the build reported “Cache Components enabled”, and listed /products with a revalidation time of 1h and an expiry of 1d, exactly what the 'hours' profile means. Anything not marked is treated as dynamic and rendered per request, which is the safe default for personalized data.
The same build printed a note worth knowing: in recent 16.x releases, Next.js recommends enabling Partial Prefetching together with Cache Components for new projects, and says both will be enabled everywhere in the next major release. If you start a new app today, follow the linked guide in that build message and turn both on.
Refreshing cached data
When data changes, refresh what depends on it by tag from a Server Action:
'use server';
import { updateTag } from 'next/cache';
export async function addProduct(formData) {
await db.products.create({ name: formData.get('name') });
updateTag('products'); // the next read sees the new product immediately
}
updateTag is new and designed for “read your own writes”: the person who made the change sees it straight away. The existing revalidateTag now takes a second argument, a cache life profile such as 'max', so stale content can be served while fresh content is fetched in the background. Code calling revalidateTag('products') with one argument needs updating.
Turbopack is now the default
Turbopack, the Rust-based bundler, is stable and the default for both next dev and next build. The official announcement cites up to 5–10× faster Fast Refresh and 2–5× faster production builds. The test project built with it without any configuration, compiling in a few seconds.
If your project relies on a custom webpack configuration, it won’t be used by Turbopack. You can keep using webpack while you migrate by building with next build --webpack, then move the customization to Turbopack-compatible options over time.
proxy.ts replaces middleware.ts
The old middleware file is renamed to proxy, and its exported function too. The logic stays the same:
// proxy.js (formerly middleware.js)
import { NextResponse } from 'next/server';
export function proxy(request) {
if (request.nextUrl.pathname.startsWith('/admin') && !request.cookies.get('session')) {
return NextResponse.redirect(new URL('/login', request.url));
}
return NextResponse.next();
}
export const config = { matcher: ['/admin/:path*'] };
The new name describes what the file does: it sits in front of your routes and intercepts requests. It also runs on the Node.js runtime, so libraries that need Node APIs work there. An old middleware.js still works in Next.js 16.4, but the build prints a warning:
⚠ The "middleware" file convention is deprecated. Please use "proxy" instead.
npx @next/codemod@canary middleware-to-proxy .
The codemod in that warning renames the file and function for you.
Async request APIs: await params
Route params, searchParams, cookies() and headers() are now asynchronous. Synchronous access, which earlier versions still allowed with a warning, is removed:
// app/blog/[slug]/page.js
export default async function Post({ params }) {
const { slug } = await params; // params is a Promise
return <h1>Post: {slug}</h1>;
}
This version built and prerendered /blog/hello correctly in testing. The official codemod converts most existing code, and anywhere it can’t, the build or your editor points to the line.
React 19.2 and the React Compiler
Next.js 16 ships with React 19.2 features for the App Router, and support for the React Compiler is now stable. The compiler automatically memoizes components, removing much of the manual useMemo and useCallback work. It is opt-in through reactCompiler: true in the config, because it adds compile time; enable it and measure on your own app. Many of the re-render issues covered in fixing “Too many re-renders” still come from logic mistakes that no compiler can fix, so the underlying rules still matter.
Next.js DevTools MCP
Next.js 16 adds a Model Context Protocol server for its developer tools, so AI coding assistants can read your running app’s routes, errors and logs while helping you debug. If you build with MCP-aware tools, testing your own MCP servers is covered in MCP Inspector: how to test and debug MCP servers.
Requirements and removals
- Node.js 20 or newer is required.
- AMP support is removed.
- The
next lintcommand is removed; run ESLint or another linter directly. - Parallel route slots need an explicit
default.js. revalidateTagneeds a cache profile as its second argument, as described above.
How to upgrade an existing app
- Commit your work and make sure the app builds on your current version.
- Check Node.js:
node -vmust be 20 or newer, locally and on your hosting. - Run the upgrade:
npx @next/codemod@canary upgrade latest, which updates packages and applies the codemods, or updatenext,reactandreact-dommanually. - Rename middleware to proxy with the codemod from the build warning.
- Fix async request APIs wherever the codemod couldn’t, awaiting
params,cookies()andheaders(). - Build and test. If a custom webpack setup breaks, use
next build --webpackwhile you migrate it. - Adopt Cache Components gradually: enable
cacheComponents, then add'use cache'to data that can safely be shared, starting with pages that change rarely.
For a MERN-style project where Next.js talks to a separate Express API, nothing changes on the API side. The usual integration issues, such as CORS and proxies, are covered in fixing “Blocked by CORS policy” and React Server Components explained.
Should you upgrade now?
For new projects, yes: start on Next.js 16 with Cache Components and Turbopack from day one. For existing apps, the upgrade is mostly mechanical, a rename and some awaits handled by codemods, so it is worth doing soon, especially to get faster builds. Adopting Cache Components is the part to do gradually: it changes how your data is cached, so roll it out page by page and verify that content updates when it should.
Frequently asked questions about Next.js 16
Is middleware.ts removed in Next.js 16?
It is deprecated, not removed. In testing with Next.js 16.4, an old middleware file still worked but printed a deprecation warning recommending the middleware-to-proxy codemod. Rename it to proxy now to avoid breakage in a later major version.
Do I have to use Cache Components?
No, it is opt-in with cacheComponents: true. Without it, your app behaves as before. With it, nothing is cached unless you mark it with 'use cache'.
Can I keep using webpack?
Yes, for now. Turbopack is the default, but next build --webpack keeps webpack available while you migrate custom configuration.
Which Node.js version does Next.js 16 need?
Node.js 20 or newer. Check both your machine and your hosting platform before upgrading.
What is the difference between updateTag and revalidateTag?
updateTag expires cached data immediately so the user who made a change sees it at once. revalidateTag refreshes in the background while serving the existing content, and now takes a cache profile as its second argument.
Why does next lint say “Invalid project directory provided”?
Because the lint command no longer exists in Next.js 16, the CLI reads “lint” as a folder name. In testing on 16.4.6, it failed with “Invalid project directory provided, no such directory: …/lint”. Run your linter directly, for example npx eslint ., and update the lint script in package.json.




