Skip to main content

Running the Server

Prerequisites

  • .NET 9 SDK.

  • The shared proto submodule. After cloning the engine repo:

    git submodule update --init --remote

Build & run

# from the repository root
dotnet build RabiRiichi.Server/RabiRiichi.Server.csproj
dotnet run --project RabiRiichi.Server/RabiRiichi.Server.csproj

In Development the server listens on http://localhost:5150 (see Properties/launchSettings.json) and uses ASPNETCORE_ENVIRONMENT=Development, which also seeds the RNG deterministically (seed 0) for reproducible local runs.

The WebSocket endpoints are ws://localhost:5150/ws/public and ws://localhost:5150/ws/connect — see Transport & protocol.

Configuration (environment variables)

VariableRequiredMeaning
JWT_SECRETprodHMAC key for signing auth tokens. See Authentication.
RABIRIICHI_GAME_SAVE_DIRnoEnable replays; directory for .pb files. Unset ⇒ replays off.
RABIRIICHI_GAME_SAVE_TTLnoReplay retention in seconds; enables hourly cleanup. Unset ⇒ keep forever.

appsettings.json sets Kestrel to Http1AndHttp2 (WebSockets ride HTTP/1.1; HTTP/2 is available for the dormant gRPC path) and AllowedHosts: "*". CORS is open (AllowAll) for the WebSocket handshake.

Tests

The engine and server share one test project:

dotnet test RabiRiichi.Tests/RabiRiichi.Tests.csproj
# filter to a subset:
dotnet test RabiRiichi.Tests/RabiRiichi.Tests.csproj --filter "FullyQualifiedName~ReplayStore"

See the Testing guides for how to write engine tests.

Per-room custom rules

CreateRoomRequest carries a GameConfigMsg, including an allowed-yaku list. The server installs a DynamicRiichiSetup that filters the standard patterns down to that allow-list, so each room can run a customized rule set. Invalid configs are rejected with a typed error mapped to a client i18n key (RoomServiceImpl.MapToI18nKey). See Configuration.