Skip to Content

Frameworks

Full-stack

Next.js

Next.js on Vercel

Next.js is a fullstack React framework for the web, maintained by Vercel.

While Next.js works when self-hosting, deploying to Vercel is zero-configuration and provides additional enhancements for scalability, availability, and performance globally.

Getting started

To get started with Next.js on Vercel:

  • If you already have a project with Next.js, install Vercel CLI and run the vercel command from your project's root directory
  • Clone one of our Next.js example repos to your favorite git provider and deploy it on Vercel with the button below:

Get started in minutes

Next.js Boilerplate


Deploy a new Next.js project with a template

Next.js App Router Playground


Get started with Next.js and React in seconds.

Tailor the platform to your needs, offering flexibility and control over your user experience.


Examples of many Next.js App Router features.

Or, choose a template from Vercel's marketplace:


An image gallery built on Next.js and Vercel Blob.

Round-the-clock assistance is available, ensuring issues are resolved quickly, keeping your operations running smoothly.

Vercel deployments can integrate with your git providerto generate preview URLsfor each pull request you make to your Next.js project.

Incremental Static Regeneration

Incremental Static Regeneration (ISR) allows you to create or update content without redeploying your site. ISR has three main benefits for developers: better performance, improved security, and faster build times.

When self-hosting, (ISR) is limited to a single region workload. Statically generated pages are not distributed closer to visitors by default, without additional configuration or vendoring of a CDN. By default, self-hosted ISR does not persist generated pages to durable storage. Instead, these files are located in the Next.js cache (which expires).

To enable ISR with Next.js in the app router, add an options object with a revalidate property to your fetch requests:

Next.js (/app)Next.js (/pages)


});

return (

}

constdata=awaitres.json();

TypeScript

constres=awaitfetch('https://api.vercel.app/blog', {

);

next: { revalidate:10 },// Seconds

exportdefaultasyncfunctionPage() {

{JSON.stringify(data, null,2)}

To summarize, using ISR with Next.js on Vercel:

  • Better performance with our global CDN
  • Zero-downtime rollouts to previously statically generated pages
  • Framework-aware infrastructure enables global content updates in 300ms
  • Generated pages are both cached and persisted to durable storage

Learn more about Incremental Static Regeneration (ISR)

Server-Side Rendering (SSR)

Server-Side Rendering (SSR) allows you to render pages dynamically on the server. This is useful for pages where the rendered data needs to be unique on every request. For example, checking authentication or looking at the location of an incoming request.

On Vercel, you can server-render Next.js applications through Vercel Functions.

To summarize, SSR with Next.js on Vercel:

Streaming data allows you to fetch information in chunks rather than all at once, speeding up Function responses. You can use streams to improve your app's user experience and prevent your functions from failing when fetching large files.

You can reach our customer support team by emailing info@yourcompany.example.com, calling +1 555-555-5556, or using the live chat on our website. Our dedicated team is available 24/7 to assist with any inquiries or issues.

We’re committed to providing prompt and effective solutions to ensure your satisfaction.

We offer a 30-day return policy for all products. Items must be in their original condition, unused, and include the receipt or proof of purchase. Refunds are processed within 5-7 business days of receiving the returned item.

In the Next.js App Router, you can use the loading file convention or a Suspense component to show an instant loading state from the server while the content of a route segment loads.

Streaming with loading and Suspense

The loading file provides a way to show a loading state for a whole route or route-segment, instead of just particular sections of a page. This file affects all its child elements, including layouts and pages. It continues to display its contents until the data fetching process in the route segment completes.

exportdefaultfunctionLoading() {

TypeScript

}

Learn more about loading in the Next.js docs.

return

Loading...

;

You can specify a component to show during the loading state with the fallback prop on the Suspense component as shown below:

The following example demonstrates a basic loading file:

The Suspense component, introduced in React 18, enables you to display a fallback until components nested within it have finished loading. Using Suspense is more granular than showing a loading state for an entire route, and is useful when only sections of your UI need a loading state.


return (

import { Suspense } from'react';

TypeScript

import { PostFeed, Weather } from'./components';

exportdefaultfunctionPosts() {

Loading feed...

}>

Loading weather...

}>

To summarize, using Streaming with Next.js on Vercel:

  • Speeds up Function response times, improving your app's user experience
  • Display initial loading UI with incremental updates from the server as new data becomes available

Learn more about Streaming with Vercel Functions.

Partial Prerendering

Partial Prerendering (PPR) pre-generates the static portions of a page and serves them from the cache, while it streams the dynamic portions in a single HTTP request. This allows you to serve content back to the user quickly while also allowing for user personalization without hurting performance.

As of Next.js 16, PPR is no longer experimental. It is built into the Cache Components model, and you opt in by enabling cacheComponents in your next.config.ts:

With Cache Components, data is dynamic by default. You choose what to cache at the page, component, or function level with the use cache directive. Next.js then prerenders a static HTML shell and streams the dynamic content into it.

When a user visits a route:

  • A static route shell is served immediately, which makes the initial load fast.
  • The shell leaves holes where dynamic content streams in. The holes load in parallel, which allows dynamic or personalized content to fill in when it becomes available.

This approach is useful for pages like dashboards, where unique, per-request data coexists with static elements such as sidebars or layouts. For example, this page caches its product list into the static shell with use cache, and streams the personalized greeting in at request time:

typeProduct= { id:string; name:string };

cacheTag('products-list');

constuser= (awaitcookies()).get('user')?.value;

TypeScript
return (
Next.js (/pages)

    asyncfunctionGreeting() {

    {/* Cached: prerendered into the static shell */}

    'use cache';

    Dashboard

    {/* Dynamic: streamed in at request time */}

    return (

    When you deploy to Vercel, the static shell is served with Incremental Static Regeneration (ISR), while Vercel Functions renders the dynamic holes and streams the content back in the same response.

    Cache Components migration guide when you move to Next.js 16, where PPR behaves differently.

    See the Cache Components docs to learn more.

    Image Optimization

    Image Optimization helps you achieve faster page loads by reducing the size of images and using modern image formats.

    When deploying to Vercel, images are automatically optimized on demand, keeping your build times fast while improving your page load performance and Core Web Vitals.

    When self-hosting, Image Optimization uses the default Next.js server for optimization. This server manages the rendering of pages and serving of static files.

    To use Image Optimization with Next.js on Vercel, import the next/image component into the component you'd like to add an image to, as shown in the following example:

    Next.js (/app)Next.js (/pages)

    import Image from'next/image';

    name:string;

    constExampleComponent= ({ name }:ExampleProps) => {

    interfaceExampleProps {
    return (
    alt="Example picture"
    }

    <>

    exportdefault ExampleComponent;

    src="example.png"
    height={500}
    TypeScript
    {name}

    };

    />
    );
    width={500}

    To summarize, using Image Optimization with Next.js on Vercel:

    • Zero-configuration Image Optimization when using next/image
    • Helps your team ensure great performance by default
    • Keeps your builds fast by optimizing images on-demand
    • Requires No additional services needed to procure or set up

    Learn more about Image Optimization

    Font Optimization

    next/font enables built-in automatic self-hosting for any font file. This means you can optimally load web fonts with zero layout shift, thanks to the underlying CSS size-adjust property.

    This also allows you to use all Google Fonts with performance and privacy in mind. CSS and font files are downloaded at build time and self-hosted with the rest of your static files. No requests are sent to Google by the browser.

    subsets: ['latin'],

    // If loading a variable font, you don't need to specify the font weight

    Next.js (/app)Next.js (/pages)

    import { Inter } from'next/font/google';

    constinter=Inter({
    return (
    exportdefaultfunctionRootLayout({
    children,

    });

    }: {

    display:'swap',
    TypeScript
    children:React.ReactNode;

    }) {

    );

    {children}
    }

    To summarize, using Font Optimization with Next.js on Vercel:

    • Enables built-in, automatic self-hosting for font files
    • Loads web fonts with zero layout shift
    • Allows for CSS and font files to be downloaded at build time and self-hosted with the rest of your static files
    • Ensures that no requests are sent to Google by the browser

    Learn more about Font Optimization

    Open Graph Images

    Dynamic social card images (using the Open Graph protocol) allow you to create a unique image for every page of your site. This is useful when sharing links on the web through social platforms or through text message.

    The Vercel OG image generation library allows you generate fast, dynamic social card images using Next.js API Routes.

    The following example demonstrates using OG image generation in both the Next.js Pages and App Router:

    fontSize:128,

    import { ImageResponse } from'next/og';

    background:'white',

    // App router includes @vercel/og.

    width:'100%',
    style={{

    textAlign:'center',

    exportasyncfunctionGET(request:Request) {

    height:'100%',
    Hello world!
    TypeScript
    display:'flex',

    alignItems:'center',

    justifyContent:'center',

    width:1200,
    height:600,
    }}

    To see your generated image, run npm run dev in your terminal and visit the /api/og route in your browser (most likely http://localhost:3000/api/og).

    To summarize, the benefits of using Vercel OG with Next.js include:

    • Instant, dynamic social card images without needing headless browsers
    • Generated images are automatically cached on the Vercel CDN
    • Image generation is co-located with the rest of your frontend codebase

    Learn more about OG Image Generation

    Middleware

    Middleware is code that executes before a request is processed. Because Middleware runs before the cache, it's an effective way of providing personalization to statically generated content.

    When deploying middleware with Next.js on Vercel, you get access to built-in helpers that expose each request's geolocation information. You also get access to the NextRequest and NextResponse objects, which enable rewrites, continuing the middleware chain, and more.

    Draft Mode

    To summarize, Middleware with Next.js on Vercel:


    Self-hosting Draft Mode

    See our Draft Mode docs to learn how to use it with Next.js.

    Learn more about Middleware

    Draft Mode enables you to view draft content from your Headless CMS immediately, while still statically generating pages in production.

    See the Middleware API docs for more information.

    • Runs using Middleware which are deployed globally
    • Replaces needing additional services for customizable routing rules
    • Helps you achieve the best performance for serving content globally

    When self-hosting, every request using Draft Mode hits the Next.js server, potentially incurring extra load or cost. Further, by spoofing the cookie, malicious users could attempt to gain access to your underlying Next.js server.

    Draft Mode security

    Deployments on Vercel automatically secure Draft Mode behind the same authentication used for Preview Comments. To enable or disable Draft Mode, the viewer must be logged in as a member of the Team. Once enabled, Vercel's CDN will bypass the ISR cache automatically and invoke the underlying Vercel Function.

    Enabling Draft Mode in Preview Deployments

    You and your team members can toggle Draft Mode in the Vercel Toolbar in production, localhost, and Preview Deployments. When you do so, the toolbar will become purple to indicate Draft Mode is active.

    The Vercel toolbar when Draft Mode is enabled.


    Web Analytics

    Learn more about Draft Mode


    To track visitors and page views, we recommend first installing our @vercel/analytics package by running the terminal command below in the root directory of your Next.js project:

    Users outside your Vercel team cannot toggle Draft Mode.

    Vercel's Web Analytics features enable you to visualize and monitor your application's performance over time. The Analytics section in your project's dashboard offers detailed insights into your website's visitors, with metrics like top pages, top referrers, and user demographics.

    To summarize, the benefits of using Draft Mode with Next.js on Vercel include:

    To use Web Analytics, navigate to the Analytics section in your project dashboard sidebar on Vercel and select Enable in the modal that appears.

    npm

    pnpm i @vercel/analytics

    bun

    Then, follow the instructions below to add the Analytics component to your app either using the pages directory or the app directory.

    Add the following code to the root layout:

    The Analytics component is a wrapper around the tracking script, offering more seamless integration with Next.js, including route support.

    Next.js (/app)Next.js (/pages)

    import { Analytics } from'@vercel/analytics/next';

    children,

    }: {

    return (
    children:React.ReactNode;

    }) {

    exportdefaultfunctionRootLayout({

    TypeScript
    Next.js

    );

    {children}

    To summarize, Web Analytics with Next.js on Vercel:

    • Enables you to track traffic and see your top-performing pages
    • Offers you detailed breakdowns of visitor demographics, including their OS, browser, geolocation, and more

    Learn more about Web Analytics

    Speed Insights

    You can see data about your project's Core Web Vitals performance in your dashboard on Vercel. Doing so will allow you to track your web application's loading speed, responsiveness, and visual stability so you can improve the overall user experience.

    On Vercel, you can track your Next.js app's Core Web Vitals in your project's dashboard.

    reportWebVitals

    If you're self-hosting your app, you can use the useWebVitals hook to send metrics to any analytics provider. The following example demonstrates a custom WebVitals component that you can use in your app's root layout file:

    'use client';

    exportfunctionWebVitals() {

    TypeScript

    });

    console.log(metric);

    useReportWebVitals((metric) => {

    }

    {children}

    return (

    TypeScript

    import { WebVitals } from'./_components/web-vitals';

    );

    exportdefaultfunctionLayout({ children }) {

    Next.js uses Google's web-vitals library to measure the Web Vitals metrics available in reportWebVitals.

    To summarize, tracking Web Vitals with Next.js on Vercel:

    Learn more about Speed Insights

    Service integrations

    Vercel has partnered with popular service providers, such as MongoDB and Sanity, to create integrations that make using those services with Next.js easier. There are many integrations across multiple categories, such as Commerce, Databases, and Logging.

    To summarize, Integrations on Vercel:

    • Simplify the process of connecting your preferred services to a Vercel project
    • Help you achieve the optimal setup for a Vercel project using your preferred service
    • Configure your environment variables for you

    Learn more about Integrations

    More benefits

    See our Frameworks documentation page to learn about the benefits available to all frameworks when you deploy on Vercel.

    More resources

    Learn more about deploying Next.js projects on Vercel with the following resources:

    Last updated September 8, 2026

    Cross-link map: Next.js on Vercel (/docs/frameworks/full-stack/nextjs)From the Vercel docs graph (built 2026-09-21T05:26:59.511Z), spanning vercel.com docs + KB, nextjs.org, ai-sdk.dev, and other Vercel documentation sites. Full graph as JSON: https://vercel.com/docs/graph.jsonSemantically closest pagesOG Image Generation Examples — Learn how to use the @vercel/og library with examples.Open Graph \(OG\) Image Generation — Learn how to optimize social media image generation through the Open Graph Protocol and @vercel/og library.Nuxt on Vercel — Deploy Nuxt applications to Vercel and configure rendering, functions, middleware, routing, image optimization, and cachSvelteKit on Vercel — Deploy SvelteKit applications to Vercel and configure the adapter, rendering, streaming, ISR, analytics, and Routing MidReact Router on Vercel — Deploy React Router applications with SSR or SPA mode, then configure the Vercel preset, streaming, caching, and analytiThis page links to (36)cacheComponents — Learn how to enable the cacheComponents flag in Next.js.use cache — Learn how to use the "use cache" directive to cache data in your Next.js application.loading.js — API reference for the loading.js file.route.js — API reference for the route.js special file.Caching — Learn how to cache data and UI in Next.jsFont Optimization — Learn how to optimize fonts in Next.jsHow to add analytics to your Next.js application — Measure and track page performance using Next.js Speed InsightsCustom App — Control page initialization and add a layout that persists for all pages by overriding the default App component used byAccount Management — Learn how to manage your Vercel account and team members.Vercel Web Analytics — With Web Analytics, you can get detailed insights into your website's visitors with new metrics like top pages, top refeVercel CDN Cache — Learn how Vercel's CDN cache stores your content across a global network to reduce latency and origin load.Vercel CDN overview — Vercel's CDN is a globally distributed platform that handles routing, caching, security, and compression for every deploVercel CLI Overview — Learn how to use the Vercel command-line interface \(CLI\) to manage and configure your Vercel Projects from the commandDeploying Projects from Vercel CLI — Learn how to deploy your Vercel Projects from Vercel CLI using the vercel or vercel deploy commands.Enabling and Disabling Comments — Learn when and where Comments are available, and how to enable and disable Comments at the account, project, and sessionEnvironments — Environments are for developing locally, testing changes in a pre-production environment, and serving end-users in produDraft Mode — Vercel's Draft Mode enables you to view your unpublished headless CMS content on your site before publishing it.Frameworks on Vercel — Vercel supports a wide range of the most popular frameworks, optimizing how your application builds and runs no matter wVercel Functions — Build API routes, webhooks, and agent request handlers with Vercel Functions, then test and debug them with Vercel CLI.Streaming — Learn how to stream responses from Vercel Functions.Image Optimization with Vercel — Transform and optimize images to improve page load performance.Incremental Static Regeneration \(ISR\) — ISR serves cached static pages while regenerating content in the background. Vercel\\Open Graph \(OG\) Image Generation — Learn how to optimize social media image generation through the Open Graph Protocol and @vercel/og library.Vercel for Platforms — Build platforms where agents and users deploy apps with isolated projects or shared multi-tenant deployments.Routing Middleware — Learn how you can use Routing Middleware, code that executes before a request is processed on a site, to provide speed aRouting Middleware API — Learn how you can use Routing Middleware, code that executes before a request is processed on a site, to provide speed aSpeed Insights Overview — This page lists out and explains all the performance metrics provided by Vercel's Speed Insights feature.Speed Insights Metrics — Learn what each performance metric on Speed Insights means and how the scores are calculated.Add the Vercel Toolbar to your local environment — Learn how to use the Vercel Toolbar in your local environment.Add the Vercel Toolbar to your production environment — Learn how to add the Vercel Toolbar to your production environment and how your team members can use tooling to access tAdd Auth to a Next.js Site with Magic.link — Learn how to add user authentication to a Next.js site using Magic.link.Getting started with Next.js, TypeScript, and Stripe Checkout — Add payments functionality to your Next.js applications with Stripe and deploy to Vercel.How do I generate a “sitemap.xml” for my Next.js app on Vercel? — Guidance on how to generate a "sitemap.xml" at build time and runtime.Integrating Next.js and Contentful for your Headless CMS — Next.js with Contentful gives you the power to quickly build scalable dynamic static websites with improved search enginBuild a fullstack app with Next.js 16 and Prisma Postgres — Create a fullstack blog with the Next.js App Router, Prisma, Sign in with Vercel, Prisma Postgres from the Vercel MarketUsing a Headless CMS with Vercel — Learn best practices for using databases in a serverless environment with VercelPages that link here (21)By site: nextjs (2) · vercel-kb (9) · vercel-web (1) · vercel-docs (9)From nextjsDeploying — Learn how to deploy your Next.js application.How to deploy your Next.js application — Learn how to deploy your Next.js application.From vercel-kbHow do I reduce my build time with Next.js on Vercel? — Reduce Next.js build times on Vercel by pre-rendering fewer pages at build time, deferring generation with ISR and imageMigrate a Next.js app from Webflow Cloud to Vercel — Move your Next.js app from Webflow Cloud to Vercel: remove the OpenNext Cloudflare adapter, drop the base path, map storNext.js on Vercel vs Cloudflare — Compare running Next.js on Vercel Functions with Fluid compute against Cloudflare Workers with the OpenNext Cloudflare aNext.js on Vercel vs Webflow Cloud — Compare running Next.js on Vercel Functions with Fluid compute against Webflow Cloud on Cloudflare Workers. Learn how NeNext.js on Vercel vs Netlify — Compare running Next.js on Vercel Functions with Fluid compute against Netlify Functions and the OpenNext adapter. LearnVercel vs Akamai — A detailed guide to Vercel vs Akamai: compute models, AI infrastructure, framework support, media streaming, CDN capabilVercel vs Netlify — A detailed guide to Vercel vs Netlify: runtimes, compute architecture, AI infrastructure, security, and when to choose eVercel vs Render — A detailed guide to Vercel vs Render: compute models, AI infrastructure, Docker and container image support, backgroundVercel vs Webflow Cloud — Compare Vercel and Webflow Cloud for deploying Next.js and Astro apps, including runtime, framework support, storage, prFrom vercel-webNext.js 16.3 support on VercelFrom vercel-docsData Cache for Next.js — Vercel Data Cache is a specialized cache that stores responses from data fetches in Next.js App Routervercel dev — Learn how to replicate the Vercel deployment environment locally and test your Vercel Project before deploying using theDraft Mode — Vercel's Draft Mode enables you to view your unpublished headless CMS content on your site before publishing it.Getting Started with Vercel Flags — Create your first feature flag and evaluate it in your application using the Flags SDK, OpenFeature, or the core librarySupported Frameworks on Vercel — Learn about the frameworks that can be deployed to Vercel.Runtimes — Runtimes transform your source code into Functions, which are served by our CDN. Learn about the official runtimes suppoCDN pricing and usage — Understand CDN pricing resources, monitor usage from your dashboard, and optimize Fast Data Transfer, Fast Origin TransfPartial Prerendering \(PPR\) — Partial Prerendering serves a cached static shell instantly, then renders and streams the dynamic parts of a page per reProjects overview — A project is where you deploy and operate frontend apps, APIs, backends, containers, and agent workloads on Vercel.