Apply for Free VPS

Deploy a Node.js application

Updated 27 Nov 2026 deployment nodejs

Install Node.js, run your app as a service and put a proxy in front.

Install Node.js

Distribution packages may be old. Use the version your project requires, following the instructions on nodejs.org. Check:

node --version
npm --version

A dedicated user and folder

sudo adduser --system --group --home /srv/app app
sudo git clone https://example.com/your/repo.git /srv/app/current
sudo chown -R app:app /srv/app
cd /srv/app/current && sudo -u app npm ci --omit=dev

If your build needs development packages, run npm ci, then the build.

Service

/etc/systemd/system/app.service:

[Service]
User=app
WorkingDirectory=/srv/app/current
Environment=NODE_ENV=production PORT=3000
ExecStart=/usr/bin/node server.js
Restart=on-failure
MemoryMax=500M

[Install]
WantedBy=multi-user.target

Check the path with command -v node.

sudo systemctl daemon-reload && sudo systemctl enable --now app
journalctl -u app -f

Expose it

Listen on 127.0.0.1 and add an Nginx reverse proxy.

Builds on small servers

If a build runs out of memory, add swap or build elsewhere and copy the result.

Was this helpful?

Report outdated or incorrect information