Skip to Content
DeploymentVPS Deployment

🌐 Deploy on a VPS (Node.js)

You can deploy TeamKit directly on a VPS (e.g., DigitalOcean, Hetzner, AWS Lightsail) — no Docker required.

⚙️ Prerequisites

Make sure your VPS has:

  • Ubuntu 22.04+ (recommended)
  • Node.js 22+
  • npm or pnpm
  • (Optional) PM2 and Nginx for process management and reverse proxy

🚀 Deployment Steps

1. (Optional) Create a Deploy User

adduser deploy usermod -aG sudo deploy su - deploy

2. Install Required Tools

Install Node.js, npm, git, pnpm, and optionally PM2. Refer to each tool’s official documentation for installation steps:


3. Clone the Project and Install Dependencies

git clone https://github.com/your-org/your-repo.git cd your-repo pnpm install

4. Configure the Environment

Copy the example environment file and fill in your values:

cp example.env .env

If you’re using a local database, set your DATABASE_URL accordingly.


5. Build and Start the App

Build for production:

pnpm build

Start the app:

pnpm start

Your app should now be running on:

http://localhost:3000

🔄 Keep It Running (PM2)

Use PM2  to keep your app running after logout or server reboot.

Create a simple PM2 config file named ecosystem.config.js:

module.exports = { apps: [ { name: 'web-app', script: 'npm', args: 'run start', env: { NODE_ENV: 'production' } } ] };

Start and persist the process:

pm2 start ecosystem.config.js pm2 save pm2 startup

Common PM2 Commands

pm2 logs web-app # View logs
pm2 restart web-app # Restart the app

🌍 Add a Reverse Proxy (Optional)

Use Nginx to expose the app on port 80 or 443.

Install Nginx:

sudo apt install nginx

Create a config file:

sudo nano /etc/nginx/sites-available/domain-name

Add:

server { listen 80; server_name your-domain.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; } }

Enable and restart:

sudo ln -s /etc/nginx/sites-available/domain-name /etc/nginx/sites-enabled/ sudo systemctl restart nginx

(Optional) Secure with SSL:

sudo apt install certbot python3-certbot-nginx sudo certbot --nginx -d your-domain.com

✅ Done!

Your app should now be live at:

https://your-domain.com

Enjoy your deployment! 🎉

Last updated on