Configuration
All services are configured through environment variables. This page documents the required and optional variables for each service.
Backend (backend/.env)
| Variable | Required | Description |
|---|---|---|
PORT | No | Server port (default: 3000) |
DATABASE_URL | Yes | PostgreSQL connection string |
JWT_SECRET | Yes | Secret for signing JWT tokens |
JWT_EXPIRY | No | Access token TTL (default: 15m) |
JWT_REFRESH_EXPIRY | No | Refresh token TTL (default: 7d) |
API_KEY | Yes | API key required in x-api-key header |
MATCHER_URL | Yes | Matcher service URL (e.g. http://localhost:3001) |
GCS_BUCKET | No | Google Cloud Storage bucket for uploads |
GCS_PROJECT_ID | No | GCP project ID for uploads |
Matcher (clob/matcher/.env)
| Variable | Required | Description |
|---|---|---|
PORT | No | Server port (default: 3001) |
DATABASE_URL | Yes | PostgreSQL connection string |
RPC_URL | Yes | EVM RPC endpoint |
CHAIN_ID | Yes | Chain ID for signature validation |
EXCHANGE_ADDRESS | Yes | Deployed CTFExchange contract address |
COLLATERAL_TOKEN_ADDRESS | Yes | Deployed collateral ERC-20 address |
OPERATOR_PRIVATE_KEY | Yes | Private key for submitting settlement txs |
START_BLOCK | No | Block to start event polling from (default: 0) |
POLL_INTERVAL_MS | No | Event polling interval (default: 5000) |
Contracts (packages/polymarket-mvp/.env)
| Variable | Required | Description |
|---|---|---|
RPC_URL | Yes | EVM RPC endpoint |
PK | Yes | Deployer private key |
ETHERSCAN_API_KEY | No | For contract verification |
MVP_OWNER | Yes | Owner address for deployed contracts |
EXCHANGE_ADMIN | Yes | Exchange admin address |
EXCHANGE_OPERATOR | Yes | Exchange operator address |
CTF_ADDRESS | No | Existing CTF address (zero = deploy new) |
COLLATERAL_ADDRESS | No | Existing collateral address (zero = deploy new) |
MOCK_UMA_ADAPTER_ADDRESS | No | Existing adapter address (zero = deploy new) |
POLY_PROXY_IMPLEMENTATION | No | Existing proxy impl (zero = deploy new) |
POLY_SAFE_MASTER_COPY | No | Existing safe impl (zero = deploy new) |
POLY_PROXY_FACTORY | No | Existing proxy factory (zero = deploy new) |
POLY_SAFE_FACTORY | No | Existing safe factory (zero = deploy new) |
TIP
Set contract addresses to 0x0000000000000000000000000000000000000000 to deploy fresh instances. Provide existing addresses to reuse previously deployed contracts.