Skip to content
Theme
Let's talk ->

Blog/deployment

Deploying Nuxt 4 to Production

A step-by-step guide to deploying a Nuxt 4 application on Vercel, Railway or a VPS with Docker.

Sergio Jurado CasadoJul 20, 2025 · 2 min read

Deploying Nuxt 4 to Production

Building an application is only half the work. Deploying it correctly is what separates a professional project from an amateur one.

Deployment options

Vercel has native support for Nuxt. It is the simplest option:

# Install the CLI
npm i -g vercel

# Deploy
vercel

Configuration in nuxt.config.ts:

export default defineNuxtConfig({
  nitro: {
    preset: 'vercel',
  },
});

2. Railway

Railway is excellent for apps with a backend:

# railway.toml
[build]
builder = "nixpacks"

[deploy]
startCommand = "node .output/server/index.mjs"

3. Docker (VPS)

For full control, Docker is the best option:

# Dockerfile
FROM node:20-alpine AS builder
WORKDIR /app
COPY package.json bun.lock ./
RUN bun install
COPY . .
RUN bun run build

FROM node:20-alpine AS runner
WORKDIR /app
COPY --from=builder /app/.output ./.output
EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]
# docker-compose.yml
services:
  app:
    build: .
    ports:
      - '3000:3000'
    environment:
      - NODE_ENV=production
    restart: unless-stopped

Environment variables

Never hardcode secrets in the code:

# .env.production
STRIPE_SECRET_KEY=sk_live_xxx
DATABASE_URL=postgresql://...
SITE_URL=https://senseikatana.com

Deployment checklist

  • Environment variables configured
  • Build without errors (bun run build)
  • Tests passing (bun run test)
  • Clean lint (bun run lint)
  • SEO meta tags configured
  • Sitemap generated
  • Analytics configured
  • Error tracking (Sentry, etc.)
  • SSL/HTTPS active
  • Domain redirects configured

Monitoring

Once in production, you need to monitor:

  1. Uptime: UptimeRobot, Better Stack
  2. Errors: Sentry, LogRocket
  3. Performance: Vercel Analytics, Web Vitals
  4. Logs: Railway Logs, Vercel Logs

Rollback

If something goes wrong, you need to be able to revert quickly:

# Vercel
vercel rollback

# Railway
railway rollback

# Docker
docker-compose down
docker-compose up -d --build

Conclusion

Deployment is a process that must be repeatable and reliable. Automate as much as you can with CI/CD and always have a rollback plan.

In the next post I will cover how to integrate Stripe for payments in your Nuxt application.