LearnAI ToolsCareerPractice BuildsPlayContact
Lesson 4816 min read

Deploying Next.js Apps

Take a Next.js app to production on Vercel and understand what changes when deploying to other platforms.

Deploying to Vercel

Vercel, the creator of Next.js, offers the most seamless deployment path: connect a GitHub repository, and every push builds and deploys automatically, with zero configuration needed for a standard project.

Push to GitHub
↓
Vercel detects the push
↓
Runs npm run build
↓
Deploys to a global edge network
↓
Live URL updates

What Vercel Handles Automatically

Global CDN

Static and cached pages serve from edge locations close to each visitor.

Server Functions

SSR pages and Route Handlers run as serverless/edge functions automatically.

Image Optimization

next/image is served through Vercel's image optimization pipeline with no setup.

Preview Deployments

Every pull request gets its own live preview URL automatically.

Deploying Elsewhere

Next.js is not locked to Vercel — it can run as a standard Node.js server, or as static export for content that's entirely static.

PlatformNotes
A Node.js server (any host)Run next build then next start; supports the full feature set including SSR and Route Handlers.
Netlify / other Jamstack hostsSupported via platform-specific adapters; check current support for newer features like Server Actions.
Static export (output: "export")Produces plain HTML/CSS/JS with no server — only works for fully static apps with no SSR, Route Handlers, or Server Actions.
Docker / self-hostedNext.js supports a "standalone" output mode that bundles only what's needed to run the server in a minimal container.
Static Export Has Real Limits

output: "export" disables anything that needs a server at request time — no SSR, no Route Handlers, no Server Actions, no Image Optimization API. Confirm your app doesn't depend on those before choosing it.

A Pre-Deployment Checklist

  • Run npm run build locally and fix any errors or warnings.
  • Set all required environment variables in your hosting platform's dashboard.
  • Confirm remote image domains are configured in next.config.js.
  • Double check that no secret values leaked into a NEXT_PUBLIC_ variable.
  • Test the production build locally with npm run start before deploying.

FAQs

No — it's the most convenient option since it's built by the same team, but Next.js apps run on many other platforms with varying levels of feature support.

Not by default — set up a CI pipeline (e.g. GitHub Actions) to run your test suite before or alongside deployment if you want that gate.

Summary

Vercel offers the smoothest path to production, while Next.js itself remains portable to Node.js servers, containers, and other platforms depending on your needs. In the final lesson, you'll review the best practices and common mistakes that tie this whole course together.

Next Lesson →

Best Practices & Common Mistakes