---
title: "Deploying to Production"
description: "Deploying your Next.js application to production involves creating an optimized production build and starting your application server on a cloud hosting platform or a custom server. Next.js prepare..."
last_updated: "2026-10-12T06:40:49.103345+00:00"
canonical_url: "https://www.doc0.dev/docs/8f4009b0-65bd-4480-9b00-e201f0914bb3/guide/how-to-guides/deploying-to-production"
---

## Overview

### Introduction

Deploying your Next.js application to production involves creating an optimized production build and starting your application server on a cloud hosting platform or a custom server. Next.js prepares your application by compiling code, optimizing assets, and generating static pages so your visitors experience fast load times and reliable performance.

---

### Creating a Production Build

Before deploying your application to any hosting environment, you need to generate an optimized production bundle. 

1. Open your terminal in your project's root directory.
2. Run the production build command:
   ```bash
   next build
   ```
3. Wait for the build process to finish. The output displays information about each route, bundle sizes, and any build warnings or errors.

> [!TIP]
> If you want to use Turbopack for your production build, you can include the `--turbo` or `--turbopack` flag when running the build command.

---

### Starting the Production Server

Once your project is successfully built, you can start the production server to handle live traffic.

1. Open your terminal in your project's root directory.
2. Run the start command:
   ```bash
   next start
   ```
3. The server will launch on the default port (`3000`) or the port specified by your hosting environment.

---

### Configuration and Build Options

When building or running your application for production, you can customize the process using various command-line flags.

| Flag / Option | Description |
| :--- | :--- |
| `--turbo`, `--turbopack` | Builds or starts your application using Turbopack. |
| `--webpack` | Forces the build to use the bundled webpack. |
| `--port <port>` | Specifies a custom port number for the production server. |
| `-d`, `--debug` | Enables verbose build output for troubleshooting. |
| `--profile` | Enables production profiling for React. |
| `--no-mangling` | Disables code mangling (recommended for debugging purposes only). |

---

### Troubleshooting Common Build Issues

If your build encounters problems, review the following guidelines:

> [!WARNING]
> Running code optimization with `--no-mangling` or enabling debug modes like `debug-prerender` will affect performance and should never be used for live production environments.

> [!IMPORTANT]
> If you see an error stating that native bindings are not available for Turbopack on your specific platform architecture, fall back to Webpack by running `next build --webpack`.

## Related

- [Environment and Settings](https://www.doc0.dev/docs/8f4009b0-65bd-4480-9b00-e201f0914bb3/guide/configuration/environment-and-settings)


## Sitemap

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