nextjs/start-server

Start Production Server

Run the optimized Next.js app in production mode after building.

start
production
server
deployment

Command

npm run start

Explanation

After running `next build`, the `next start` command launches a lightweight Node.js server that serves the compiled pages. It runs without development tooling and is optimized for performance and scalability. The app must be built before running this command.

Common Use Cases

  • Run production-ready application locally for testing
  • Serve static and SSR content from a Node.js environment
  • Deploy manually to custom hosting platforms

Best Practices

  • Use process managers like PM2 or Docker for uptime management
  • Serve via reverse proxies (Nginx) in production
  • Ensure NODE_ENV=production is set before starting

Common Mistakes to Avoid

  • Running `next start` without building first
  • Trying to edit code while in production mode

Troubleshooting

Problem: App not starting

Solution: Ensure `.next/` folder exists (run `npm run build` first).

Problem: Port already in use

Solution: Run `npm run start -- -p 4000` to use a different port.

Examples

Start production server on default port 3000

npm run start

Start server on custom port 4000

npm run start -- -p 4000