Windows Server Installation
Step-by-step guide for deploying WorkForce on Windows Server.
Prerequisites
- Windows Server 2019 or 2022
- Node.js 20 LTS — Download from nodejs.org
- PostgreSQL 16 — Download from postgresql.org
- Git (optional) — For cloning the repository
Step 1: Install Node.js
- Download the Node.js 20 LTS Windows installer (.msi)
- Run the installer with default options
- Verify:
node --version # Should show v20.x.x
npm --version # Should show 10.x.x
Step 2: Install PostgreSQL
- Download and run the PostgreSQL installer
- Set a strong password for the
postgresuser - Keep default port 5432
- After installation, open pgAdmin or psql and create the database:
CREATE USER workforce WITH PASSWORD 'YourStrongPassword';
CREATE DATABASE workforce OWNER workforce;
Step 3: Deploy Application Files
Option A: Git Clone
cd C:\
git clone https://github.com/your-org/workforce.git WorkForce
cd WorkForce
Option B: Copy Files
Copy the project folder to C:\WorkForce.
Step 4: Configure Environment
cd C:\WorkForce
Copy-Item .env.example .env
notepad .env
Edit .env with your production values:
NODE_ENV=production
DATABASE_URL="postgresql://workforce:YourStrongPassword@localhost:5432/workforce?schema=public"
NEXTAUTH_SECRET="generated-random-secret"
NEXTAUTH_URL="https://your-domain.com"
Step 5: Install Dependencies & Build
npm ci
npx prisma generate
npx prisma migrate deploy
npm run build
Step 6: Configure as Windows Service
Using NSSM
- Download NSSM and extract to
C:\nssm - Install the service:
C:\nssm\nssm.exe install WorkForce "C:\Program Files\nodejs\node.exe"
C:\nssm\nssm.exe set WorkForce AppParameters "C:\WorkForce\node_modules\.bin\next start"
C:\nssm\nssm.exe set WorkForce AppDirectory "C:\WorkForce"
C:\nssm\nssm.exe set WorkForce AppEnvironmentExtra "NODE_ENV=production" "PORT=3000"
C:\nssm\nssm.exe set WorkForce DisplayName "WorkForce HR Platform"
C:\nssm\nssm.exe set WorkForce Description "WorkForce HR Management System"
C:\nssm\nssm.exe set WorkForce Start SERVICE_AUTO_START
C:\nssm\nssm.exe set WorkForce AppStdout "C:\WorkForce\logs\service-stdout.log"
C:\nssm\nssm.exe set WorkForce AppStderr "C:\WorkForce\logs\service-stderr.log"
- Start the service:
C:\nssm\nssm.exe start WorkForce
- Verify:
Get-Service WorkForce
Step 7: Configure Firewall
# Allow HTTP and HTTPS
New-NetFirewallRule -DisplayName "WorkForce HTTP" -Direction Inbound -Port 80 -Protocol TCP -Action Allow
New-NetFirewallRule -DisplayName "WorkForce HTTPS" -Direction Inbound -Port 443 -Protocol TCP -Action Allow
Step 8: Set Up Reverse Proxy
See the Reverse Proxy guide for IIS or Caddy configuration.
Updating the Application
cd C:\WorkForce
C:\nssm\nssm.exe stop WorkForce
git pull # or copy new files
npm ci
npx prisma generate
npx prisma migrate deploy
npm run build
C:\nssm\nssm.exe start WorkForce