Skip to main content
The Playground server (apps/playground) serves the built page and runs the relay, the proxies and the lab sellers. It is stateless, and its one secret is the optional Bazaar access key, read from a file: every other setting below is public, and most of it is published to the page at GET /api/config. It serves stellar:testnet only.

From source

From a source checkout with Node.js 24.11 or later:
pnpm build builds the workspace packages and the page (web/dist). By default the server uses the SDF testnet RPC, Horizon and Friendbot, Rail402 at https://testnet.rail402.dev as facilitator and Bazaar, the demo seller at https://demo.rail402.dev, and Circle’s testnet USDC. PLAYGROUND_PAY_TO is the public G… testnet account the lab sellers are paid to. It needs a trustline for the asset; create it with the CLI (rail402 keys new, then rail402 account setup) and keep its key to yourself: the Playground never takes one. Without an account, set LAB_ENABLED=false: the lab sellers (the sandbox route, the greedy route and the offers) then answer playground_feature_disabled, and the page shows the refusals that need them (“Seller charges over the cap” and the network, asset and amount checks) as turned off. GET /health reports the version and commit; GET /ready passes once the page is built and the facilitator answers /supported.

Docker

The image holds the server and the built page, runs as the node user and listens on port 8080. Build it from the repository root:
Behind a TLS proxy, set PUBLIC_URL to the public https origin and TRUSTED_PROXY_HOPS to the number of proxies that set X-Forwarded-For, so the per-client limits see the client’s address. Run one replica: the limits are kept in memory.

Local mode

PLAYGROUND_MODE=local lets the relay reach sellers on loopback over plain http on their own port, for a Rail402 and sellers running on the same machine. It is allowed only with a loopback PUBLIC_URL, and the server then listens on loopback only: HOST defaults to 127.0.0.1, and any other address than 127.0.0.1, ::1 or localhost is refused, since anyone who could reach the server could use the relay to call the services on your machine. Point FACILITATOR_URL, BAZAAR_URL, DEMO_SELLER_URL, RPC_URL and the asset settings at your own services; the conformance run does exactly that on the public testnet.

Configuration

The server reads its environment once at startup and refuses to start (exit code 78, playground_config_invalid) on any invalid value, naming the variable, and when any value is a Stellar secret seed. The limits in How it works are set with RELAY_UNPAID_PER_MINUTE, RELAY_UNPAID_BURST, RELAY_UNPAID_PER_NETWORK_PER_MINUTE, RELAY_PAID_PER_MINUTE, RELAY_PAID_GLOBAL_PER_MINUTE, RELAY_TRUSTED_PAID_GLOBAL_PER_MINUTE, RELAY_IN_FLIGHT_PER_IP, RELAY_IN_FLIGHT_PER_HOST, RELAY_IN_FLIGHT_GLOBAL, RELAY_STREAMS_PER_IP, RELAY_STREAM_MAX_MS, RELAY_HOST_PER_MINUTE, RELAY_TRUSTED_HOST_PER_MINUTE, RELAY_BYTES_PER_IP_PER_DAY, RELAY_BYTES_PER_NETWORK_PER_DAY, RELAY_BYTES_GLOBAL_PER_DAY, PROXY_PER_MINUTE, PROXY_GLOBAL_PER_MINUTE, LAB_UNPAID_PER_MINUTE, LAB_PAID_PER_MINUTE and LAB_PAID_GLOBAL_PER_MINUTE.

Bazaar access key

Without a key, the Bazaar counts every visitor of the Playground as the Playground’s one address: all of them share that address’s discovery budget and its share of concurrent discovery requests (DISCOVERY_MAX_IN_FLIGHT_PER_CLIENT, 8 by default), so a few busy visitors get 429 for everyone. Give the Playground a key of the facilitator with the discovery-internal scope whose record sets forwardedClientRequestsPerMinute (see internal discovery callers), in a file readable only by the server, and name the file in BAZAAR_KEY_FILE. Each Bazaar read then carries Authorization: Bearer <key> and X-Rail402-Client, an HMAC-SHA256 of the visitor’s rate-limit key under the access key cut to 32 hex characters, so the Bazaar limits every visitor on its own and the visitor’s address is never sent. The identifier is a pseudonym, not anonymity: the facilitator’s operator holds the key and could compute it for every IPv4 address to find a visitor’s. The key is never published or logged.