Skip to content

Publishing a prerendered Nuxt website

development

Nuxt can generate HTML and assets for static hosting when the application does not require a live Nuxt server for the deployed features.

01 Check access and requirements

List dynamic routes, server endpoints and data needed at build time. Decide how browser-only interactive features will access any separate backend.

02 Publish a prerendered Nuxt website

  1. Configure the intended rendering mode and prerender routes. Ensure important dynamic URLs are included even when a crawler cannot discover them through ordinary links.

  2. Run the supported generation or prerender build with the correct public configuration. Review failed routes and data-fetching errors rather than ignoring them.

  3. Publish the generated .output/public directory to the website document root. Do not expose the source project or private build configuration.

  4. Configure fallback and not-found behavior according to the generated files and the hosting server. Preserve proper behavior for genuinely missing pages.

  5. Test direct visits and browser refreshes on nested routes, including a route that was explicitly added to the prerender list.

03 Confirm the expected result

Verify pages contain the expected public content without a local Nuxt process. Check links, assets, forms and any external API connection from the deployed hostname.

04 Resolve setup problems

If a route appears only after navigating from the homepage, inspect prerender coverage and fallback handling. A missing server endpoint cannot be restored with an HTML rewrite.

05 A common question

Can a static deployment run Nuxt server API routes?

The static output does not include a running server for those routes. Move the operation to a supported backend or choose a Node server deployment.

06 Example: confirm a generated site works without a development server

For a brochure site generated with Nuxt, test the deployed output as static files before directing customers to it. A successful local development session does not prove that every nested route has been generated.

  1. List important pages, including routes created from content or external data.
  2. Build using the project's configured generation process and inspect the output directory reported by that build.
  3. Serve that output through a static web server. Open nested pages directly and refresh them, rather than reaching each page only by clicking from the home page.
  4. Check images, fonts, canonical links and the site's behaviour when a requested page does not exist.

What happens to features that need a server?

A static deployment cannot provide a server endpoint simply because one existed during development. Forms, private data and live application logic need their intended backend service. Do not embed private API keys in generated browser files to replace that backend.

When asking our team about deployment, state whether the project is generated static output or a running Node.js service. Include the build command and output path, with secrets removed. This helps us guide you to the appropriate hosting setup instead of treating two different deployment modes as interchangeable.

07 Sources and further reading

Was this answer helpful?

Need a little more help?

Our support team can help you find the next step.

Contact support