Skip to content

Installation

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

⚙️ Installation

This guide explains how to properly install and configure SecureAuth for development or production environments.


📋 System Requirements

Before installing SecureAuth, ensure your system meets the following requirements.

Requirement | Recommended -- | -- Node.js | v18+ npm | Latest RAM | 2 GB Recommended OS | Ubuntu / Linux Recommended

📦 Clone the Repository

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

cd SecureAuth


📥 Install Dependencies

Install all required packages.

npm install

🔐 Configure Environment Variables

Create a .env file in the project root directory.

Example configuration:

# ===============================================

SecureAuth Environment Configuration

===============================================

APP_NAME="SecureAuth"

APP_URL="http://localhost:3000"

===============================================

TEXTSNAP CONFIGURATION

===============================================

TEXTSNAP_INSTANCE_ID="YOUR_INSTANCE_ID"

TEXTSNAP_ACCESS_TOKEN="YOUR_ACCESS_TOKEN"

===============================================

FIREBASE CONFIGURATION

===============================================

FIREBASE_DATABASE_URL="YOUR_FIREBASE_DATABASE_URL"

FIREBASE_DATABASE_SECRET="YOUR_FIREBASE_DATABASE_SECRET"

===============================================

SECURITY CONFIGURATION

===============================================

JWT_SECRET="YOUR_SUPER_SECRET_KEY"

ENCRYPTION_KEY="YOUR_ENCRYPTION_KEY"


▶️ Start Development Server

Run the application in development mode.

npm run dev

Application will be available at:


🏗 Build for Production

Generate production build files.

npm run build

🚀 Start Production Server

Run SecureAuth in production mode.

npm start

📁 Recommended Directory Structure

SecureAuth
├── public/
├── src/
├── server.ts
├── package.json
├── vite.config.ts
├── tsconfig.json
├── .env
└── README.md

⚡ PM2 Setup (Recommended)

Install PM2 globally:

npm install -g pm2

Start application:

pm2 start npm --name secureauth -- start

Save PM2 process:

pm2 save

Enable startup:

pm2 startup

🌍 Nginx Reverse Proxy Setup

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;
}

}


🐳 Docker Installation

Build Docker image:

docker build -t secureauth .

Run container:

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

🔒 Production Recommendations

For production deployments:

  • Use HTTPS

  • Enable firewall protection

  • Use strong JWT secrets

  • Rotate credentials regularly

  • Restrict server access

  • Monitor logs continuously


⚠️ Common Installation Issues

Port Already In Use

Check port usage:

lsof -i :3000

Kill process:

kill -9 PID

Vite Host Blocked

Update vite.config.ts

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

Missing Dependencies

Reinstall dependencies:

rm -rf node_modules package-lock.json

npm install


✅ Next Steps

Continue with:


Clone this wiki locally