DEV Community

Sarah Varghese
Sarah Varghese

Posted on

Deploying a Node.js App on a VPS: A Practical Guide for 2025

Introduction

Node.js has become one of the most popular choices for building scalable, high-performance web applications. Its non-blocking, event-driven architecture makes it ideal for applications that handle multiple simultaneous connections, like chat apps, real-time dashboards, or APIs.

When I picked up a freelancing project for a Dubai-based client, I needed a reliable environment to deploy their web app without worrying about downtime or slow loading. That’s when I decided to use a VPS, specifically a plan with 4 vCPU cores, 8 GB RAM, and 200 GB SSD storage — more than enough for a small to medium Node.js app. Plus, I had a 50% discount coupon on Webaon, which made the choice even easier and cost-effective.

Why Use Node.js for Your Project

High Performance: Handles concurrent requests efficiently.

JavaScript Everywhere: Same language on the frontend and backend.

Active Ecosystem: Tons of libraries, frameworks, and tutorials available.

Lightweight & Fast: Ideal for microservices or serverless-like deployments.

For small projects like mine, Node.js ensures that the app responds quickly even when multiple users are connected at once.

Why VPS is a Better Choice

While shared hosting is cheap and easy, it has limitations:

Limited CPU/RAM — may slow down with more users

No full control over server environment

Restrictions on installing custom software

A VPS solves these problems:

Full root access to configure the server as needed

Dedicated resources — your app doesn’t compete with others

Better security and ability to handle traffic spikes

For my freelancing client, this setup ensured fast response times, SSL support, and full control over deployment, without paying for an expensive dedicated server.

Picking a VPS:

Some popular VPS options:

DigitalOcean – Beginner-friendly, widely used

GoDaddy– Beginner-friendly, widely used

AWS Lightsail – Preconfigured VPS instances

Self-managed VPS – Complete control over server setup

Webaon – I personally used Webaon for this project because i had discount coupon of it. With a 50% discount coupon, it was cost-effective and offered a smooth VPS setup suitable for my Node.js deployment.

Example plan used: 4 vCPU | 8 GB RAM | 200 GB SSD | ₹2,999/month

Preparing the VPS

After provisioning the VPS, I set it up like this:

Update packages

sudo apt update && sudo apt upgrade -y

Install Node.js and npm

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs

Install PM2 for process management

sudo npm install -g pm2

Tips:

Use SSH key authentication for security.

Configure UFW firewall to allow only necessary ports: 22 (SSH), 80 (HTTP), 443 (HTTPS).

Deploying the Node.js App

Clone the repository:

git clone https://github.com/username/my-app.git
cd my-app
npm install

Start the app with PM2:

pm2 start index.js --name my-app
pm2 save
pm2 startup

Configure Nginx as a reverse proxy:

server {
listen 80;
server_name myapp.com;

location / {
    proxy_pass http://localhost:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}
Enter fullscreen mode Exit fullscreen mode

}

Enable SSL using Certbot for HTTPS.

Performance and Monitoring

Monitor CPU and RAM usage to handle traffic spikes.

PM2 monitoring (pm2 monit) helps track running processes.

SSD storage ensures faster read/write operations, reducing response time.

Other helpful tools:

Docker – Containerize apps for easier deployment

Prometheus / UptimeRobot – Monitor server uptime

Nginx – Reverse proxy and load balancing

Freelancing Tip: How VPS Helped Me Win a Client

By using a VPS setup with Node.js, I could deliver a fully functional, high-performance web app for my Dubai-based client. The setup allowed me to:

Quickly deploy updates

Handle moderate traffic without downtime

Demonstrate professionalism and technical expertise

Using Webaon with the discount made it even easier to set up a professional environment without breaking the budget, helping me deliver a quality solution as a freelancer.

Conclusion

Using Node.js with a VPS is a powerful combination for small to medium projects. With full control over server resources, you can optimize performance, implement security best practices, and scale your app as needed.

Services like Webaon make provisioning and managing VPS instances simple and reliable. Pair that with PM2, Nginx, and monitoring tools, and you have a production-ready environment suitable for freelance projects or personal apps.

✅ Key Takeaways:

Node.js offers high performance, scalability, and a unified JavaScript environment.

VPS provides dedicated resources, security, and flexibility over shared hosting.

Using Webaon with a discount can make professional VPS deployment affordable.

Freelancers can leverage VPS setups to deliver professional results and impress clients.

Top comments (0)