Skip to main content
The Vercel adapter for Next.js enables your Next.js application to be deployed on Vercel’s infrastructure. In most cases, this adapter is automatically configured when deploying to Vercel, so no manual setup is required.
The adapter is automatically configured when you deploy to Vercel. Manual installation is only needed for debugging or advanced use cases.

Installation

1

Install the adapter

Install the latest version of the Vercel adapter using your preferred package manager:
npm i @next-community/adapter-vercel@latest
The adapter requires Next.js version 16.1.1-canary.18 or higher and Node.js 20.6.0 or higher.
2

Configure Next.js

Add the adapter to your Next.js configuration file:
import { NextConfig } from 'next'

const nextConfig: NextConfig = {
  experimental: {
    adapterPath: require.resolve('@next-community/adapter-vercel')
  }
}

export default nextConfig
It is recommended to leave the adapter automatically configured on Vercel to receive automatic fixes and updates. Only configure it manually if you need to debug deployment issues locally.
3

Build your application

Run the Next.js build command to generate the Vercel output:
npm run build
The adapter will create a .next/output directory containing the Vercel deployment configuration and optimized build artifacts.
The output directory includes a config.json file with routing rules, middleware configuration, and function definitions optimized for Vercel’s edge network.

What happens during the build

When you build your Next.js application with the Vercel adapter, it performs several optimizations:
1

Output generation

The adapter processes your Next.js build output and generates Vercel-specific deployment artifacts in .next/output/:
const vercelOutputDir = path.join(distDir, 'output');
await fs.mkdir(vercelOutputDir, { recursive: true });
2

Function creation

Server-side routes are converted into Vercel Functions based on their runtime:
  • Node.js runtime for standard server components and API routes
  • Edge runtime for middleware and edge functions
The adapter automatically detects which runtime to use:
if (output.runtime === 'nodejs') {
  nodeOutputs.push(output);
} else if (output.runtime === 'edge') {
  edgeOutputs.push(output);
}
3

Static file optimization

Static assets from the public/ directory and statically generated pages are optimized for Vercel’s CDN:
await handlePublicFiles(
  path.join(projectDir, 'public'),
  vercelOutputDir,
  config
);
await handleStaticOutputs(outputs.staticFiles, {
  config,
  vercelConfig,
  vercelOutputDir,
});
4

Routing configuration

The adapter generates a comprehensive routing configuration (config.json) that handles:
  • Dynamic routes and rewrites
  • Middleware routing
  • Internationalization (i18n)
  • Headers and redirects
  • 404 and 500 error pages
The configuration is written to the output directory:
const outputConfigPath = path.join(vercelOutputDir, 'config.json');
await fs.writeFile(outputConfigPath, JSON.stringify(vercelConfig, null, 2));

Verifying the build

After building, you can verify the adapter output:
ls -la .next/output
You should see a directory structure similar to this:
.next/output/
├── config.json          # Routing and deployment configuration
├── functions/           # Serverless and edge functions
│   ├── index.func/      # Function for the home page
│   └── api/             # API route functions
└── static/              # Static assets and prerendered pages
    ├── _next/           # Next.js static assets
    └── index.html       # Prerendered pages (if any)
The config.json file contains the Vercel configuration:
{
  "version": 3,
  "routes": [...],
  "images": {...},
  "overrides": {}
}

Next steps

Next.js configuration

Learn about advanced configuration options for the adapter

How it works

Understand the adapter architecture and build process

Requirements

Before using the adapter, ensure your project meets these requirements:
  • Next.js: >= 16.1.1-canary.18
  • Node.js: >= 20.6.0
  • Package type: CommonJS (type: “commonjs”)
The adapter is currently in beta (version 0.0.1-beta.12). While it’s production-ready for Vercel deployments, the API may change in future releases.

Build docs developers (and LLMs) love