Deploying a Node.js Application
Node.js apps on ServerPlane include process management and automatic restarts. You can deploy from a Git repository or start with a generated starter app and push your code later.
Deployment Steps
- Navigate to Apps > Deploy Application.
- Select a server with an "Active" status.
- Choose "Node.js" as the application type.
- Configure the app:
- App Name — a human-readable label.
- Domain — the domain that will serve the app. DNS must already point to your server.
- Node.js Version — choose from 18 LTS, 20 LTS, or 22. The default is 20.
- Application Port — the port your app listens on. Default is
3000. Traffic from your domain is automatically routed to this port. - Git Repository (optional) — provide a repo URL to deploy existing code. You can enter it manually or browse your GitHub repos if you have connected your GitHub account.
- Branch — defaults to
main. - Build Command (optional) — e.g.,
npm run build. Runs afternpm install.
- Review and click Deploy.
What Happens During Deployment
- Required server software is installed if not already present.
- If a Git repo was provided:
- The repository is cloned to the server.
npm installruns automatically.- The build command runs if one was specified.
- If no Git repo was provided, a starter
index.jsandpackage.jsonare created so the app has something to serve immediately. - The app is started with automatic process management and restart-on-reboot persistence.
- A web server configuration is created to route your domain to the app port.
Application Port
Your Node.js app must listen on the port you specified during deployment. The port is available as the PORT environment variable. For example:
const port = process.env.PORT || 3000;
Managing the Process
App lifecycle actions (start, stop, restart) are available from the app's detail page.
Notes
- Private GitHub repositories are supported. When deploying from GitHub, ServerPlane automatically sets up a deploy key for secure access.
- SSL can be provisioned after deployment via the Domains & SSL tab.
- Environment variables can be managed through the Environment tab. The app is automatically restarted after changes.