Building for Production

Learn about single-page applications, universal applications, and static side.

Once our new site or application is built with Nuxt, the next step is to run the build process and prepare our code to be deployed.

Single-page application (SPA)

If we choose the SPA mode when creating the project (or if we set the ssr setting to false in nuxt.config.js), we can build our code as a normal front-end app.

Universal application

For SSR apps, we need to copy our project folder to a web server and first run the npm run build command. Once the application code has been built, we can run npm run start to launch the Nuxt server.

By default, the server runs on port 3000 (although this can be set in nuxt.config.js), so we’ll need to configure our web server to proxy incoming requests to the app.

The Nuxt FAQ site provides examples of configuring an NGINX proxy, as well as deploying a Nuxt app to popular platforms.

Static site

Static site generation attempts to be the best of both worlds.

In a universal app, the initially requested page is rendered on the server and returned to the browser, where the client-side code then takes over, rendering the rest of the app as the user navigates around.

Get hands-on with 1200+ tech skills courses.