Introduction

Nexus allows you to configure the server using environment variables. These variables are used in conjunction with the NexusConfigOptions interface to configure the Nexus server.

Environment Variables

Below is a table of standard Nexus environment variables that can be set to configure the Nexus server.

NameDescriptionDefaultRequiredExample
NEXUS_CHAINSA JSON array of chains. Each chain should have a name, chainId, and blockTime.See default chainsNo[{"name": "eth_mainnet", "chainId": 1, "blockTime": 12}, [{"name": "base_mainnet", "chainId": 8453, "blockTime": 2}]
NODE_PROVIDERSA JSON array of node providers. Each provider should have a name, url, and chainId. Each chainId should refer to either a default chains or a chainId set in the NEXUS_CHAINS environment variable. Node proviers can additionally have an weight field, which defaults to 1. This value is used for load balancing.-Yes[{"name": "eth.public", "url":"https://eth.public-rpc.com", "chainId": 1}]

[{"name": "eth.public", "url":"https://eth.public-rpc.com", "chainId": 1, "weight": 3}, {"name": "tenderly", "url":"", "chainId": 1, "weight": 7}]
NEXUS_PORTThe port the Nexus server should listen on.4000No4000
NEXUS_RPC_AUTH_KEYThe secret key used to authenticate requests to the Nexus server.-Nomy-secret-key
NEXUS_RELAY_ORDERThe order in which to cycle through node providers when a request fails. Can be either random or sequential.sequentialNorandom
NEXUS_RELAY_FAILUREA string or a JSON array that configures error recovery. Can be set to fail-immediately or ["cycle-requests", <max number of retries>]["cycle-requests", 3]No["cycle-requests", 5]
NEXUS_LOG_LEVELThe log level for the Nexus server. Can be set to debug, info, warn, or error.infoNodebug
NEXUS_LOG_COLORIZEWhether to colorize the logs. Can be set to true or false. Recommended to set to false on production.trueNofalse
NEXUS_SUBSCRIPTION_SHARING_ENABLEDWhether to share ethereum subscription rpc calls accross multiple clientstrueNofalse