This article will be a demo on how you can setup a Node.js project and deploy it to NeetoDeploy. We will be using the tailwind-nextjs-starter-blog project for the demo. It is a Next.js blog template with which you can easily create your own personal portfolio or blog. You can follow along this tutorial and deploy your own version of the blog in NeetoDeploy.
-
Create an
neeto-deploy.json
file at the root of your project:{ "name": "nextjs-blog", "scripts": {}, "stack": "heroku-22", "env": { "YARN_PRODUCTION": { "value": "true" }, "NODE_MODULES_CACHE": { "value": "true" }, "YARN_CACHE": { "value": "true" } }, "formation": {}, "addons": [], "buildpacks": [ { "url": "heroku/nodejs" } ] }
Add a
.node-version
file at the root of your project with the version of node to use-
Add engines to your
package.json
file"engines": { "node": "18.12", "npm": "9.x", "yarn": "1.22.x" }
-
Add a file named
Procfile
at the root of your project mentioning the processes:release: yarn -v web: yarn serve
Since you're deploying a static website, you need to make sure of these things:
The
scripts
field inpackage.json
must contain thebuild
commandThe
scripts
filed inpackage.json
must contain a command which will serve the application at port 3000.
You can see that these two requirements are fulfilled in the tailwind-nextjs-starter-blog project.
Now that we have all the setup that we need in place, create a project in NeetoDeploy by following this guide.
Once you've created a project in NeetoDeploy and connected your repository, enable review apps. Commit all the above changes into a branch and open a pull request to the main branch. You will be able to see that the PR has shown up in the Review apps
section and is getting deployed.
Once the deployment has been finished, you should be able to view the live app.