|
|
--- |
|
|
title: Deploying |
|
|
description: Learn how to deploy your Next.js application. |
|
|
--- |
|
|
|
|
|
Next.js can be deployed as a Node.js server, Docker container, static export, or adapted to run on different platforms. |
|
|
|
|
|
| Deployment Option | Feature Support | |
|
|
| -------------------------------- | ----------------- | |
|
|
| [Node.js server](#nodejs-server) | All | |
|
|
| [Docker container](#docker) | All | |
|
|
| [Static export](#static-export) | Limited | |
|
|
| [Adapters](#adapters) | Platform-specific | |
|
|
|
|
|
## Node.js server |
|
|
|
|
|
Next.js can be deployed to any provider that supports Node.js. Ensure your `package.json` has the `"build"` and `"start"` scripts: |
|
|
|
|
|
```json filename="package.json" |
|
|
{ |
|
|
"scripts": { |
|
|
"dev": "next dev", |
|
|
"build": "next build", |
|
|
"start": "next start" |
|
|
} |
|
|
} |
|
|
``` |
|
|
|
|
|
Then, run `npm run build` to build your application and `npm run start` to start the Node.js server. This server supports all Next.js features. If needed, you can also eject to a [custom server](/docs/app/guides/custom-server). |
|
|
|
|
|
Node.js deployments support all Next.js features. Learn how to [configure them](/docs/app/guides/self-hosting) for your infrastructure. |
|
|
|
|
|
### Templates |
|
|
|
|
|
- [Flightcontrol](https: |
|
|
- [Railway](https: |
|
|
- [Replit](https: |
|
|
|
|
|
## Docker |
|
|
|
|
|
Next.js can be deployed to any provider that supports [Docker](https: |
|
|
|
|
|
Docker deployments support all Next.js features. Learn how to [configure them](/docs/app/guides/self-hosting) for your infrastructure. |
|
|
|
|
|
> **Note for development:** While Docker is excellent for production deployments, consider using local development (`npm run dev`) instead of Docker during development on Mac and Windows for better performance. [Learn more about optimizing local development](/docs/app/guides/local-development). |
|
|
|
|
|
### Templates |
|
|
|
|
|
- [Docker](https: |
|
|
- [Docker Multi-Environment](https: |
|
|
- [DigitalOcean](https: |
|
|
- [Fly.io](https: |
|
|
- [Google Cloud Run](https: |
|
|
- [Render](https: |
|
|
- [SST](https: |
|
|
|
|
|
## Static export |
|
|
|
|
|
Next.js enables starting as a static site or [Single-Page Application (SPA)](/docs/app/guides/single-page-applications), then later optionally upgrading to use features that require a server. |
|
|
|
|
|
Since Next.js supports [static exports](/docs/app/guides/static-exports), it can be deployed and hosted on any web server that can serve HTML/CSS/JS static assets. This includes tools like AWS S3, Nginx, or Apache. |
|
|
|
|
|
Running as a [static export](/docs/app/guides/static-exports) **does not** support Next.js features that require a server. [Learn more](/docs/app/guides/static-exports#unsupported-features). |
|
|
|
|
|
### Templates |
|
|
|
|
|
- [GitHub Pages](https: |
|
|
|
|
|
## Adapters |
|
|
|
|
|
Next.js can be adapted to run on different platforms to support their infrastructure capabilities. |
|
|
|
|
|
Refer to each provider's documentation for information on supported Next.js features: |
|
|
|
|
|
- [AWS Amplify Hosting](https://docs.amplify.aws/nextjs/start/quickstart/nextjs-app-router-client-components) |
|
|
- [Cloudflare](https://developers.cloudflare.com/workers/frameworks/framework-guides/nextjs) |
|
|
- [Deno Deploy](https://docs.deno.com/examples/next_tutorial) |
|
|
- [Netlify](https://docs.netlify.com/frameworks/next-js/overview/#next-js-support-on-netlify) |
|
|
- [Vercel](https://vercel.com/docs/frameworks/nextjs) |
|
|
|
|
|
> **Note:** We are working on a [Deployment Adapters API](https://github.com/vercel/next.js/discussions/77740) for all platforms to adopt. After completion, we will add documentation on how to write your own adapters. |
|
|
|