npm install
node app.jsThen open http://localhost:3000
No .env is needed in development — env vars are only required when NODE_ENV=production.
A random session secret is generated automatically, static files are served by Express,
and the master server list is fetched from the remote one. In development the tournament
state directory defaults to ./tests/tournaments (override with TOURNAMENT_DIR). To use
a different port:
PORT=4000 node app.js./launch.sh is a self-healing wrapper around node app.js aimed at hosting
the /tournament page on a LAN. It checks Node.js, installs/repairs dependencies
(including rebuilding better-sqlite3 if you switched Node versions, with a
fallback to installing the latest compatible release ad-hoc), frees the port,
auto-points TOURNAMENT_DIR at ~/.config/Hypersomnia/user if the game is
installed locally, and prints the LAN URL.
./launch.sh # port 3000, auto-detect tournament dir
PORT=4000 ./launch.sh # custom port
TOURNAMENT_DIR=/path ./launch.sh # custom tournament state dirThen open http://<your-lan-ip>:3000/tournament from any machine on the network.
Use Ansible playbooks to setup.
Example .env file:
NODE_ENV=production
PORT=3000
SESSION_SECRET=your-very-long-random-secret-key-at-least-32-chars
STEAM_APIKEY=YOUR_STEAM_API_KEY
IPINFO_API_TOKEN=YOUR_IPINFO_TOKEN
DISCORD_CLIENT_ID=YOUR_DISCORD_CLIENT_ID
DISCORD_CLIENT_SECRET=YOUR_DISCORD_CLIENT_SECRET
DISCORD_BOT_TOKEN=YOUR_DISCORD_BOT_TOKEN
ADMINS=76561198012345678,76561198087654321The app runs under PM2 in production (deployed via Ansible). All [report_match]-prefixed log lines are emitted on every code path — successes, skips, validation failures, and errors with full stack traces.
# Live log stream
pm2 logs app
# Last 200 lines
pm2 logs app --lines 200
# Errors only
pm2 logs app --err --lines 100
# Log files on disk
~/.pm2/logs/app-out.log # stdout (console.log)
~/.pm2/logs/app-error.log # stderr (console.error)To diagnose a match that wasn't recorded:
# Check for validation failures or exceptions around a specific time
grep "\[report_match\]" ~/.pm2/logs/app-out.log | tail -50
grep "\[report_match\]" ~/.pm2/logs/app-error.log | tail -50# Start with a test API key pre-seeded (api_key=pl, server_id=pl)
./test_server.shSee docs/report_match_logic.md for full documentation on MMR calculation, abandon rules, and happy hours.