Deployment (VPS)
This guide explains how to deploy the AutoCall backend on a VPS (Virtual Private Server). You will configure the server, install required software, secure the database, and run AutoCall in a production-ready environment.
VPS deployment is recommended because it provides Full server control, Better performance tuning, Secure API handling, SSL support, Background processing (AI jobs, queue workers), Scalability for SaaS growth.
1. System Setup
After connecting to your VPS via SSH:
sudo apt update && sudo apt upgrade -y
sudo apt install curl wget git unzip build-essential -y
These utilities are required for installing Node.js, MongoDB, and managing your backend.
2. Install Node.js Runtime
AutoCall backend runs on Node.js. Install latest LTS (recommended for production):
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs
Verify installation:
node -v
npm -v
You should see Node 22.x (or latest LTS).
3. Install & Configure MongoDB (Database)
AutoCall uses MongoDB to store: Users, Human Agent, AI generations, API usage, AI Chatbot, Prompt history.
Step 1 — Import MongoDB GPG Key (Version 8.0)
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor
Step 2 — Add Repository (Ubuntu 24.04 / 22.04)
# For Ubuntu 24.04 (noble):
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | \
sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
# Note: For Ubuntu 22.04 use "jammy" instead of "noble".
Step 3 — Install MongoDB
sudo apt update
sudo apt install -y mongodb-org
Step 4 — Start & Enable Service
sudo systemctl start mongod
sudo systemctl enable mongod
Step 5 — Verify Installation
sudo systemctl status mongod
mongod --version
mongosh --version
4. Deploy AutoCall Backend Code
Clone your backend repository:
git clone https://github.com/yourusername/autocall-backend.git
cd autocall-backend
npm install --production
5. Configure Environment Variables
Create .env file:
nano .env
Example Production Configuration:
NODE_ENV=development
PORT=3000
MONGODB_URI=Your_mongodb_connection_string
JWT_SECRET=your-super-secret-jwt-key-here-make-it-long-and-random
APP_DEMO_MODE=true
FRONTEND_URL=http://localhost:3001
# Admin Credentials
ADMIN_EMAIL=your_admin_email
ADMIN_PASSWORD=[PASSWORD]
ADMIN_NAME=Your_admin_name
DEFAULT_USER_EMAIL=your_default_user_email
DEFAULT_USER_PASSWORD=your_default_user_password
DEFAULT_USER_NAME=your_default_user_name
REDIS_URL=redis://localhost:6379
STRIPE_SECRET_KEY=
RAZORPAY_KEY_ID=
RAZORPAY_KEY_SECRET=
RAZORPAY_WEBHOOK_SECRET=
APP_URL=
ALLOWED_ORIGINS=
TOKEN_ENCRYPTION_KEY=your-32-character-encryption-key-here
ELEVENLABS_API_KEY=
GEMINI_API_KEY=
ENCRYPTION_KEY=
TWILIO_ACCOUNT_SID=
TWILIO_AUTH_TOKEN=
6. Process Management (PM2)
Install PM2 and start backend:
sudo npm install -g pm2
pm2 start server.js --name autocall-backend
pm2 save
pm2 startup
Check logs:
pm2 logs autocall-backend
PM2 ensures: Auto restart on crash, Background execution, Memory monitoring, Log management.
7. Reverse Proxy Setup (Nginx)
AutoCall runs internally on port 5000. Install Nginx and create config:
sudo apt install nginx -y
sudo nano /etc/nginx/sites-available/autocall
Add configuration:
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:5000;
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 configuration:
sudo ln -s /etc/nginx/sites-available/autocall /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
8. Enable SSL (HTTPS)
Install Certbot and generate SSL:
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com
Set up auto renewal:
sudo crontab -e
# Add the following line:
0 12 * * * /usr/bin/certbot renew --quiet
Now AutoCall runs securely via HTTPS.
9. Testing & Verification
Test health endpoint and common features:
https://your-domain.com/api/health
Check: Authentication, AI generation endpoints, Payment webhooks, Email campaigns, Ai chatbot creation.
Logs: pm2 logs autocall-backend
10. Maintenance & Updates
To update backend:
cd autocall-backend
git pull origin main
npm install --production
pm2 restart autocall-backend
Regularly monitor: CPU & RAM, MongoDB memory usage, Disk space, Payment webhook logs, SSL renewal status.
What's Next?
Let's get started — your journey with AutoCall begins here!