Getting Started
Core Concepts
Troubleshooting
Deploying a production-ready Next.js application involves creating an optimized build and hosting it on a cloud platform or self-hosted environment. Next.js provides built-in tools to prepare your application for production, manage server execution, and ensure high performance.
This guide covers how to build your application, start the production server, and understand the core options available for deployment and hosting.
To deploy your application to a production environment, you first need to generate an optimized build and then start the production server.
Create an optimized production build: Run the build command in your project root directory. This compiles your application, optimizes your bundles, and prepares routes.
npx next build(Optional) You can pass specific options during the build phase:
--turbo or --turbopack: Builds using Turbopack.--webpack: Builds using webpack.--experimental-app-only: Builds only App Router routes.Start the production server: Once the build is complete, start the production server to serve your application.
npx next startUnderstanding these key concepts will help you configure and troubleshoot your production deployment:
>=20.9.0) to run the production server successfully.When running build and start commands, you can customize behavior using flags and options.
Note
Make sure your hosting environment satisfies the minimum Node.js engine requirement (>=20.9.0) before running your production build or start commands.
Tip
If you are migrating from older versions, note that the legacy next export command has been removed. Use static export configuration in your project settings instead.