Skip to Content

Frameworks

Full-stack

Nuxt

Nuxt on Vercel

Nuxt is an open-source framework that streamlines the process of creating modern Vue apps. It offers server-side rendering, SEO features, automatic code splitting, prerendering, and more out of the box. It also has an extensive catalog of community-built modules, which allow you to integrate popular tools with your projects.

You can deploy Nuxt static and server-side rendered sites on Vercel with no configuration required.

Getting started

To get started with Nuxt on Vercel:

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

Choosing a build command

The following table outlines the differences between nuxt build and nuxt generate on Vercel:

Feature

Default build command

nuxt generate
nuxt build
Yes
No

Supports all Vercel features out of the box

Supports SSR

Yes
Yes
Yes
No

In general, nuxt build is likely best for most use cases. Consider using nuxt generate to build fully static sites.

Editing your Nuxt config

You can configure your Nuxt deployment by creating a Nuxt config file in your project's root directory. It can be a TypeScript, JavaScript, or MJS file, but the Nuxt team recommends using TypeScript. Using TypeScript will allow your editor to suggest the correct names for configuration options, which can help mitigate typos.

Your Nuxt config file should default export defineNuxtConfig by default, which you can add an options object to.

The following is an example of a Nuxt config file with no options defined:

});

exportdefaultdefineNuxtConfig({

// Config options here

TypeScript

  • Create redirects
  • Modify a route's response headers
  • Enable ISR
  • Deploy specific routes statically
  • Deploy specific routes with SSR
  • and more

Using routeRules

The following is an example of a Nuxt config that:

With the routeRules config option, you can:

  • Creates a redirect
  • Modifies a route's response headers
  • Opts a set of routes into client-side rendering

routeRules: {

exportdefaultdefineNuxtConfig({

// Enables client-side rendering

TypeScript

'/modify-headers-route': { headers: { 'x-magic-of':'nuxt and vercel' } },

},

});

'/spa': { ssr:false },

To learn more about routeRules:

Reading and writing files

Nuxt deploys routes defined in /server/api, /server/routes, and /server/middleware as one server-rendered Function by default. Nuxt Pages, APIs, and Middleware routes get bundled into a single Vercel Function.


You can test your API Routes with nuxt dev.

The following is an example of a basic API Route in Nuxt:

exportdefaultdefineEventHandler(() =>'Hello World!');

TypeScript

Vercel Functions enable developers to write functions that use resources that scale up and down based on traffic demands. This prevents them from failing during peak hours, but keeps them from running up high costs during periods of low activity.

};

To access server assets, you can use Nitro's storage API:


return {

// https://nitro.unjs.io/guide/assets#server-assets

constassets=useStorage('assets:server');

TypeScript

To write files, mount Redis storage with a Redis driver such as the Upstash Redis driver.

users,

});

constusers=awaitassets.getItem('users.json');

First, install Upstash Redis from the Vercel Marketplace to get your Redis credentials.

exportdefaultdefineEventHandler(async () => {

You can read and write server files with Nuxt on Vercel. One way to do this is by using Nitro with Vercel Functions and a Redis driver such as the Upstash Redis driver. Use Nitro's server assets to include files in your project deployment. Assets within server/assets get included by default.

});

nitro: {

storage: {

TypeScript

Then update your nuxt.config.ts file:

},

},

},

Use with the storage API.

exportdefaultdefineNuxtConfig({

data: { driver:'upstash' },

return {

constdataStorage=useStorage('data');

awaitdataStorage.setItem('hello','world');

TypeScript

exportdefaultdefineEventHandler(async (event) => {

};

});

See an example code repository.

Nuxt has two forms of Middleware:

hello:awaitdataStorage.getItem('hello'),

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

Nuxt server middleware on Vercel

In Nuxt, modules defined in /server/middleware will get deployed as server middleware. Server middleware should not have a return statement or send a response to the request.

Server middleware is best used to read data from or add data to a request's context. Doing so allows you to handle authentication or check a request's params, headers, url, and more.

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.

import { getUserFromDBbyCookie } from'some-orm-package';


event.context.user = user;

// The getCookie method is available to all

event.context.session_token = token;

exportdefaultdefineEventHandler(async (event) => {

TypeScript

consttoken=getCookie(event,'session_token');

if (user) {

// made up for this example. You can fetch

// data from wherever you want here

// Nuxt routes by default. No need to import.

// getUserFromDBbyCookie is a placeholder

const { user } =awaitgetUserFromDBbyCookie(event.request);

You could then access that data in a page on the frontend with the useRequestEvent hook. This hook is only available in routes deployed with SSR. If your page renders in the browser, useRequestEvent will return undefined.

The following example demonstrates a page fetching data with useRequestEvent:

Authentication failed!

Hello, {{ user.name }}!

returnnavigateTo('/secret');

Nuxt route middleware on Vercel

The following example demonstrates route middleware that redirects users to a secret route:

exportdefaultdefineNuxtRouteMiddleware((to) => {

TypeScript

);

});

console.log(

Route middleware is best used when you want to do things that server middleware can't, such as redirecting users, or preventing them from navigating to a route.

`Heading to ${to.path} - but I think we should go somewhere else...`,

Nuxt's route middleware runs before navigating to a particular route. While server middleware runs in Nuxt's Nitro engine, route middleware runs in Vue.

You should never see this page

By default, route middleware code will only run on pages that specify them. To do so, within the

title:'title',

withDefaults(defineProps<{

{{ title }}

title:'Is this thing on?'

The Nuxt team does not recommend deploying legacy versions of Nuxt (such as Nuxt 2) on Vercel, except as static sites. If your project uses a legacy version of Nuxt, you should either:

Deploying legacy Nuxt projects on Vercel

To see your generated image, run your project and use Nuxt DevTools. Or you can visit the image at its URL /__og-image__/image/og.png.

If you still want to use legacy Nuxt versions with Vercel, you should only do so by building a static site with nuxt generate. We do not recommend deploying legacy Nuxt projects with server-side rendering.

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.

Last updated August 26, 2026


Previous

Was this helpful?

Cross-link map: Nuxt on Vercel (/docs/frameworks/full-stack/nuxt)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 pagesSvelteKit on Vercel — Deploy SvelteKit applications to Vercel and configure the adapter, rendering, streaming, ISR, analytics, and Routing MidGetting started with Image Optimization — Learn how you can leverage Vercel Image Optimization in your projects.React Router on Vercel — Deploy React Router applications with SSR or SPA mode, then configure the Vercel preset, streaming, caching, and analytiAstro on Vercel — Deploy Astro sites to Vercel and configure server-side rendering, ISR, Web Analytics, Image Optimization, and Routing MiImproved support for Nuxt on VercelThis page links to (10)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 commandFrameworks 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.Image Optimization with Vercel — Transform and optimize images to improve page load performance.Getting started with Image Optimization — Learn how you can leverage Vercel Image Optimization in your projects.Incremental Static Regeneration \(ISR\) — ISR serves cached static pages while regenerating content in the background. Vercel\\Speed Insights Overview — This page lists out and explains all the performance metrics provided by Vercel's Speed Insights feature.Build an integrations hub with Nuxt and Vercel Connect — Build an Integrations Hub with Nuxt and Vercel Connect. Connect GitHub and Linear over OAuth and mint short-lived tokensBuild Imgur-style image hosting with Nuxt and Vercel Blob — Learn how to build an Imgur-style paste-to-share image host using Nuxt and Vercel Blob, with direct-to-storage client upPages that link here (6)By site: vercel-kb (1) · vercel-docs (5)From vercel-kbBuild Imgur-style image hosting with Nuxt and Vercel Blob — Learn how to build an Imgur-style paste-to-share image host using Nuxt and Vercel Blob, with direct-to-storage client upFrom vercel-docsVite on Vercel — Deploy Vite projects to Vercel and configure environment variables, Vercel Functions, server-side rendering, and SPA rewVite + Nitro on Vercel — Add a backend to any Vite app with Nitro and deploy to Vercel with zero configuration.Supported Frameworks on Vercel — Learn about the frameworks that can be deployed to Vercel.Incremental Static Regeneration \(ISR\) — ISR serves cached static pages while regenerating content in the background. Vercel\\CDN pricing and usage — Understand CDN pricing resources, monitor usage from your dashboard, and optimize Fast Data Transfer, Fast Origin Transf