Skip to content

server.cfg Setup

A reference for the server.cfg entries required by Shiva.

Minimal Example

ini
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"

set sv_maxclients 64
set sv_licenseKey "your-license-key"
set sv_hostname "My Shiva Server"

# Database
set mysql_connection_string "mysql://shiva:password@127.0.0.1/shiva?charset=utf8mb4"

# Shiva secrets (keep these out of version control!)
set SHIVA_API_SECRET "a-random-secret-string"

# Core dependencies — must come first
ensure shiva-db
ensure shiva-fw
ensure shiva-core

# shiva-boot must be last — starts the module loader
ensure shiva-boot

# Default modules
ensure shiva-player
ensure shiva-economy
ensure shiva-jobs
ensure shiva-gangs
ensure shiva-inventory
ensure shiva-vehicles
ensure shiva-weapons
ensure shiva-notifications
ensure shiva-commands

# Your custom modules
ensure my-custom-module

Load Order

Critical: The following order is required. shiva-core's internal boot sequence depends on it.

#ResourceWhy
1shiva-dbDatabase pool must initialise before any ORM or migration code runs
2shiva-fwProvides shared globals (Container, EventBus, Collection, etc.)
3shiva-coreLoads in order internally: config → logger → container → eventbus → querybuilder → database → models → migrations → cache → scheduler → security → state → jurisdiction → modules → api_bridge → boot
4–nShiva modulesAny order; dependency graph is resolved automatically
lastshiva-bootFires shiva:ready after all modules have loaded

WARNING

shiva-boot must be the last Shiva resource in server.cfg. Loading it too early will cause modules to miss the shiva:ready event.

ConVars Reference

Required

ConVarDescription
mysql_connection_stringFull MySQL/MariaDB connection string
sv_licenseKeyYour Cfx.re license key
sv_maxclientsMust match Shiva.maxPlayers in config

Shiva Secrets

ConVarDescription
SHIVA_API_SECRETShared secret for shiva-api JWT tokens
SHIVA_DEVSet to true to enable dev mode (verbose logging, hot-reload)

shiva-db Tuning (Optional)

ConVarDefaultDescription
shiva_db_pool_limit10Maximum connections in the pool
shiva_db_max_idle5Maximum idle connections kept alive
shiva_db_idle_timeout60000Idle connection timeout in ms
shiva_db_connect_timeout5000Connection attempt timeout in ms
shiva_db_slow_query_ms500Queries slower than this (ms) are logged as warnings
shiva_db_debugfalseLog every SQL query (very verbose)
ini
# Example tuning for a high-population server
set shiva_db_pool_limit "20"
set shiva_db_slow_query_ms "200"

Enabling txAdmin

txAdmin is the recommended way to manage your server. Set sv_licenseKey to a txAdmin-issued key and follow txAdmin's standard setup — Shiva is fully compatible.

Released under the MIT License.