Skip to content

Build your Next.js app

This guide will walk you through the process of building and running your Next.js app in both development and production modes.

In development mode, you can run your Next.js app with hot-reloading, which means your changes will be immediately reflected in the browser without needing a full reload.

To start the development server, use:

Terminal window
npm run dev

Building and running your Next.js app in production mode involves two main steps: creating the build and running the build.

Step 1: Create the Build

To create an optimized production build of your Next.js app, run:

Terminal window
npm run build

This command generates an optimized, static version of your app in the .next folder.

Step 2: Run the Build

After creating the build, you can start the server to serve the optimized version of your app using:

Terminal window
npm start

By following these steps, you’ll be able to build and run your Next.js app efficiently in production mode. For more information on how to deploy your Next.js app to production, check out the Deploy your Next.js app guide.