Overview
rugen-server is one small binary with SQLite inside that gives players a lobby, rooms, ranked play, signed results and a fallback match relay; it never shows or logs anyone's IP address.
rugen-server is the self-hostable online hub for rugen: one small Rust binary (a ≈5 MB image with SQLite inside). Anyone can run one for their friends, their scene or the public.
What it gives players
- Accounts: optional usernames and passwords (Argon2id, no e-mail, several devices per account), next to the anonymous key-only accounts of older clients; profiles. See Accounts.
- A lobby: public rooms, private rooms (code only), optional room passwords, rules (rounds, timer, classic / arena, free pick / mirror), spectator seats, host kick, rematch; tournament brackets of 8 or 16 players, seeded by rating, each match called by the server.
- Quick match and ranked: Elo K = 32, 90-day seasons with a soft reset and kept final standings (a tier badge per player), a leaderboard with past seasons, ping-aware matchmaking.
- Match connection: signalling for the direct peer-to-peer path (the
default), Cloudflare Realtime TURN credentials when
RUGEN_CF_TURN_KEY_IDandRUGEN_CF_TURN_TOKENare set, and the match relay (player → server → player) as the last fallback. - Bring your own character: instant FAIR / UNBALANCED / BLOCKED matchup verdicts and verified temporary packages, so both players fight with byte-identical files (see Bring your own character).
- Live watching of any match from the server’s input log, even mid-match, and shared replays by short code, kept 30 days.
- Ranked result verification, stored ranked replays, and optional re-simulation of disputed matches.
IP addresses
The server never hands a client address to anyone: no API or WebSocket
payload contains one (tests assert it). Client IPs are used only for rate
limiting and are not logged at the info level.
Matches connect directly, peer to peer by default, so in a direct match
each player’s game does see the other’s IP address. A player who turns
DIRECT CONNECTION off ([net] direct = false) stays relayed, through
TURN or this server, and then the opponent never learns their address. See
How a match connects.
Ports
| Port | What | Notes |
|---|---|---|
8080/tcp | HTTP API, /ws lobby presence, /relay WebSocket fallback, /health | Put HTTPS in front. |
7001/udp | Match relay, fast path | Open it in the firewall. |
Without 7001/udp reachable, clients fall back to the WebSocket relay on 8080
after a 1.5 s UDP probe. It works everywhere, just a bit slower. You can
disable UDP entirely with RUGEN_UDP_BIND=off.
Ways to run it
| How | Page |
|---|---|
| Docker Compose, Dokploy | Docker Compose & Dokploy |
| Behind a Cloudflare Tunnel (optional add-on) | Cloudflare Tunnel |
| Plain binary from source | below |
git clone https://github.com/rugen-dev/rugen-server
cd rugen-server
cargo build --release
RUGEN_DATA=/var/lib/rugen RUGEN_NAME="my server" ./target/release/rugen-server
The protocol, fairness rules and simulation are shared with the game; the server pulls them from rugen-engine as git dependencies.
Players then add https://your-host (or your-ip:8080) with
ONLINE → ADD SERVER, or in rugen.toml:
[net]
server = "https://rugen.example.com"
Security at a glance
- Relay datagrams are authenticated per session and slot with a random 128-bit token handed out over HTTPS only to that player; a slot may move between UDP and WebSocket without trusting source addresses. Spectators can only talk to the host.
- Room passwords are hashed with Argon2id (per-room salt) and checked in constant time; nothing stores or returns them in clear.
- Account passwords are hashed with Argon2id (19 MiB, 2 passes, random salt per hash). Login keys are stored only as hashes, at most 10 devices per account. Failed logins are rate limited per username and per IP with a growing lockout, and an unknown username takes as long to refuse as a wrong password.
- Rate limits: 120 HTTP requests / 10 s per IP, 600 relay datagrams / s per slot, 2000 UDP datagrams / s per source IP, bounded rooms, sessions and queue sizes.
- The container runs as non-root on a read-only root filesystem with all capabilities dropped.
Something wrong on this page? Edit it on GitHub.