Deploy Node.js
Prepare the repository
Commit package.json and the lockfile used by the project. Provide a production start script:
{
"scripts": {
"start": "node server.js"
}
}Replace the command with the actual production entry point. The application must listen on the runtime port, commonly exposed through PORT.
Deploy
- Connect the repository.
- Select the branch.
- Let the agent detect the Node.js runtime, dependency file, root directory, build command, and port.
- Add required environment variables.
- Review the detected build and start commands.
- Deploy and follow build output.
For monorepos, set the root directory to the package containing the deployable service. Use Procfile commands when the environment needs separate web and worker processes.