🏁 Ultimate Deployment Guide
This guide provides everything you need to take your WhatsApp Bridge Service from local code to a 24/7 production environment. No external searching required.
🛠️ Prerequisites
Before you start, ensure you have:
- WhatsApp Account: A dedicated phone or virtual number for the bridge.
- Hosting: A server (VPS) or a cloud platform (Render/Railway).
- Domain (Optional): Needed if you want a professional URL like
bridge.yourdomain.com.
🏗️ 1. Oracle Cloud (Always Free ARM) - BEST VALUE
Oracle offers a "Forever Free" tier that is perfect for this service.
Step 1: Create Your Instance
- Sign up at Oracle Cloud.
- Navigate to Compute > Instances > Create Instance.
- Image and Shape: Select Ubuntu 22.04 and for Shape select Ampere (ARM) with 1-4 OCPUs and 6-24GB RAM.
- Networking: Ensure "Assign a public IPv4 address" is checked.
- SSH Keys: Download your Private Key (
.keyor.pub).
Step 2: Open Firewall (VCN)
By default, Oracle blocks all ports. You MUST open 3001:
- Go to your Instance Details > Click the Subnet link.
- Click the Default Security List.
- Click Add Ingress Rules:
- Source CIDR:
0.0.0.0/0 - IP Protocol:
TCP - Destination Port Range:
3001 - Description:
WhatsApp Bridge API
- Source CIDR:
Step 3: Connect to your Server
# On your local machine (using the key you downloaded)
chmod 400 your_oracle_key.key
ssh -i your_oracle_key.key ubuntu@YOUR_INSTANCE_IP🏰 2. Hostinger VPS (Easiest KVM Setup)
Hostinger's KVM VPS is highly optimized for Node.js performance.
- Sign Up: Sign Up via Hostinger
- Plan: Select "KVM VPS 1" or higher.
- Setup: Choose Ubuntu 22.04 during the initial setup wizard.
- Login: Hostinger will provide you with a Root Password. SSH in using:bash
ssh root@YOUR_HOSTINGER_IP
⚡ 3. Railway.app & Render.com (No-Server Setup)
Perfect for those who don't want to manage a Linux terminal.
Railway.app (Recommended)
- Sign Up: Sign Up via Railway
- New Project: Create from GitHub Repo.
- Variables: Add
API_KEYandPORT=3001. - Persistence (CRITICAL):
- Go to Settings > Volumes.
- Add a Volume mounted at
/app/auth(to keep your WhatsApp login) and/app/logs(for audit logs).
Render.com (Simple Web Services)
- Sign Up: Sign Up via Render
- Web Service: Connect your GitHub repo.
- Disk: Add a Persistent Disk mounted at
/app/auth. Note: Render does not currently offer a public referral program.
Fly.io (The Modern MicroVM) - HIGH PERFORMANCE
- Sign Up: Sign Up via Fly.io
- Install
flyctl: Follow the official guide to install the CLI on your machine. - Deploy:bash
# Login and Launch fly auth login fly launch # Create Volume for Persistence (1GB) fly volumes create wa_data --size 1 # Deploy (Uses the Project's fly.toml) fly deploy
Note: Fly.io does not currently offer a public referral program.
🏗️ 4. DigitalOcean (The Developer Standard)
DigitalOcean offers both a simple "App Platform" and traditional "Droplets" (VPS).
- Sign Up: Sign Up via DigitalOcean
- App Platform (Managed):
- Similar setup to Railway/Render.
- Add a Volume for
/app/auth.
- Droplets (VPS):
- Deploy a $4-6/mo Droplet with Ubuntu.
- Follow the Server Essentials guide below.
⚙️ 5. Server Essentials (The Zero-to-Live Commands)
Once logged into your Ubuntu/Linux server, run these in order:
1. Install Node.js (Standard: 18+)
The bridge is designed for Node.js 18 or 20. These versions are required for modern security, V8 performance, and long-term ecosystem stability.
# Recommended for standard servers (Node 20)
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs2. Setup the Project
git clone https://github.com/ahtesham-clcbws/whatsapp-bridge-service.git
cd whatsapp-bridge-service
npm install3. Configure Environment
cp .env.example .env
nano .env
# Edit your API_KEY and PORT here, then CTRL+O (Save) and CTRL+X (Exit)4. 24/7 Persistence (PM2)
sudo npm install -g pm2
pm2 start src/index.js --name "wa-bridge"
pm2 save
pm2 startup
# (Copy and paste the command generated by the startup command)🌐 5. Advanced: Custom Domain & SSL (HTTPS)
If you have a domain, use Nginx to add SSL security.
1. Install Nginx
sudo apt update
sudo apt install nginx -y2. Configure Nginx Proxy
sudo nano /etc/nginx/sites-available/wa-bridgePaste this (Replace bridge.yourdomain.com):
server {
server_name bridge.yourdomain.com;
location / {
proxy_pass http://localhost:3001;
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 it:
sudo ln -s /etc/nginx/sites-available/wa-bridge /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx3. Add Free SSL (Certbot)
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d bridge.yourdomain.com🍓 6. Raspberry Pi & ARM Boards (Mini-Computer)
This bridge is specifically designed to be Zero-Bloat, making it ideal for 24/7 Raspberry Pi setups.
Performance Tuning for ARM
- Memory: Ensure at least 512MB RAM is free.
- Node Choice: Use Node 18 if possible; it has the best performance-to-security ratio on ARMv7/v8.
- SQLite Latency: Use a high-quality (Class 10) SD card to avoid database write lag during session archiving.
24/7 Reliability
If your Pi is in a remote location, we recommend setting up a daily automated health check:
# Add to crontab to check every hour
* * * * * curl -f http://localhost:3001/health || pm2 restart wa-bridge🏰 7. Self-Hosting: MacBook Air (Legacy macOS)
If you are using an older Mac (Big Sur 11.7) as your 24/7 server, use Localtunnel to bypass modern library crashes.
Step 1: Install & Start
npm install -g localtunnel
pm2 start "lt --port 3001 --subdomain your-name" --name wa-tunnel --max-restarts 10Step 2: Protocol Bypass (Laravel/API)
Localtunnel requires a header to skip its intervention page. Add this to your API requests:
'headers' => [
'bypass-tunnel-reminder' => 'true'
]🆙 8. Modernizing Your Bridge (v3.7.0 Update)
If you are running an older version (v1.x or v2.x), follow these steps to upgrade to the latest enterprise-grade features.
IMPORTANT
Backup your session! Before any update, ensure you have a copy of your auth/ directory. This contains your WhatsApp link data.
Option A: The Automated Upgrade (Recommended)
We provide a simple script to handle the backup, code pull, and restart automatically.
# Run the official upgrade script
chmod +x scripts/upgrade.sh
./scripts/upgrade.shOption B: The Manual Upgrade
If you prefer to run commands manually or use a custom git setup:
- Stop the Service:bash
pm2 stop wa-bridge - Pull Latest Code:bash
git fetch --all git reset --hard origin/master - Refresh Dependencies:bash
npm install - Verify & Restart:bash
pm2 start wa-bridge
Post-Update Verification
Once updated, visit your Admin Dashboard and check the footer. It should report v3.7.0. Your existing templates and logs will be preserved automatically.
IMPORTANT
Backup your session! Always keep a copy of the auth/ folder. If you move servers, simply copy this folder to the new one to avoid re-scanning the QR code.
