You've built your Nuxt 4 application, it works beautifully on localhost, and now it's time to share it with the world. Deployment can feel daunting with all the options available — SSR vs static, Node.js vs edge, self-hosted vs platform — but it doesn't have to be. This guide walks through the process step by step.
Choosing Your Rendering Strategy
Before deploying, you need to decide how your app will render. Nuxt 4 supports three modes:
Server-Side Rendering (SSR) — Pages are rendered on the server for each request. Best for dynamic content, SEO-critical pages, and applications with authenticated content. Requires a Node.js server.
Static Site Generation (SSG) — Pages are pre-rendered at build time. Best for blogs, documentation, marketing sites, and content that doesn't change per-request. Can be hosted on any static file server.
Hybrid Rendering — Mix and match per-route. Your marketing pages can be static while your dashboard uses SSR. This is often the sweet spot for real applications.
Preparing for Production
Before you deploy anything, run through this checklist:
1. Environment Variables
Move all secrets to environment variables. Never hardcode API keys, database credentials, or service tokens. Nuxt 4 uses runtimeConfig for this — server-side values stay on the server, public values are exposed to the client.
2. Build and Test Locally
Run the production build locally first. This catches issues that don't appear in development mode — missing dependencies, SSR-incompatible code, and build-time errors.
3. Performance Audit
Run Lighthouse on your production build. Check for render-blocking resources, unoptimized images (use @nuxt/image), and missing meta tags. Fix issues before deploying, not after.
Deploying to a Node.js Server
For SSR deployments, you need a Node.js server. Here's the minimal setup:
Build your application with the Node.js preset (the default). This outputs a self-contained server in the .output directory. Upload this directory to your server and run the entry point. Use a process manager like PM2 to keep it running and handle restarts.
Deploying as a Static Site
For static deployments, generate your site. This creates a dist directory with plain HTML, CSS, and JavaScript. Upload this to any static hosting provider — GitHub Pages, Netlify, Vercel, Cloudflare Pages, or even a simple Nginx server.
Setting Up CI/CD
Automate your deployments with GitHub Actions. A basic workflow builds on push to main, runs tests, and deploys if everything passes. This eliminates manual deployment steps and ensures every deployment is tested.
Post-Deployment Checklist
After your first deployment, verify the following:
- All pages load without errors
- SEO meta tags are present in the HTML source
- Images are served in optimized formats
- HTTPS is working correctly
- Environment variables are set in production
- Error monitoring is configured (Sentry, etc.)
Common Pitfalls
Client-only code in SSR context. If you access window, document, or browser-only APIs during SSR, you'll get errors. Use the ClientOnly component or check process.client.
Missing environment variables. The build succeeds locally because you have a .env file, but fails in CI because the variables aren't set. Always configure environment variables in your deployment platform.
Large bundle sizes. Use nuxt analyze to identify heavy dependencies. Consider lazy-loading routes and components that aren't needed on initial page load.
Deployment is a skill that improves with practice. Start with the simplest option that meets your needs, and optimize from there.