Skip to content
Back to Deployment

Deploying Nuxt 3 Apps

Universal Vue apps with SSR, nitro server engine, and preset-based deploys to Vercel, Netlify, Cloudflare, and Node.

PlatformsIntermediate

Why

Nuxt 3's Nitro engine auto-detects the deployment target and produces optimized serverless/edge/Node bundles per preset. This gives Vue developers the same zero-config deploy experience Next.js users get on Vercel.

When

Use Nuxt 3 for Vue apps needing SSR/SSG/ISR, API routes, or edge rendering. Choose over plain Vue when SEO or server logic is required.

How

1. Set preset — nuxt.config nitro.preset or auto-detected by platform 2. Build — npm run build produces .output/ with server + public 3. Vercel/Netlify — git push, auto-detected, zero config 4. Cloudflare — nitro.preset: "cloudflare-pages", deploy with wrangler 5. Node — npm run build && node .output/server/index.mjs 6. Static — nitro.preset: "static" for full SSG, output .output/public 7. Env vars — runtimeConfig for server-side, public for client

Example

// nuxt.config.ts — Cloudflare Pages preset export default defineNuxtConfig({ nitro: { preset: "cloudflare-pages" }, runtimeConfig: { apiKey: process.env.NUXT_API_KEY, // server-only public: { siteUrl: process.env.NUXT_PUBLIC_SITE_URL }, }, }); // Dockerfile — Node server FROM node:20-alpine AS build WORKDIR /app COPY . . RUN npm ci && npm run build FROM node:20-alpine WORKDIR /app COPY --from=build /app/.output ./.output EXPOSE 3000 CMD ["node", ".output/server/index.mjs"] // package.json — static generate { "scripts": { "generate": "nuxt generate" } } // outputs .output/public

Common Problems

  • ⚠Wrong preset on platform — auto-detect fails, set nitro.preset explicitly
  • ⚠runtimeConfig exposed to client — put secrets in server-only runtimeConfig, not public
  • ⚠Cloudflare bundle too large — Node compatibility issues, use cloudflare (workers) preset with size limits

Best Practices

  • ✓Pin nitro.preset explicitly in nuxt.config to avoid auto-detect surprises across environments
  • ✓Use useRuntimeConfig() for env vars — never process.env directly in app code
  • ✓Set up health checks and graceful shutdown — handle SIGTERM to drain in-flight requests before exit

FAQ