ar.io Logoar.io Documentation

Configuration

All configuration is via environment variables. Create a .env file or set them directly in your environment.

The admin UI setup wizard at http://localhost:3001 can generate a .env file for you.

Server

VariableDefaultDescription
PORT3000Public server port
HOST0.0.0.0Public server bind address
BASE_DOMAINlocalhostBase domain for ArNS subdomain routing
ROOT_HOST_CONTENT(empty)ArNS name or txId to serve at root domain
RESTRICT_TO_ROOT_HOSTfalseOnly serve root domain content (404 for subdomains/txIds)
GRAPHQL_PROXY_URL(empty)Upstream GraphQL endpoint for /graphql proxy

Root Host Configuration

ROOT_HOST_CONTENT accepts either an ArNS name or a transaction ID (auto-detected by format):

# ArNS name
ROOT_HOST_CONTENT=wayfinder

# Transaction ID (43-char base64url)
ROOT_HOST_CONTENT=bNbA3TEQVL60xlgCcqdz4ZPHFZ711cZ3hmkpGttDt_U

When set, the root domain serves this content instead of the info page. The info page moves to /wayfinder/info.

Operating Mode

VariableDefaultDescription
DEFAULT_MODEproxyOperating mode: proxy or route
ALLOW_MODE_OVERRIDEtrueAllow ?mode= query parameter to override

Modes:

  • proxy - Fetch, verify, and serve content through the router
  • route - Redirect clients directly to a gateway URL

Routing

Controls where content is fetched from.

VariableDefaultDescription
ROUTING_STRATEGYfastestGateway selection strategy
ROUTING_GATEWAY_SOURCEnetworkWhere to get the gateway list
ROUTING_STATIC_GATEWAYS(see below)Comma-separated gateway URLs (when source=static)
TRUSTED_PEER_GATEWAYhttps://turbo-gateway.comGateway for peer list (when source=trusted-peers)
TRUSTED_ARIO_GATEWAYS(empty)Trusted gateways (when source=trusted-ario)

Routing Strategies

StrategyBehaviorBest For
fastestConcurrent ping, use first responderLowest latency
randomRandom selection from healthy gatewaysLoad distribution
round-robinSequential rotation through gatewaysPredictable distribution
temperatureWeighted selection based on recent performanceProduction (recommended)

The temperature strategy tracks per-gateway latency and success rate. Better-performing gateways get more traffic, but slower gateways still receive some requests to detect improvements.

Gateway Sources

SourceBehavior
networkAll ar.io gateways from the on-chain registry (recommended)
trusted-peersPeer list from TRUSTED_PEER_GATEWAY
trusted-arioSpecific gateways from TRUSTED_ARIO_GATEWAYS
staticManual list from ROUTING_STATIC_GATEWAYS

Verification

Controls content integrity verification.

VariableDefaultDescription
VERIFICATION_ENABLEDtrueEnable content hash verification
VERIFICATION_GATEWAY_SOURCEtop-stakedSource for trusted gateways
VERIFICATION_GATEWAY_COUNT3Number of gateways to query for verification
VERIFICATION_STATIC_GATEWAYS(see below)Comma-separated URLs (when source=static)
VERIFICATION_RETRY_ATTEMPTS3Gateways to try before failing
ARNS_CONSENSUS_THRESHOLD2Minimum gateways that must agree on ArNS resolution

Verification Sources

SourceBehavior
top-stakedTop N gateways by stake (economic security, recommended)
staticManual list from VERIFICATION_STATIC_GATEWAYS

Cache

VariableDefaultDescription
CONTENT_CACHE_ENABLEDtrueEnable verified content cache
CONTENT_CACHE_MAX_SIZE_BYTES53687091200 (50GB)Maximum total cache size
CONTENT_CACHE_MAX_ITEM_SIZE_BYTES2147483648 (2GB)Maximum single item size
CONTENT_CACHE_PATH(empty)Disk path for persistence (empty = in-memory only)
ARNS_CACHE_TTL_MS300000 (5min)ArNS resolution cache TTL

Disk-Backed Cache

For production, enable disk persistence:

CONTENT_CACHE_PATH=./data/content-cache

When set:

  • LRU holds metadata only (low memory footprint)
  • Content stored as files on disk (<sha256>.bin + <sha256>.meta.json)
  • Cache survives restarts
  • Atomic writes via temp file + rename for crash safety

Admin UI

The admin UI runs on a separate port for security.

VariableDefaultDescription
ADMIN_UI_ENABLEDtrueEnable admin UI server
ADMIN_PORT3001Admin server port (must differ from PORT)
ADMIN_HOST127.0.0.1Admin bind address
ADMIN_TOKEN(empty)Bearer token for auth (required when not localhost)
ADMIN_OPEN_BROWSERtrueAuto-open browser on startup

When ADMIN_HOST=0.0.0.0, you must set ADMIN_TOKEN to protect the admin UI.

Resilience

VariableDefaultDescription
RETRY_ATTEMPTS3Retry attempts for failed requests
RETRY_DELAY_MS100Delay between retries
CIRCUIT_BREAKER_THRESHOLD3Failures before marking gateway unavailable
CIRCUIT_BREAKER_RESET_MS60000 (1min)Time before retrying a broken gateway
GATEWAY_HEALTH_TTL_MS300000 (5min)Health status cache TTL
STREAM_TIMEOUT_MS120000 (2min)Per-chunk stream read timeout

Telemetry

VariableDefaultDescription
TELEMETRY_ENABLEDtrueEnable telemetry collection
TELEMETRY_ROUTER_IDrouter-{timestamp}Instance identifier
TELEMETRY_DB_PATH./data/telemetry.dbSQLite database path
TELEMETRY_RETENTION_DAYS30Data retention period
TELEMETRY_SAMPLE_SUCCESS0.1Sampling rate for successful requests (0.0-1.0)
TELEMETRY_SAMPLE_ERRORS1.0Sampling rate for errors

Rate Limiting

VariableDefaultDescription
RATE_LIMIT_ENABLEDfalseEnable per-IP rate limiting
RATE_LIMIT_WINDOW_MS60000 (1min)Rate limit window
RATE_LIMIT_MAX_REQUESTS1000Max requests per IP per window

Content Moderation

VariableDefaultDescription
MODERATION_ENABLEDfalseEnable content moderation
MODERATION_BLOCKLIST_PATH./data/blocklist.jsonBlocklist file (auto-created, hot-reloaded)
MODERATION_ADMIN_TOKEN(empty)Bearer token for moderation API

Arweave HTTP API Proxy

Proxy Arweave node API endpoints (/info, /tx/{id}, /block/height/{h}, etc.).

VariableDefaultDescription
ARWEAVE_API_ENABLEDfalseEnable Arweave API proxy
ARWEAVE_READ_NODES(Arweave tip nodes)Nodes for GET requests
ARWEAVE_WRITE_NODES(falls back to read)Nodes for POST requests
ARWEAVE_API_CACHE_ENABLEDtrueCache API responses

Gateway Ping Service

Background latency probing for the temperature routing strategy.

VariableDefaultDescription
PING_ENABLEDtrueEnable ping service
PING_INTERVAL_HOURS4How often to refresh ping data
PING_GATEWAY_COUNT50Gateways to ping each round
PING_TIMEOUT_MS5000Timeout per ping
PING_CONCURRENCY10Maximum concurrent pings

Shutdown

VariableDefaultDescription
SHUTDOWN_DRAIN_TIMEOUT_MS15000 (15s)Grace period for in-flight requests
SHUTDOWN_TIMEOUT_MS30000 (30s)Total shutdown timeout

Logging

VariableDefaultDescription
LOG_LEVELinfoLog level: trace, debug, info, warn, error, fatal

Example Configuration

# .env - Production example

# Server
PORT=3000
HOST=0.0.0.0
BASE_DOMAIN=yourdomain.com
ROOT_HOST_CONTENT=your-arns-name

# Mode
DEFAULT_MODE=proxy
ALLOW_MODE_OVERRIDE=false

# Routing
ROUTING_STRATEGY=temperature
ROUTING_GATEWAY_SOURCE=network

# Verification
VERIFICATION_ENABLED=true
VERIFICATION_GATEWAY_SOURCE=top-staked
VERIFICATION_GATEWAY_COUNT=3
ARNS_CONSENSUS_THRESHOLD=2

# Cache
CONTENT_CACHE_ENABLED=true
CONTENT_CACHE_PATH=./data/content-cache
CONTENT_CACHE_MAX_SIZE_BYTES=53687091200

# Admin
ADMIN_UI_ENABLED=true
ADMIN_PORT=3001
ADMIN_HOST=127.0.0.1

# Telemetry
TELEMETRY_ENABLED=true
TELEMETRY_DB_PATH=./data/telemetry.db

# Rate Limiting
RATE_LIMIT_ENABLED=true
RATE_LIMIT_MAX_REQUESTS=1000

How is this guide?