| Deployment option | Feature support |
|---|---|
| Node.js server | All features |
| Docker container | All features |
| Static export | Limited (no server-required features) |
| Adapters | Platform-specific |
Node.js server
Next.js can be deployed to any hosting provider that supports Node.js. Ensure yourpackage.json has the build and start scripts:
npm run build to build your application and npm run start to start the Node.js server. This server supports all Next.js features.
Node.js deployments support the full Next.js feature set. See the self-hosting guide for infrastructure configuration details.
Deployment templates
Docker
Next.js can be deployed to any provider that supports Docker containers, including Kubernetes and cloud providers that run Docker. Docker deployments support the full Next.js feature set. See the self-hosting guide for infrastructure configuration details.For development on Mac and Windows, use local development (
npm run dev) rather than Docker for better performance. See the local development guide.Dockerfile templates
The following examples demonstrate best practices for containerizing Next.js applications:- Docker Standalone Output — Uses
output: "standalone"to generate a minimal, production-ready Docker image with only the required runtime files and dependencies. - Docker Export Output — Uses
output: "export"to generate optimized HTML files served from a lightweight container or static hosting environment. - Docker Multi-Environment — Manages separate Docker configurations for development, staging, and production environments.
Static export
Next.js can be used as a static site or Single-Page Application (SPA), then optionally upgraded later to use server features. A static export can be deployed to any web server that serves HTML/CSS/JS static assets, including AWS S3, Nginx, and Apache. To enable static export, updatenext.config.js:
next.config.js
next build, Next.js generates an out folder with HTML/CSS/JS assets.
Deployment templates
Adapters
Next.js can be adapted to run on platforms with their own infrastructure capabilities. Refer to each provider’s documentation for supported Next.js features:A Deployment Adapters API is in development to standardize how all platforms adopt Next.js. Documentation on writing custom adapters will be added after completion.
