Skip to content

Deployment Overview

Architecture

All three projects are deployed to a VPS (Virtual Private Server) and managed with PM2 process manager. There is no Docker or containerization — the applications run directly on the server.

┌──────────────────────────────────────────┐
│                 VPS                       │
│                                           │
│  ┌──────────────────┐   Port 3000        │
│  │ Express API      │   api.myeasyguide  │
│  │ (PM2 process)    │   .com              │
│  └──────────────────┘                     │
│                                           │
│  ┌──────────────────┐   Port 3001        │
│  │ Next.js Frontend │   myeasyguide.com   │
│  │ (PM2 process)    │                     │
│  └──────────────────┘                     │
│                                           │
│  ┌──────────────────┐                     │
│  │ PostgreSQL        │   Port 5432        │
│  │ - walkthroughnepal│                     │
│  │ - cms_myeasyguide │                     │
│  └──────────────────┘                     │
│                                           │
│  ┌──────────────────┐                     │
│  │ Nginx (reverse   │   Port 80/443      │
│  │ proxy)           │   SSL termination   │
│  └──────────────────┘                     │
└──────────────────────────────────────────┘

PM2 Process Names

ApplicationBranchPM2 NamePort
Express API (production)mainapi.walkthroughnepal.com3000
Express API (staging)devstaging.api.walkthroughnepal.com9000
Frontend (production)mainmyeasyguide.com3001
Frontend (staging)devstaging.myeasyguide.com9001

Server Setup

The server runs:

  • Ubuntu (or similar Linux distribution)
  • Node.js (managed via nvm)
  • PostgreSQL (database server)
  • Nginx (reverse proxy, SSL termination with Let's Encrypt)
  • PM2 (process manager)
  • pnpm (package manager)

Nginx Reverse Proxy

Nginx proxies requests to the appropriate PM2 process based on the domain:

api.myeasyguide.com → localhost:3000
myeasyguide.com    → localhost:3001
cms.myeasyguide.com → (CMS — possibly deployed separately)

SSL certificates are managed with Let's Encrypt (Certbot).

Deployment Process

Deployments are automated via GitHub Actions CI/CD pipelines. The workflow:

  1. Push to branch triggers deployment workflow
  2. GitHub Actions runs on the runner:
    • Checkout code
    • Setup pnpm
    • Install dependencies
    • Generate Prisma client
    • TypeScript check
    • Build
    • Upload artifacts
  3. SSH into VPS via appleboy/ssh-action:
    • Navigate to app directory
    • git pull (or git reset --hard for frontend)
    • pnpm install --frozen-lockfile
    • pnpm build
    • pm2 restart <process-name>

Manual Deployment

If CI/CD is unavailable, deploy manually:

bash
ssh user@vps
cd /path/to/api.myeasyguide.com  # or myeasyguide.com
git pull origin main
pnpm install --frozen-lockfile
pnpm build
pm2 restart api.walkthroughnepal.com  # or myeasyguide.com

Infrastructure Files

ProjectCI/CD Files
API.github/workflows/ci-cd.yml (production), .github/workflows/staging.yml
Frontend.github/workflows/deploy.yml (production), .github/workflows/staging.yml

The CMS does not have CI/CD workflow files in the repository. It may be deployed manually or through a different mechanism (e.g., Vercel).

Built with VitePress