Node.js apps need a server where you control the process, the version and the ports. A VPS gives you that. This is the set-up most teams use, from a blank server to a live app.
What a VPS gives a Node.js app
- Root access, so you install the Node version you need, with the tools you like.
- Open ports and background processes, which most shared hosting blocks.
- Resources reserved for you, so a busy minute on another customer's site does not slow your API.
- Prices in rupees. Plans start at ₹899 a month with UPI and card payments.
Pick a size
A small API, a bot or a side project fits the smallest plan (1 vCPU, 1 GB RAM, 50 GB NVMe SSD). A busy API, a Next.js site with server rendering or an app with its database on the same machine needs more memory; 2 vCPUs, 4 GB RAM, 80 GB NVMe SSD at ₹1,499 a month is a common next step. Measure memory use with real traffic and move up when it stays high.
The set-up, step by step
- First login and a normal user. Log in as root once, create a normal user, and turn on SSH keys. See the knowledge base for the commands.
- Install Node.js with the version your app targets, from the official repository or a version manager.
- Put your code on the server with Git, build it, and set its environment variables in a file that only your user can read.
- Run it under a process manager. PM2 or a systemd service restarts the app after a crash or a reboot.
- Add Nginx in front. It terminates HTTPS, serves static files and passes the rest to your app on a local port. One server can host several apps this way.
- Get a certificate from Let's Encrypt and renew it automatically.
- Turn on the firewall. Allow SSH, HTTP and HTTPS; keep your app and database ports closed to the internet.
Keep it healthy
- Log to files or to a service, and rotate the logs so the disk does not fill.
- Set a memory limit on the process manager so a leak restarts the app instead of freezing the server.
- Back up your database and uploads to a place off the server, and test a restore.
- Update the operating system and your dependencies on a schedule, and read the change notes before big upgrades.
Next step
See the Cloud VPS plans, or ask us if you want help choosing. Heavy databases or constant high load may be better on a dedicated server.