---
title: middleware.js
description: API reference for the middleware.js file (deprecated, renamed to proxy.js).
version: draft
related:
  title: Learn more about Proxy
  links:
    - app/api-reference/file-conventions/proxy
---

The `middleware.js` file convention has been **deprecated** in Next.js 16 and renamed to [`proxy.js`](/docs/app/api-reference/file-conventions/proxy).

All functionality remains the same — only the file and export names have changed. See the [Migration to Proxy](/docs/app/api-reference/file-conventions/proxy#migration-to-proxy) section for details on how to migrate.

You can automatically migrate by running:

```bash
npx @next/codemod@canary middleware-to-proxy .
```

For full documentation, see the [`proxy.js` API reference](/docs/app/api-reference/file-conventions/proxy).
