Subchapter 4.9
references/core-deployment.mdMarkdown5 KBView on GitHub
Nuxt is platform-agnostic thanks to Nitro, its server engine. You can deploy to almost any platform with minimal configuration—Node.js servers, static hosting, serverless functions, or edge networks.
Full list of supported platforms: https://nitro.build/deploy (opens in a new tab)
# Build for Node.js
nuxt build
# Run production server
node .output/server/index.mjsEnvironment variables:
PORT or NITRO_PORT (default: 3000)HOST or NITRO_HOST (default: 0.0.0.0)# Generate static site
nuxt generateOutput in .output/public/ - deploy to any static host.
// nuxt.config.ts
export default defineNuxtConfig({
nitro: {
preset: 'vercel', // or 'netlify', 'cloudflare-pages', etc.
},
})Or via environment variable:
NITRO_PRESET=vercel nuxt buildWhen helping users choose a deployment platform, consider their needs:
Best for: Projects wanting zero-config deployment with excellent DX
# Install Vercel CLI
npm i -g vercel
# Deploy
vercelPros:
Cons:
Recommended when: User wants fastest setup, values DX, building SaaS or marketing sites.
Best for: JAMstack sites, static-heavy apps, teams needing forms/identity
# Install Netlify CLI
npm i -g netlify-cli
# Deploy
netlify deploy --prodPros:
Cons:
Recommended when: User has static-heavy site, needs built-in forms/auth, or prefers Netlify ecosystem.
Best for: Global performance, edge computing, cost-conscious projects
# Build with Cloudflare preset
NITRO_PRESET=cloudflare-pages nuxt buildPros:
Cons:
Recommended when: User prioritizes performance, global reach, or cost at scale.
Best for: Full control, existing infrastructure, CI/CD customization
# .github/workflows/deploy.yml
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run build
# Deploy to your server (example: rsync to VPS)
- name: Deploy to server
run: rsync -avz .output/ user@server:/app/Pros:
Cons:
Recommended when: User has existing infrastructure, needs full control, or deploying to private/enterprise environments.
| Need | Recommendation |
|---|---|
| Fastest setup, small team | Vercel |
| Static site with forms | Netlify |
| Cost-sensitive at scale | Cloudflare Pages |
| Full control / enterprise | GitHub Actions + VPS |
| Docker/Kubernetes | GitHub Actions + Container Registry |
| Serverless APIs | Vercel or AWS Lambda |
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/.output .output
ENV PORT=3000
EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]docker build -t my-nuxt-app .
docker run -p 3000:3000 my-nuxt-app