Skip to content

five-on-it / apps/api/src/config

apps/api/src/config ​

The platform API's configuration, read from the environment once at start. Every adapter has a local default that needs no service, so npm run dev:api runs on a laptop as it is; the Compose stack sets the production ones (TECHNICAL_SPECS §9.6).

VariableDefaultWhat
FOI_API_PORT8080The port.
FOI_API_URLhttp://localhost:<port>Where game servers fetch artifacts from.
FOI_PUBLIC_URLFOI_API_URLThe platform's public address (the stack's proxy): the OAuth issuer, its sign-in page and endpoints at its root (oauth.ts).
FOI_ROOM_SECRETa development secretShared with the game servers: opens rooms, signs join tokens.
FOI_GAME_SERVERShttp://localhost:7777The game servers, comma-separated, each internal-url or internal-url|public-ws-url.
FOI_AUTHdevdev (accounts made on sight, for local development) or nakama.
FOI_AUTH_SECRETa development secretSigns the dev sessions.
NAKAMA_URL, NAKAMA_SERVER_KEY, NAKAMA_SESSION_KEYThe Nakama server, its server key and its session encryption key.
NAKAMA_HTTP_KEYNakama's runtime HTTP key: the party's and direct messages are kept in its chat channels with it (the module's RPC).
FOI_DATA_DIR.foi-dataWhere the file store and artifacts live.
FOI_STOREfilememory, file or postgres.
DATABASE_URLThe Postgres connection string, for FOI_STORE=postgres.
FOI_ARTIFACTSmemory with the memory store, else filememory, file or s3.
S3_ENDPOINT, S3_REGION, S3_BUCKET, S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEYAWS, us-east-1The bucket, for FOI_ARTIFACTS=s3; an endpoint (MinIO) is addressed path-style.
FOI_MODERATIONoffoff, wordlist, claude, chain (the word list, then Claude) or openrouter (the word list, then a small model on OpenRouter, its spend counted in the platform model's budget; public rooms' chat by the word list alone, so it spends nothing).
FOI_BLOCKED_WORDSnoneMore words the word list refuses, comma-separated.
ANTHROPIC_API_KEY, FOI_MODERATION_MODELclaude-haiku-4-5; on OpenRouter google/gemini-2.5-flash-liteThe classifier's key (Claude's) and model.
OPENROUTER_API_KEYThe platform's OpenRouter key, for FOI_MODERATION=openrouter (the creator runners' own too).
FOI_QUOTA_BUILDS, FOI_QUOTA_ROOMS, FOI_QUOTA_CREATIONS100, 50, 5Per account and day (UTC), counted in the store; an admin's override replaces them for one account. Creations are counted once the platform creates games itself.
FOI_BUILD_CONCURRENCY1How many builds this API process runs at once; 0 runs none (they wait in the queue, for another process or a restart).
FOI_MODERATORSnoneThe moderators' account ids, comma-separated (with dev accounts user-<email>).
FOI_ADMINSnoneThe admins' account ids, comma-separated, as FOI_MODERATORS: they set the accounts' limits (/admin/…).
FOI_DEBUG_ACCOUNTSnone (off)Account ids, comma-separated, exact and lower case (a UUID, user-<email>, steam-<steamid64>; never a guest's: the API warns at start, without the ids, when one looks wrong), whose join tokens carry debug in every room the platform hands out (the cities' rooms, published games', runs'): the game servers honour their debug commands (the legend's chasers, Go to, the clock, the weather) though the room's own are off, to test a game live; a run where one was used pays nothing. Never for everyone; empty to switch it off.
FOI_WORKER_URLThe generator worker (apps/worker) that builds spec drafts' levels.
FOI_FLEET_SECRETnoneTurns the fleet's registry on (fleet-registry.ts): game servers that post a heartbeat with it (16 characters at least) take rooms too.
FOI_FLEET_NETWORKSthe private networksThe networks (IPv4 CIDRs, comma-separated) the fleet's servers' internal addresses must be in.
FOI_FLEET_DOMAINlocalhostThe domains (comma-separated) the fleet's servers' public addresses must be under.
FOI_API_FLEET_URLFOI_API_URLWhere the fleet's servers reach the API (the artifacts, the moderation): its address on the private network.
FOI_LEGAL_OPERATOR, FOI_LEGAL_CONTACT, FOI_LEGAL_COUNTRYnoneWho runs the platform, how to reach them (an e-mail) and the country whose law the terms follow: the privacy policy and the terms name them (/info).
FOI_TELEMETRY_DAYS90How long the crash reports and usage events the players' games send (with their consent) are kept.
FOI_BLENDERfoundWithout a worker, the Blender this process generates with (else the one on the PATH or installed); none found, spec builds fail.
FOI_ENTITLEMENTopenWho the platform is for: open (anyone: guests, e-mail and Steam accounts) or steam (the owners of the game on Steam, signed in through Steam only: entitlement.ts); steam needs FOI_STEAM.
FOI_JOINopenWhat the game servers ask of a player, as /info tells the clients: open, or token (a join token on every connection, which GET /play signs); the game servers' own FOI_JOIN is set the same.
FOI_STEAMoffWhich Steam signs players in (steam.ts): off, fake (the API's own, for development and the tests; never in production) or web (Steam's Web API: STEAM_PUBLISHER_KEY and FOI_STEAM_APP_ID).
STEAM_PUBLISHER_KEY, FOI_STEAM_APP_IDThe Steamworks publisher Web API key and the game's app id, for FOI_STEAM=web.
FOI_STEAM_STORE_URLnoneThe game's page on the Steam store: those without a copy are sent there ("Get it on Steam").
FOI_WEB_ORIGINSnoneMore origins (comma-separated) a Steam sign-in may go back to, besides FOI_PUBLIC_URL's and FOI_API_URL's (a web client served elsewhere); a platform on a loopback address takes any loopback page.
FOI_CREATORoffThe platform's own model creating games from owners' briefs (creations.ts): off (/jobs says creation is not available), fake (the creator runners replay a scripted model), openrouter or claude (the runners' model on OpenRouter or on Anthropic's API).
FOI_CREATOR_SECRETnoneNeeded when FOI_CREATOR is on (16 characters at least): the creator runners claim jobs with it (/creator/…).
FOI_CREATOR_MONTHLY_USD25The model's hard cap a month (USD); each day's budget is what is left of it over the days left.
FOI_CREATOR_JOB_USD0.5What one creation (a whole conversation) may spend at most (USD), but for an admin's override.
FOI_CREATOR_BUILDS12The builds one creation may run, but for an admin's override.
FOI_CREATOR_CHOICESwith claude claude-opus-5-5,claude-sonnet-5-5,claude-haiku-5-5; with openrouter the runner's default models; with fake Claude'sThe models an owner may pick for a creation (GET /creations/models), in order, the first picked by default; with claude, each one Anthropic's list prices know (models.ts). An admin's modelChoices setting wins over it.
FOI_DEBUG01: every bundled level's game is a curated game (the test levels' too: their pages, their missions' runs and lobbies, Quick play's playlists), as on a game server whose debug commands are on, and the tests may set a standing (PUT /debug/standing/:id); for development and the tests, never on the live platform.
FOI_RESPECTonRespect, conduct and skill (respect.ts): on (shown, gating, pooling, balancing), shadow (computed and stored, shown to nobody, gating nobody: to tune on real runs) or off (nothing computed).

Interfaces ​

Functions ​