Next.js can be deployed to any hosting provider that supports Node.js. Make sure your package.json
has the "build"
and "start"
scripts:
{ "scripts": { "dev": "next", "build": "next build", "start": "next start" } }
next build
builds the production application in the .next
folder. After building, next start
starts a Node.js server that supports hybrid pages, serving both statically generated and
server-side rendered pages.
The easiest way to deploy Next.js to production is to use the Vercel
platform from the creators of
Next.js. Vercel
is a cloud platform for static sites, hybrid apps, and Serverless Functions. Read
more about it from official docs
Netlify lets you link a GitHub, GitLab, or Bitbucket repository to a site for continuous deployment. Each time you push to your Git provider, Netlify runs a build with your tool of choice and deploys the result to their CDN.
Or order for Sample App to deploy correctly on Netlify be sure to configure the Build settings (found under >Deploy>Deploy Settings for your Site) the following way:
Read more about it from official docs
Using the Firebase CLI, you deploy files from local directories on your computer to your Hosting server. Beyond serving static content, you can use Cloud Functions for Firebase or Cloud Run to serve dynamic content and host microservices on your sites. Read more about it from official docs.