Skip to content

Configuration

esmith443 edited this page Jun 18, 2026 · 3 revisions

Configuration

Configure JSExtendedStats settings.

Web Application (.env)

Edit .env in Pterodactyl File Manager:

# Environment
NODE_ENV=production

# Server port
PORT=3000

# Trust proxy if behind nginx
TRUST_PROXY=false

# Database connection
DB_HOST=localhost
DB_PORT=3306
DB_USER=ruststats
DB_PASSWORD=your_password
DB_NAME=ruststats
DB_CONNECTION_LIMIT=10

# Admin credentials (set via first-time setup or console commands)
# DO NOT edit these manually - use setup-admin console command
ADMIN_USERNAME=admin
ADMIN_PASSWORD=$2b$12$hashed_password_here...

# Session security (MUST be 32+ characters)
SESSION_SECRET=your_random_32_character_secret_key

# CORS allowed origins (comma separated)
ALLOWED_ORIGINS=http://localhost:3000,http://yourdomain.com

# Rate limiting
RATE_LIMIT_WINDOW_MS=60000
RATE_LIMIT_MAX_REQUESTS=100

# Steam API (optional, for player avatars)
STEAM_API_KEY=your_steam_api_key_here

Key Settings

NODE_ENV: production for live servers, development for testing PORT: Web server port (default: 3000) TRUST_PROXY: Set true if behind nginx/reverse proxy

DB_NAME: Must be ruststats (matches schema) DB_HOST: Usually localhost or your MySQL IP

SESSION_SECRET: Generate random 32+ character string ADMIN_USERNAME/PASSWORD: Set via Console Commands, NOT manually!

Admin Credentials

DO NOT edit directly in .env

Use console commands instead:

  • setup-admin - Create new username and password
  • change-admin-password - Change password only

The password is automatically hashed with bcrypt (12 rounds).

Rust Plugin Config

After plugin loads, edit oxide/config/JSExtendedStats.json:

{
  "ApiURL": "http://your-server-ip:3000/api/update",
  "SecretKey": "your_secret_key",
  "ServerID": "1",
  "Count suicide kills": false,
  "Count environment kills": false,
  "UntrackedPlayerIds": [],
  "Advanced Logging": false,
  "Wipe Stats Table On New Save": false
}

Plugin Settings

ApiURL: Your web app URL + /api/update SecretKey: Get from database ruststats_config table ServerID: Unique ID per Rust server (1, 2, 3...)

Count suicide kills: Track player suicides Count environment kills: Track fall damage, drowning, etc. UntrackedPlayerIds: Steam64 IDs to ignore (admins)

Advanced Logging: Debug mode (verbose console output) Wipe Stats Table On New Save: Auto-clear stats on wipe

Finding Secret Key

The secret key is in your database:

SELECT secretkey FROM ruststats_config;

Default is: CHANGE_ME_ON_FIRST_INSTALL

Change it via admin panel or SQL:

UPDATE ruststats_config SET secretkey='your_new_secret' WHERE id=1;

Multi-Server Setup

Track multiple Rust servers:

Server 1: "ServerID": "1" Server 2: "ServerID": "2" Server 3: "ServerID": "3"

All use same ApiURL and SecretKey.

Applying Changes

Web App (.env): Restart server in Pterodactyl

Admin Credentials: No restart needed (console commands auto-reload)

Rust Plugin: o.reload JSExtendedStats in Rust console

Security Best Practices

  1. ✅ Use setup-admin console command for credentials
  2. ✅ Generate random SESSION_SECRET (32+ chars)
  3. ✅ Change default SecretKey in database
  4. ✅ Use strong database password
  5. ✅ Don't expose database to internet
  6. ❌ NEVER manually hash passwords - use console commands

Next Steps

JSExtendedStats Wiki

Getting Started

Components

Support

Clone this wiki locally