Skip to content

Deployment Guide

Amit Das edited this page Apr 28, 2026 · 1 revision

🌍 Deployment Guide

This guide explains how to deploy SecureAuth in production environments.

SecureAuth supports deployment on VPS servers, Docker environments, and cloud platforms.


πŸš€ Recommended Production Stack

Recommended setup for production:

Component | Recommended -- | -- OS | Ubuntu 22.04+ Reverse Proxy | Nginx Process Manager | PM2 SSL | Let's Encrypt Runtime | Node.js 18+

πŸ“¦ Clone Repository

git clone https://github.com/AmitDas4321/SecureAuth.git

cd SecureAuth


πŸ“₯ Install Dependencies

npm install

πŸ” Configure Environment Variables

Create .env

Example:

APP_NAME="SecureAuth"

APP_URL="https://yourdomain.com"

PORT=3000

TEXTSNAP_INSTANCE_ID="YOUR_INSTANCE_ID"

TEXTSNAP_ACCESS_TOKEN="YOUR_ACCESS_TOKEN"

FIREBASE_DATABASE_URL="YOUR_DATABASE_URL"

FIREBASE_DATABASE_SECRET="YOUR_DATABASE_SECRET"

JWT_SECRET="YOUR_SECRET"

ENCRYPTION_KEY="YOUR_ENCRYPTION_KEY"


πŸ— Build Project

Build frontend assets.

npm run build

▢️ Start Production Server

npm start

⚑ PM2 Setup

PM2 is recommended for production process management.


Install PM2

npm install -g pm2

Start Application

pm2 start npm --name secureauth -- start

Save PM2 Processes

pm2 save

Enable Auto Startup

pm2 startup

🌐 Nginx Reverse Proxy Setup

Install Nginx:

sudo apt install nginx -y

Example Nginx Configuration

server {
listen 80;
server_name yourdomain.com;

location / {

    proxy_pass http://127.0.0.1:3000;

    proxy_set_header Host $host;

    proxy_set_header X-Real-IP $remote_addr;

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_http_version 1.1;
}

}


Enable Configuration

sudo ln -s /etc/nginx/sites-available/secureauth /etc/nginx/sites-enabled/

Restart Nginx

sudo systemctl restart nginx

πŸ”’ Enable HTTPS

Install Certbot:

sudo apt install certbot python3-certbot-nginx -y

Generate SSL Certificate

sudo certbot --nginx -d yourdomain.com

🐳 Docker Deployment


Build Docker Image

docker build -t secureauth .

Run Container

docker run -d 
-p 3000:3000
--env-file .env
--name secureauth-app
secureauth

☁️ Supported Deployment Platforms

SecureAuth can be deployed on:

  • Ubuntu VPS

  • Oracle Cloud

  • Render

  • Docker

  • aaPanel

  • Coolify

  • CapRover


πŸ”₯ Firewall Configuration

Allow required ports.

Example:

sudo ufw allow 80

sudo ufw allow 443

sudo ufw allow 22


πŸ“± PWA Deployment Notes

For proper PWA support:

  • Use HTTPS

  • Configure correct APP_URL

  • Ensure icons are accessible


πŸ” Security Recommendations

For production environments:

  • Use HTTPS only

  • Use strong secrets

  • Restrict server access

  • Rotate credentials regularly

  • Enable firewall protection


πŸ“Š Recommended Production Workflow

Client
↓
Nginx Reverse Proxy
↓
SecureAuth Backend
↓
Authentication Validation
↓
Firebase Storage

⚠️ Common Deployment Issues


Port Already In Use

Check port usage:

lsof -i :3000

PM2 Not Starting

Check logs:

pm2 logs

Nginx Bad Gateway

Ensure backend is running.

Test:


Vite Host Blocked

Update vite.config.ts

server: {
allowedHosts: ['yourdomain.com']
}

πŸ” Verify Deployment

Check application:


βœ… Next Steps

Continue with:


Clone this wiki locally