Configuration and operations
Environment variables, feature bindings, static hosting, durable storage, health checks, and recovery.
Operate the web export and API as separate services. The frontend contains public chain/API settings. The API owns dedicated provider credentials, persistent SQLite state, and immutable media. Contract deployment addresses belong to a specific network and version; consult the network reference.
Required backend configuration
Start from backend/.env.example. Replace every placeholder with the intended deployment’s values; this example is a template, not a ready-to-run configuration:
ROBINHOOD_RPC_URL=https://your-dedicated-provider.example/rpc
ROBINHOOD_CHAIN_ID=46630
FACTORY_ADDRESS=<verified-community-factory-address>
DEPLOYMENT_BLOCK=<earliest-configured-factory-deployment-block>
API_PUBLIC_URL=https://api.your-domain.example
ALLOWED_ORIGINS=https://app.your-domain.example
HOST=127.0.0.1
PORT=8787
DATA_DIR=./data
TRUST_PROXY=false
The chain ID defaults to testnet 46630; mainnet 4663 is the only other accepted value. RPC and public endpoints require HTTPS, with HTTP allowed only on localhost/loopback. API_PUBLIC_URL must be an origin with no credentials, path, query, or fragment. Allowed browser origins follow the same origin restrictions.
DEPLOYMENT_BLOCK must be an unsigned integer within the supported storage range. Set it to the earliest deployment of the factories being indexed. FACTORY_ADDRESS and optional configured addresses must be nonzero Ethereum addresses.
Use a dedicated provider project with historical calls, block headers, and log access. Normal startup has no public-RPC fallback. CODEX_API_KEY is optional, server-only market-data configuration used for mainnet directory search; it is unrelated to wallet signing or contract authorization.
Optional feature bindings
| Feature | Environment fields |
|---|---|
| Managed discovery/trading | MANAGED_FACTORY_ADDRESS, MANAGED_ROUTER_ADDRESS |
| Optional settlement-token router | BASKET_ROUTER_ADDRESS, SETTLEMENT_TOKEN_ADDRESS, WRAPPED_NATIVE_ADDRESS |
| Native creation | NATIVE_FACTORY_ADDRESS, NATIVE_DEX_ROUTER_ADDRESS, NATIVE_DEX_FACTORY_ADDRESS, NATIVE_WRAPPED_ADDRESS, NATIVE_QUOTER_ADDRESS |
| Native intermediate tokens | NATIVE_ROUTE_INTERMEDIATES: at most two distinct comma-separated addresses |
| Proportional ETH trading | NATIVE_TRADING_ROUTER_ADDRESS, plus the native creation venue |
| Share-token liquidity | LIQUIDITY_ROUTER_ADDRESS, LIQUIDITY_DEX_FACTORY_ADDRESS, LIQUIDITY_POSITION_MANAGER_ADDRESS, LIQUIDITY_DEX_ROUTER_ADDRESS, LIQUIDITY_WRAPPED_ADDRESS, LIQUIDITY_QUOTER_ADDRESS, LIQUIDITY_ROUTER02 |
| Additional liquidity quote token | LIQUIDITY_QUOTE_TOKENS: at most one non-wrapped token; wrapped native is added automatically |
Setting NATIVE_FACTORY_ADDRESS requires its associated native venue fields. A native trading router requires that venue and is bound to both community and native registries.
Liquidity requires a native factory and its required configuration, but its venue fields are independent of proportional ETH trading. A native trading router is not required solely to enable liquidity. Omitting the liquidity helper disables liquidity setup/quotes without disabling configured native launch or proportional trading.
Set LIQUIDITY_ROUTER02 explicitly to true or false to match the helper and router ABI. A router getter such as factory() does not identify its swap tuple. Token-settled pool trading is advertised only with Router02 and a configured non-wrapped quote token; the service also checks deadline enforcement when quoting that flow.
Startup validates the RPC chain and configured base/managed/router bytecode. Enabled native and liquidity features additionally verify their contract and venue bindings. A successful startup is an integration check, not a substitute for reviewing deployment provenance.
Process and index settings
| Variable | Default | Accepted values or meaning |
|---|---|---|
HOST |
0.0.0.0 |
Listener address |
PORT |
8787 |
1–65535 |
DATA_DIR |
./data |
Resolved relative to the process working directory |
ALLOWED_ORIGINS |
Public API origin | Comma-separated exact origins |
TRUST_PROXY |
false |
true or false |
INDEX_BATCH_BLOCKS |
250 |
1–1000 |
INDEX_CONFIRMATIONS |
2 |
0–1000 |
INDEX_INTERVAL_MS |
5000 |
1000–60000 |
Enable TRUST_PROXY=true only when a trusted reverse proxy replaces X-Forwarded-For. Otherwise clients could influence the address used for rate limiting. CORS restricts browser origins; it is not API authentication.
Starting the API
From the backend directory:
# Reads process environment and optional .env.local:
npm start
# Watch mode; loads .env and optional .env.local:
npm run dev
# Explicit environment file for an operated service:
node --env-file=.env --experimental-strip-types src/main.ts
npm run start:mainnet loads optional .env.local and requires .env.mainnet.local; the profile must contain the intended mainnet configuration. Keep these local files out of version control. Environment-file behavior is part of the npm command: npm start alone does not load .env.
Use Node 24 and a supervised process with a stable working directory and durable data volume. Place HTTPS termination in front of the Node listener where appropriate. The process handles SIGTERM/SIGINT by closing the HTTP server and database, with a ten-second shutdown fallback.
Build and host the frontend
The public build variables are:
VITE_ROBINHOOD_CHAIN_ID=46630
VITE_API_URL=https://api.your-domain.example
Never put a provider secret in a VITE_ variable: frontend values are bundled for browsers. Application reads use the API’s /rpc; wallet network-add requests use public chain configuration.
The existing frontend is a static Vinext export (output: 'export'). Its build command is npm run build, its hosting root is frontend, and its output directory is dist/client. The repository’s Vercel configuration supplies clean URLs and RSC .txt response content types. Equivalent static hosting must serve those files correctly and preserve direct /etf?basket=…&chain=… access.
Set the intended build variables, rebuild, and include the resulting frontend origin in backend CORS. Validate the root page, direct basket page and reload, network mismatch handling, and API connectivity. This static deployment does not run additional backend handlers added to frontend source.
Storage and backup
DATA_DIR contains launchpad.sqlite and content/. SQLite uses a write-ahead log, so a backup must preserve a consistent database state rather than copying only the main file during writes. One straightforward maintenance approach is to stop the service cleanly, back up the entire data directory, then restart.
The database binds itself to a specific chain/factory set/deployment block and refuses another binding. Index state can be rebuilt from canonical logs if historical RPC access is available. Uploaded metadata and images cannot be reconstructed from event logs; back up content/ independently of replay plans.
The public origin is embedded in uploaded metadata/media URLs. Preserve reachability or provide a deliberate URL migration strategy before changing that origin. The service provides no content replication or garbage-collection endpoint.
Trial setup has separate saved deployment references. A failed restore must be investigated before replacement setup; do not treat unavailable saved state as an empty installation.
Monitor and recover
Monitor standard /health status, ready, indexer, indexedBlock, and lastIndexedAt. Compare the cursor with the head and configured confirmations. A long initial catch-up can remain syncing while the endpoint returns 200.
| Condition | Recovery direction |
|---|---|
| Startup chain mismatch or missing bytecode | Correct the endpoint or deployment binding; do not bypass the validation |
degraded indexer |
Restore RPC block/log/history access; the next tick reconciles and retries |
| 429 or busy quotes | Back off, avoid duplicate in-flight quote requests, and refresh quotes when retried |
| 422 quote | Review amount, backing, balance, route availability, and impact; retrying unchanged inputs may not help |
| Newly confirmed contract unavailable | Allow provider state to catch up; check the selected quote block |
| Metadata 404 after restore | Restore the matching content directory and public URL reachability |
| Invalid token cursor | Restart pagination; cursors expire and are invalidated on service restart |
Provider errors are sanitized before returning to clients. Avoid reintroducing credential-bearing upstream URLs through reverse-proxy logs or custom diagnostic messages. The runtime’s existing health endpoint reports operational state without exposing provider credentials.