2.8 KiB
TenWholeYears.Server
Thanks for playing TenWholeYears!
This is the API server for the TenWholeYears Game Client. A decompilation of the first public Rec Room build.
Please note that this web server was built in a couple days. I cut some corners when coding this, and some of the coding principals and patterns used in this codebase does not reflect how I would approach a project that is intented to be maintained long-term.
Basic Setup
Prerequisites:
- .NET 10 SDK
- Docker Desktop or another container runtime, when using
AppHost - A Steam Web API key, if using platform validation.
Restore and build:
dotnet restore RecNet.sln
dotnet build RecNet.sln
Run the full local stack with Aspire:
dotnet run --project src\AppHost\AppHost.csproj
Configuration
Use user secrets for local development.
For the API:
dotnet user-secrets set "Jwt:Secret" "replace-with-a-long-random-secret" --project src\API\API.csproj
Optional API secrets:
dotnet user-secrets set "Jwt:Issuer" "http://localhost:5155" --project src\API\API.csproj
dotnet user-secrets set "Jwt:Audience" "TenWholeYears" --project src\API\API.csproj
dotnet user-secrets set "Jwt:ExpiryMinutes" "60" --project src\API\API.csproj
dotnet user-secrets set "Steam:ApiKey" "your-steam-web-api-key" --project src\API\API.csproj
dotnet user-secrets set "Steam:AppId" "480" --project src\API\API.csproj
dotnet user-secrets set "Neutrino:ValidateSecret" "true" --project src\API\API.csproj
dotnet user-secrets set "Neutrino:Secret" "replace-with-neutrino-secret" --project src\API\API.csproj
dotnet user-secrets set "RecNet:UseForwardedHeaders" "false" --project src\API\API.csproj
Production Config With Environment Variables
.env example:
Jwt__Secret = "replace-with-a-long-random-secret"
Jwt__Issuer = "https://your-api.example.com"
Jwt__Audience = "TenWholeYears"
Jwt__ExpiryMinutes = "60"
Steam__ApiKey = "your-steam-web-api-key"
Steam__AppId = "480"
Neutrino__ValidateSecret = "true"
Neutrino__Secret = "replace-with-neutrino-secret"
RecNet__UseForwardedHeaders = "true"
Runtime Server Configs
The server has configs in the ServerConfigs database table that are able to be adjusted while the server is running. Keys are strings and values are stored as JSON.
| Key | Type | Default |
|---|---|---|
Config:MOTD |
string |
"Ten Whole Years!" |
Profiles:IgnoreAuthValidation |
boolean |
true |
Profiles:NameGen |
object | DefaultNameGenConfig.Value |
Profiles:NameGen expects this shape:
{
"Adjectives": [
"Adorable",
"Brave"
],
"Nouns": [
"Pony",
"Tiger"
]
}
Notes
- Set
RecNet:UseForwardedHeaderstotrueonly when the API is behind a trusted reverse proxy.