---
title: "Deployment and Hosting"
description: "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 ..."
last_updated: "2026-09-23T10:57:21.220999+00:00"
canonical_url: "https://www.doc0.dev/docs/8f4009b0-65bd-4480-9b00-e201f0914bb3/guide/how-to-guides/deployment-and-hosting"
---

## Overview

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.

---

## Building and Starting Your Application

### Overview

To deploy your application to a production environment, you first need to generate an optimized build and then start the production server.

### Step-by-Step Deployment Workflow

1. **Create an optimized production build:**
   Run the build command in your project root directory. This compiles your application, optimizes your bundles, and prepares routes.
   ```bash
   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.

2. **Start the production server:**
   Once the build is complete, start the production server to serve your application.
   ```bash
   npx next start
   ```

---

## Key Concepts

Understanding these key concepts will help you configure and troubleshoot your production deployment:

- **Production Build:** An optimized version of your application where code is minified, source maps are managed according to configuration, and static pages are pre-rendered.
- **Production Server:** The Node.js-powered server that handles incoming web requests, dynamic server-rendered pages, and API routes in a self-hosted or cloud environment.
- **Node.js Environment:** Next.js applications require a compatible Node.js runtime environment (version `>=20.9.0`) to run the production server successfully.

---

## Build and Start Configuration Options

When running build and start commands, you can customize behavior using flags and options. 

| Command | Option / Flag | Description |
| :--- | :--- | :--- |
| `build` | `--turbo` / `--turbopack` | Builds the application using Turbopack. |
| `build` | `--webpack` | Builds the application using webpack. |
| `build` | `--experimental-app-only` | Builds only App Router routes. |
| `build` | `--profile` | Enables production profiling for React. |
| `start` | `--port ort>` | Specifies the port number for the server to listen on. |
| `start` | `--hostname <hostname>` | Specifies the hostname for the server. |

> [!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.

## Related

- [Environment and Configuration](https://www.doc0.dev/docs/8f4009b0-65bd-4480-9b00-e201f0914bb3/guide/configuration/environment-and-configuration)
- [Caching and Revalidation](https://www.doc0.dev/docs/8f4009b0-65bd-4480-9b00-e201f0914bb3/guide/core-concepts/caching-and-revalidation)


## Sitemap

See the full [sitemap](https://www.doc0.dev/docs/8f4009b0-65bd-4480-9b00-e201f0914bb3/llms.txt) for all pages in this wiki.
