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).
| Variable | Default | What |
|---|---|---|
FOI_API_PORT | 8080 | The port. |
FOI_API_URL | http://localhost:<port> | Where game servers fetch artifacts from. |
FOI_PUBLIC_URL | FOI_API_URL | The platform's public address (the stack's proxy): the OAuth issuer, its sign-in page and endpoints at its root (oauth.ts). |
FOI_ROOM_SECRET | a development secret | Shared with the game servers: opens rooms, signs join tokens. |
FOI_GAME_SERVERS | http://localhost:7777 | The game servers, comma-separated, each internal-url or internal-url|public-ws-url. |
FOI_AUTH | dev | dev (accounts made on sight, for local development) or nakama. |
FOI_AUTH_SECRET | a development secret | Signs the dev sessions. |
NAKAMA_URL, NAKAMA_SERVER_KEY, NAKAMA_SESSION_KEY | The Nakama server, its server key and its session encryption key. | |
NAKAMA_HTTP_KEY | Nakama'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-data | Where the file store and artifacts live. |
FOI_STORE | file | memory, file or postgres. |
DATABASE_URL | The Postgres connection string, for FOI_STORE=postgres. | |
FOI_ARTIFACTS | memory with the memory store, else file | memory, file or s3. |
S3_ENDPOINT, S3_REGION, S3_BUCKET, S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY | AWS, us-east-1 | The bucket, for FOI_ARTIFACTS=s3; an endpoint (MinIO) is addressed path-style. |
FOI_MODERATION | off | off, 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_WORDS | none | More words the word list refuses, comma-separated. |
ANTHROPIC_API_KEY, FOI_MODERATION_MODEL | claude-haiku-4-5; on OpenRouter google/gemini-2.5-flash-lite | The classifier's key (Claude's) and model. |
OPENROUTER_API_KEY | The platform's OpenRouter key, for FOI_MODERATION=openrouter (the creator runners' own too). | |
FOI_QUOTA_BUILDS, FOI_QUOTA_ROOMS, FOI_QUOTA_CREATIONS | 100, 50, 5 | Per 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_CONCURRENCY | 1 | How many builds this API process runs at once; 0 runs none (they wait in the queue, for another process or a restart). |
FOI_MODERATORS | none | The moderators' account ids, comma-separated (with dev accounts user-<email>). |
FOI_ADMINS | none | The admins' account ids, comma-separated, as FOI_MODERATORS: they set the accounts' limits (/admin/…). |
FOI_DEBUG_ACCOUNTS | none (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_URL | The generator worker (apps/worker) that builds spec drafts' levels. | |
FOI_FLEET_SECRET | none | Turns 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_NETWORKS | the private networks | The networks (IPv4 CIDRs, comma-separated) the fleet's servers' internal addresses must be in. |
FOI_FLEET_DOMAIN | localhost | The domains (comma-separated) the fleet's servers' public addresses must be under. |
FOI_API_FLEET_URL | FOI_API_URL | Where 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_COUNTRY | none | Who 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_DAYS | 90 | How long the crash reports and usage events the players' games send (with their consent) are kept. |
FOI_BLENDER | found | Without a worker, the Blender this process generates with (else the one on the PATH or installed); none found, spec builds fail. |
FOI_ENTITLEMENT | open | Who 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_JOIN | open | What 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_STEAM | off | Which 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_ID | The Steamworks publisher Web API key and the game's app id, for FOI_STEAM=web. | |
FOI_STEAM_STORE_URL | none | The game's page on the Steam store: those without a copy are sent there ("Get it on Steam"). |
FOI_WEB_ORIGINS | none | More 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_CREATOR | off | The 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_SECRET | none | Needed when FOI_CREATOR is on (16 characters at least): the creator runners claim jobs with it (/creator/…). |
FOI_CREATOR_MONTHLY_USD | 25 | The model's hard cap a month (USD); each day's budget is what is left of it over the days left. |
FOI_CREATOR_JOB_USD | 0.5 | What one creation (a whole conversation) may spend at most (USD), but for an admin's override. |
FOI_CREATOR_BUILDS | 12 | The builds one creation may run, but for an admin's override. |
FOI_CREATOR_CHOICES | with claude claude-opus-5-5,claude-sonnet-5-5,claude-haiku-5-5; with openrouter the runner's default models; with fake Claude's | The 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_DEBUG | 0 | 1: 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_RESPECT | on | Respect, 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). |