DEV Community

Cover image for Deploying Nuxt 3 app to Vercel πŸš€
Jakub Andrzejewski
Jakub Andrzejewski

Posted on β€’ Edited on

15 1

Deploying Nuxt 3 app to Vercel πŸš€

When I started developing websites some time ago, there was no good free hosting providers. The only options available back then were the hostings that included several ads and promotions that were basically causing your website to not be viewable at all.

Thankfully, nowadays deploying web applications to free hosting is much better and you can choose from a variety of providers like Vercel, Netlify, Heroku, and many more!

In this article, I would like to guide you through the process of deploying your Nuxt 3 application to Vercel.

Code

First things first, we would need a Nuxt 3 application that will be then pushed to the Github repository. I suppose you already have it as you are reading this article and you are only interested in the instructions on how to deploy it to Vercel. Also, in this article I will show how to deploy the static website (SSG).

If you are interested in the process of building a simple web application clone that could be then deployed to Vercel, I highly recommend you to check out the following video:

The first thing we need to do is to import GitHub repository in Vercel

Vercel Dashboard

Later, let's define proper build command:

Vercel settings

Build command should be yarn generate and output folder .output/public

If you like, below you can add some environment variables (i.e. access tokens)

Vercel Environment Variables

If all went well with the configuration, you should see similar result as our demo https://nuxt-modules-clone.vercel.app/

Demo

Summary

Nicely done! You have just deployed a static Nuxt 3 application to Vercel hosting!

Billboard image

Imagine monitoring that's actually built for developers

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

Top comments (16)

Collapse
 
bongudth profile image
Huynh Thi Khanh Linh β€’

i tried changing OUTPUT DIRECTORY into .vercel/output/static instead .output/public and then success

Image description

Collapse
 
toniengelhardt profile image
Toni Engelhardt β€’

Doesn't seem to work for me with Nuxt 3.0.0-rc.13-27772354.a0a59e2 and ssr: false. Am I missing something?

Error: No Output Directory named "public" found after the Build completed. You can configure the Output Directory in your Project Settings.
Enter fullscreen mode Exit fullscreen mode
Collapse
 
jacobandrewsky profile image
Jakub Andrzejewski β€’

Hey, you are using an edge version of the release candidate that wasn't yet released (current stable one is -rc.12) so I would guess that this can be the issue.

Collapse
 
toniengelhardt profile image
Toni Engelhardt β€’

Ok, will wait for -rc.13. It's just strange bc if I build locally the .output/public folder is there.

Collapse
 
igortrindade profile image
Igor Trindade β€’

I just deployed a project using Nuxt3 and Vercel and it works with the config:

'build command' to nuxt generate the 'output directory' to the default *dist *...

Collapse
 
toniengelhardt profile image
Toni Engelhardt β€’

What do you mean with default dist?

Thread Thread
 
igortrindade profile image
Igor Trindade β€’

When we deploy a project to vercel, it scan's the project structure and try to offer some template settings based on the project, so the default "output directory" that Vercel's offer for a Nuxt project is the "dist" and it works well for static site generate as so for SSR...

Image description

Thread Thread
 
toniengelhardt profile image
Toni Engelhardt β€’

Thanks a lot, will give it another try πŸ™πŸ½

Thread Thread
 
toniengelhardt profile image
Toni Engelhardt β€’

Not sure if that is working correctly. Getting way worse pagespeed performance with this setting compared to SSR...

Image description

Thread Thread
 
jacobandrewsky profile image
Jakub Andrzejewski β€’

Maybe you can then try the routeRoules? Thanks to them you can decide what routes should be generated statically and what should be generated on SSR.

Thread Thread
 
toniengelhardt profile image
Toni Engelhardt β€’

That app only has one page... Theoretically the static generation should have perfect speed scores no?

Thread Thread
 
jacobandrewsky profile image
Jakub Andrzejewski β€’

Yes, theoretically. For single page it should be faster that way but maybe there document itself is really big and heavy to process by the browser while it is easier to process on the server side. Just guessing.

Thread Thread
 
toniengelhardt profile image
Toni Engelhardt β€’

Probably, it's this page: webapicheck.com

Collapse
 
leerob profile image
Lee Robinson β€’

Hey there! Good news, Nuxt on Vercel is now fully zero-configuration, including Nuxt 3: vercel.com/docs/frameworks/nuxt

Collapse
 
jacobandrewsky profile image
Jakub Andrzejewski β€’

Hey Lee!

Thanks for letting me know! This article is now a bit outdated.

I will check out the link you mention and create an updated article for it! :)

Collapse
 
kissu profile image
Konstantin BIFERT β€’

Simple, clean and efficient. πŸ‘ŒπŸ»

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

πŸ‘‹ Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Communityβ€”every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple β€œthank you” goes a long wayβ€”express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay