Skip to content

Configuring ENSApi

ENSApi’s behavior can be configured through environment variables. Copy .env.local.example to .env.local and configure all required values.

.env.local.example
# The port ENSApi listens on.
# Optional. If this is not set, the default value is 4334.
# PORT=4334
# ENSIndexer: The "primary" ENSIndexer service URL.
# Required. This URL is used to read ENSIndexer's Config and Indexing Status APIs.
ENSINDEXER_URL=http://localhost:42069
# ENSDb: Database URL
# Required. This is the connection string for the ENSDb database in which ENSIndexer is storing data.
# It should match the DATABASE_URL used by the connected ENSIndexer.
# It should be in the format of `postgresql://<username>:<password>@<host>:<port>/<database>`
#
# See https://ensnode.io/ensindexer/usage/configuration/ for additional information.
# NOTE that ENSApi does NOT need to define DATABASE_SCHEMA, as it is inferred from the connected ENSIndexer's Config.
DATABASE_URL=postgresql://dbuser:abcd1234@localhost:5432/my_database
# ENSApi: RPC Configuration
# Required. ENSApi requires an HTTP RPC to the connected ENSIndexer's ENS Root Chain, which depends
# on ENSIndexer's NAMESPACE (ex: mainnet, sepolia, holesky, ens-test-env). This ENS Root Chain RPC
# is used to power the Resolution API, in situations where Protocol Acceleration is not possible.
#
# When ENSApi starts up it connects to the indicated ENSINDEXER_URL verifies that the ENS Root Chain
# RPC for the specified namespace is defined.
#
# NOTE: You must configure your own private RPC endpoints. Public RPC endpoints are rate limited and
# will likely not provide acceptable performance (though this depends on how many non-acceleratable
# Resolution requests you make to ENSApi).
#
# Private RPC service options include:
# - Alchemy - https://www.alchemy.com
# - QuickNode - https://www.quicknode.com
# - Infura - https://infura.io
# - DRPC - https://drpc.org
#
# The following environment variables are supported:
# - ALCHEMY_API_KEY — if set, an Alchemy RPC URL will be provided for each of the chains it supports
# - DRPC_API_KEY — if set, an DRPC RPC URL will be provided for each of the chains it supports
# - RPC_URL_${chainId} — specific, per-chain RPC settings (see below).
#
# If RPC_URL_${chainId} is specified, it will take precedence over the automatic RPC URLs from
# Alchemy or DRPC. It must be a comma-separated list of HTTP/HTTPS RPC endpoints. If multiple
# HTTP RPC endpoints are provided for a single chain, they will be used in order, falling back if
# RPC errors are encountered. If multiple automatic RPC environment variables are specified, they
# will be used in the following order: Alchemy > DRPC.
#
# Automatic:
# ALCHEMY_API_KEY=xyz
# DRPC_API_KEY=xyz
#
# Chain-Specific:
# RPC_URL_1=https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY
# RPC_URL_11155111=https://eth-sepolia.g.alchemy.com/v2/YOUR_API_KEY
# RPC_URL_17000=https://eth-holesky.g.alchemy.com/v2/YOUR_API_KEY
# RPC_URL_1337=http://localhost:8545