The last step here would be to deploy the application. With Vercel it's just a matter of running:
$ vercel
-- or --
$ vercel --prodand in a matter of seconds we will have all of our code running on a public accessible url.
On different platforms things may be slightly different, and if your not using a CI/CD integrations you will definetely need to run
$ npm run buildlocally before deploying. But remember that to deploy a SSR application we need a server running Node.js, more details can be found in the docs.
If you want to deploy a SSG solution, like the blog generated from API that we created in the first guide, you will have to run two commands:
$ npm run build
$ npx next exportthe export command is the one responsible of generating the .html & co files so if you plan to run it often a nice idea may be to take advantage of the package.json's scripts:
{
...
"build:static": "next build",
"postbuildbuild:static": "next export",
...
}so by running a single command you will get the second script running subsequentially
$ npm run build:staticat this point you will have an /out folder containing the static build that can be deployed in whatever hosting powered by a webserver that you prefer, most notable Github Pages which comes for free with every public repo. If you choose this option you may also want to add a simple GH Actions file to automatically build and publish a static website at each commit on your repository.
- Official docs
- Awesome list
- quite a lot of time and ideas to practice with all of the above...