Next.js can be deployed to any hosting provider that supports Node.js.
If you’ve followed the instructions so far, your package.json
should have build
and start
scripts:
{ "scripts": { "dev": "next", "build": "next build", "start": "next start" } }
In your own hosting provider, run the build
script once, which builds the production application in the .next
folder.
npm run build
After building, the start
script starts a Node.js server that supports hybrid pages, serving both statically generated and server-side rendered pages, and API Routes.
npm run start
Tip: You can customize the
start
script inpackage.json
to accept aPORT
parameter by updating it as:"start": "next start -p $PORT"
.
That’s it! If you have questions about deploying Next.js, you can ask our community on GitHub Discussions.