Configuration reference
Which process needs each setting, and how missing configuration behaves.
Public browsing needs no environment file. Connected services need specific configuration in the process that uses it. The tables below list names and behavior; they contain no credentials.
Web settings visible to the browser
Next embeds NEXT_PUBLIC_ values in the client build. Put only public configuration in these fields, and rebuild when changing a value used by the browser.
| Name | Purpose |
|---|---|
NEXT_PUBLIC_APP_ORIGIN | App origin used for app URLs; local default is http://localhost:3000. |
NEXT_PUBLIC_DOCS_URL | External documentation origin used by app links and old /docs redirects; production uses https://docs.masayume.app. |
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID | Optional WalletConnect project configuration. |
NEXT_PUBLIC_CHAIN_ID | Parsed chain setting; checked-in integration targets Shannon. Changing a number alone does not port contracts or signer clients to another chain. |
NEXT_PUBLIC_INDEXER_URL | DreamDEX GraphQL indexer endpoint. |
NEXT_PUBLIC_RPC_HTTP_URLS | Comma-separated HTTP RPC endpoints. |
NEXT_PUBLIC_RPC_WS_URLS | Comma-separated WebSocket RPC endpoints. |
NEXT_PUBLIC_VENUE_ID | Venue used by app discovery. |
NEXT_PUBLIC_PRICE_FEED_URL | Optional feed endpoint override. |
NEXT_PUBLIC_PRICE_FEED_QUOTE | Feed quote currency setting. |
NEXT_PUBLIC_X_HANDLE | Public handle users mention. |
NEXT_PUBLIC_X_EXECUTOR_ADDRESS | Public fallback for the X grant's executor address. |
HTTP and WebSocket endpoint lists do not imply automatic runtime failover. The source currently keeps automatic rotation off.
Local contract overrides
Production normally uses the generated deployment manifest. These app overrides exist for a deliberately matched local fork:
| Contract | Address override | Start-block override |
|---|---|---|
| EventVault | NEXT_PUBLIC_EVENT_VAULT_ADDRESS | NEXT_PUBLIC_EVENT_VAULT_FROM_BLOCK |
| Forwarder | NEXT_PUBLIC_FORWARDER_ADDRESS | — |
| ParlayReserve | NEXT_PUBLIC_PARLAY_RESERVE_ADDRESS | NEXT_PUBLIC_PARLAY_RESERVE_FROM_BLOCK |
| RangeReserve | NEXT_PUBLIC_RANGE_RESERVE_ADDRESS | NEXT_PUBLIC_RANGE_RESERVE_FROM_BLOCK |
| MarketMakerVault | NEXT_PUBLIC_MARKET_MAKER_VAULT_ADDRESS | NEXT_PUBLIC_MARKET_MAKER_VAULT_FROM_BLOCK |
| LeverageReserve | NEXT_PUBLIC_LEVERAGE_RESERVE_ADDRESS | NEXT_PUBLIC_LEVERAGE_RESERVE_FROM_BLOCK |
| PrivateDesk | NEXT_PUBLIC_PRIVATE_DESK_ADDRESS | NEXT_PUBLIC_PRIVATE_DESK_FROM_BLOCK |
The market package also accepts GameArena address/from-block in its programmatic configuration. The current web/src/lib/env.ts does not expose matching NEXT_PUBLIC_GAME_ARENA_* variables. Do not invent environment support from a TypeScript option name.
Shared records
DATABASE_URL is server-only. Configure it on web and the ops actors that need the same records. The driver uses a small connection pool and requires TLS for hosts other than local loopback.
Without it, public market browsing works, but X relay, stored social activity, durable agent memory, Lucky draws, arcade score posting and the duel settler worklist are unavailable or degraded.
AI on web and ops
| Name | Purpose |
|---|---|
AI_MODEL | Model identifier supplied to the resolver. |
AI_BASE_URL + AI_API_KEY | Together select a custom OpenAI-compatible endpoint. |
ANTHROPIC_API_KEY | Direct credential when the selected provider is Anthropic. |
OPENAI_API_KEY | Direct credential when the selected provider is OpenAI. |
GOOGLE_GENERATIVE_AI_API_KEY | Direct credential when the selected provider is Google. |
AI_GATEWAY_API_KEY | Fallback route through the AI Gateway. |
Resolution order is custom endpoint, selected provider's direct key, Gateway, then unavailable. The checked-in default model is anthropic/claude-opus-5; this is a source default, not a claim that your account can access it.
Configure web for Sensei and Studio Dry read. Configure ops independently for AI runner execution. A credential on one host does not configure the other. Dry-run trading can still make model calls.
Strategy runner
| Name | Behavior |
|---|---|
RUNNER_PRIVATE_KEY | Key that must match each strategy's runner. |
STRATEGY_IDS | Optional comma-separated ids. Empty discovers strategies naming the key and its historical attempts; inactive strategies are retained for settlement. |
STRATEGY_RUNNER_ADDRESS | Web's public house-runner address. This is an address, not a private key. |
RUNNER_INTERVAL_MS | Defaults to 30,000 ms; accepted minimum 5,000 ms. |
AGENT_MAX_CALLS_PER_HOUR | Sliding-hour AI call budget across the runner's strategies; default 60. |
AGENT_TIMEOUT_MS | Per-read timeout; default 20,000 ms. |
VENUE_ID | Optional ops venue override. |
DRY_RUN | Runner suppresses sends only when explicitly 1 or true. |
DATABASE_URL | Required for new trades, durable decision/execution reservations, risk history and heartbeats. |
With no key, explicit strategy ids can still be inspected and reported when the required stores are available. With neither ids nor key, the runner idles. Missing AI credentials make AI strategies hold. Missing or stale risk data and unresolved execution attempts also hold new submissions. Keep the strategy runner and X executor on distinct keys, with one process writing each key.
X: web and relay use different credentials
| Process | Names | Purpose |
|---|---|---|
| Web | X_API_KEY, X_API_KEY_SECRET | OAuth 1.0a consumer credentials for sign-in. |
| Web | X_SESSION_SECRET | Signs account identity cookies; no safe public fallback. |
| Web | X_REDIRECT_URI | Optional callback override; otherwise app origin plus /api/x/callback. |
| Web | X_EXECUTOR_ADDRESS | Public address to name in Executor grants; takes precedence over public fallback. |
| Ops | X_RETTIWT_API_KEY | Operator account-session credential used by the current mention transport. |
| Ops | X_HANDLE | Account whose mentions are searched; must match the authenticated operator session. |
| Ops | X_EXECUTOR_PRIVATE_KEY | Key executing under wallet grants. |
| Ops | X_POLL_MS | Poll interval; default 20,000 ms, minimum 5,000 ms. |
| Ops | X_POSTING_ENABLED | 1 or true enables public replies. |
| Ops | X_REPLY_IMAGES_ENABLED | 0 or false disables reply images. Otherwise images are enabled for replies when posting is on; image preparation/upload failures can fall back to text. |
| Ops | DATABASE_URL | Required for account links, cursor, one-time mention claims, durable execution recovery, reply delivery and separate polling/execution/delivery health. |
The callback origin must match the browser origin that writes OAuth cookies. Starting on another origin redirects to the configured canonical origin.
The relay's session credential is sensitive account access. Do not publish it or put it in a client variable. Startup resolves the session's stable account id; a configured-handle mismatch prevents the relay from starting. Turning replies off does not turn trading off.
Testnet onboarding faucet on web
| Name | Purpose |
|---|---|
STT_FAUCET_ENABLED | Only the exact value true enables STT allocations. |
STT_FAUCET_PRIVATE_KEY | Dedicated server-only Shannon funding key, separate from admin, runner and sponsor keys. |
STT_FAUCET_RPC_URL | Optional HTTP endpoint override; sends require chain id 50312. |
DATABASE_URL | Required shared durable challenge, quota and signed-transfer records. |
Fund the dedicated wallet with Shannon STT. The address and readable balance are returned by GET /api/faucet; the API never returns its private key or signed transaction bytes. Do not use the same key for unrelated transactions: a conflicting nonce stops allocations for review.
The fixed policy tops wallets below 1 STT up to 2 STT, once per rolling 24 hours, with a 40 STT rolling global allocation and 10 STT retained reserve. The fee envelope is checked separately before signing. Limits and pending transfers are coordinated with a PostgreSQL transaction lock across web instances. A missing database or unreadable required chain state prevents a new transfer.
Production POST routes currently trust Vercel's overwritten x-forwarded-for header for an HMAC-derived connection identifier. Production outside Vercel fails closed until a trusted proxy adapter is implemented. Raw IPs are not stored. A shared connection can receive at most ten allocations per rolling 24 hours; signature challenges are also limited. These caps bound distribution but are not proof that each wallet belongs to a different person.
Only the STT leg uses this service. The tUSDC leg remains the user's transaction through the DreamDEX SDK faucet. This is independent of the older sponsorship routes below and grants no trading or deposit permission.
Sponsor and private desk on web
| Name | Purpose |
|---|---|
SPONSOR_PRIVATE_KEY | Pays STT for accepted vault relay calls and duel-key gas top-ups. |
SPONSOR_RPC_URL | Optional sponsor HTTP endpoint override. |
SPONSOR_MAX_GAS | Ceiling for a forwarded vault request. |
SPONSOR_PER_ADDRESS_PER_HOUR | Request cap; default 30. |
SPONSOR_PER_DEVICE_PER_HOUR | Device cap; default 60. |
SPONSOR_GAME_MAX_WEI | Per-match duel gas top-up ceiling. |
PRIVATE_DESK_PRIVATE_KEY | Key matching the contract's named desk. |
PRIVATE_DESK_RPC_URL | Optional desk HTTP endpoint override. |
The sponsor declines unsupported targets, selectors, native value, gas or deadlines. It never supplies the player's deposit or pot. Sponsor counters and funded-seat tracking are process-local, not shared durable quotas.
PrivateDesk checks its named key, pause state, stake limits and gas readiness. Its open is three desk transactions, so the key must fund more than one send.
Game room and recovery
| Name | Process and purpose |
|---|---|
ROOM_TOKEN_SECRET | Same server secret on web and room; ops requires at least 16 characters. |
GAME_ROOM_PUBLIC_URL | Web-visible room WebSocket URL, returned by room-token API. |
GAME_ROOM_HOST | Ops listen host; default loopback. |
GAME_ROOM_PORT | Ops listen port; default 8787. |
GAME_ROOM_REGION | Queue grouping; default default. |
GAME_DECK_KEY | 32-byte hex key for AES-256-GCM deck material. |
GAME_DECK_JOURNAL | Persistent journal path; default .masayume/deck-journal.jsonl relative to process working directory. |
GAME_DECK_HORIZON_SEC | Deck eligibility horizon; default one hour. |
GAME_DECK_CREATE_LATENCY_SEC | Time allowance for creation when testing remaining card life; default 45 seconds. |
GAME_CREATE_WINDOW_MS | Wait for pending on-chain creation; default two minutes. |
GAME_PROJECTOR_POLL_MS | Event projection poll interval; default 6 seconds. |
GAME_PROJECTOR_SPAN | Bounded block span; default 800. |
GAME_PROJECTOR_SPANS | Spans per catch-up cycle; default 25. |
GAME_PROJECTOR_FROM | Explicit projector starting block override. |
GAME_SETTLER_PRIVATE_KEY | Key paying for arena maintenance calls. |
GAME_SETTLER_REFRESH_MS | Settler refresh; default 30 seconds. |
The web fallback room secret is random per process. It may support isolated development behavior, but it cannot authenticate tokens to a separate room process. Configure the shared secret for multiplayer.
Maker and leverage keeper
| Name | Purpose |
|---|---|
MAKER_PRIVATE_KEY | Named maker key. |
MM_ASSETS, MM_INTERVALS | Markets considered; default intervals are 300, 900 and 3,600 seconds. |
MM_HALF_SPREAD_RAW | Desired half-spread in raw price units; default 15,000. |
MM_QUOTE_SIZE | Whole contracts per side before contract/lot caps; default 5. |
MM_REFRESH_MS | Maker refresh; default 45 seconds. |
MM_QUOTE_TTL_SEC | Quote lifetime; default 180 seconds. |
MM_REQUOTE_TICKS | Price move before requote; default 3 ticks. |
LEVERAGE_KEEPER_PRIVATE_KEY | Key paying for knock-out and settlement calls. |
LK_REFRESH_MS | Leverage keeper refresh; default 20 seconds. |
Maker, leverage keeper and duel settler default to dry-run. They send only when DRY_RUN is 0 or false. This differs from the strategy runner. Set it deliberately rather than relying on a shared default.
Seasons and contract tools
| Name | Purpose |
|---|---|
SEASON_ID | Enables a configured season; absent means no season. |
SEASON_NAME | Display name, otherwise the id. |
SEASON_ENDS_AT | Required ISO instant when a season id is set. |
SEASON_PRIZE_SPLIT | Rank bands in start:end:amount format. |
SEASON_MIN_STAKED_DUELS | Prize eligibility floor; default 1. |
SEASON_ELIGIBILITY_NOTE | Explanation shown beside eligibility. |
SEASON_ADMIN_PRIVATE_KEY | Operator distribution tool's signing key. |
Share the same season rules between web and payout tools. The contract end time does not automatically authorize or trigger payout.
Contract scripts separately use settings such as DEPLOYER_PRIVATE_KEY, SHANNON_FORK_URL, FORK_MARKET_ID, FORK_RESOLVED_MARKET_ID, FORK_ASSET and SETTLED_QUESTION_ID for specific deployment/fork scenarios. Inspect the selected script: these are not web runtime variables and should not be copied wholesale into a web host.
Source notes
This guide follows the application code reviewed on 2026-09-07. Links point to that reviewed commit and require repository access. GitHub may show 404 if you are signed out or do not have access.
- web/src/features/funding/faucet-config.server.ts
- packages/core/src/faucet/index.ts
- packages/db/src/faucet.ts
- web/src/lib/env.ts
- web/src/lib/docs-url.ts
- packages/markets/src/env.ts
- packages/brain/src/model.ts
- services/ops/src/actors/strategy-runner/env.ts
- services/ops/src/actors/x-relay/env.ts
- services/ops/src/actors/x-relay/rettiwt.ts
- services/ops/src/actors/x-relay/poll-cycle.ts
- packages/db/src/x-health.ts
- web/src/features/x/config.server.ts
- web/src/features/session/sponsor.server.ts
- web/src/features/games/sponsor.server.ts
- web/src/features/private/desk.server.ts
- services/ops/src/actors/game-room/env.ts
- services/ops/src/actors/matchmaker/seal.ts
- services/ops/src/actors/matchmaker/deckmaster.ts
- services/ops/src/actors/market-maker/env.ts
- services/ops/src/actors/leverage-keeper/env.ts
- packages/core/src/games/season.ts