{
  "id": 12173648,
  "title": "How to Move a Node API From a Free Host to a VPS (Step by Step)",
  "url": "https://urgent.news/2026/10/05/how-to-move-a-node-api-from-a-free-host-to-a-vps-step-by-step",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-05T14:58:09.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/arthur_luca/how-to-move-a-node-api-from-a-free-host-to-a-vps-step-by-step-3koh"
  },
  "original_language": "en",
  "account": "To move a Node.js API from a free host to a VPS, follow these steps:\n\n1. Set up a non-root user on your VPS for security. Connect using SSH:\n```\nssh root@YOUR_SERVER_IP\n```\nCreate the new user:\n```\nadduser deploy\nusermod -aG sudo deploy\n```\n\n2. Install Node.js and Nginx on your server:\n```\nsudo apt update && sudo apt upgrade -y\ncurl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -\nsudo apt install -y nodejs nginx git\n```\n\n3. Configure the firewall with UFW (Uncomplicated Firewall). Allow SSH and Nginx:\n```\nsudo ufw allow OpenSSH\nsudo ufw allow 'Nginx Full'\nsudo ufw enable\n```\n\n4. Move your application repository to the new user's home directory and install dependencies:\n```\ncd /home/deploy\ngit clone https://github.com/YOUR_USER/YOUR_REPO.git api\ncd api\nnpm ci --omit=dev\n```\n\n5. Use systemd to keep Node.js running. Create an environment file and systemd service file:\n```\nsudo nano /etc/api.env\nDATABASE_URL=postgres://...\nJWT_SECRET=change-this\nsudo chmod 600 /etc/api.env\nsudo nano /etc/systemd/system/api.service\n```\n\n6. Configure Nginx as a reverse proxy for Node.js. Create a new Nginx configuration file:\n```\nsudo nano /etc/nginx/sites-available/api.example.com\n```\nAdd the following configuration:\n```\nserver {\nlisten 80;\nserver_name api.example.com;\n\nlocation / {\nproxy_pass http://localhost:3000;\nproxy_set_header Host $host;\nproxy_set_header X-Real-IP $remote_addr;\n}\n}\n```\n\nEnable the configuration and test it:\n```\nsudo ln -s /etc/nginx/sites-available/api.example.com /etc/nginx/sites-enabled/\nsudo nginx -t\n```\n\n7. Redirect HTTP to HTTPS by creating another Nginx configuration file for HTTPS:\n```\nsudo nano /etc/nginx/sites-available/api.example.com-ssl\n```\nAdd this configuration:\n```\nserver {\nlisten 443 ssl;\nserver_name api.example.com;\n\nssl_certificate /path/to/your/certificate.crt;\nssl_certificate_key /path/to/your/certificate.key;\n\nlocation / {\nproxy_pass http://localhost:3000;\nproxy_set_header Host $host;\nproxy_set_header X-Real-IP $remote_addr;\n}\n}\n```\n\nEnable this configuration:\n```\nsudo ln -s /etc/nginx/sites-available/api.example.com-ssl /etc/nginx/sites-enabled/\n```\n\n8. Restart Nginx:\n```\nsudo systemctl restart nginx\n```\n\n9. Start the Node.js service using systemd and enable it to start on boot:\n```\nsudo systemctl enable --now api\n```\n\n10. Test your application by curl-ing the health endpoint:\n```\ncurl http://127.0.0.1:3000/health\n```\n\nYour Node.js API should now be running on your VPS with HTTPS enabled and managed by systemd.",
  "summary": "Hi, I'm Arthur. Free hosting is a great way to get your first backend online. You can build an API, connect a frontend, test your idea, and start getting users without worrying about server costs. But eventually, you may notice things like cold starts, memory limits, sleeping applications, restricted background processes, or simply no SSH access when something goes wrong. That's usually when a…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}