Self-host the API
Run isolated Sepolia and mainnet profiles against any compatible Ethereum RPC.
Requirements
- Node.js 22.13 or newer;
- an HTTP RPC supporting
eth_chainId,eth_blockNumber,eth_getBlockByNumber,eth_getCode,eth_getLogs, andeth_call; and - optionally, a WebSocket endpoint supporting new heads and log subscriptions.
No wallet, key, seed phrase, message broker, external database, or vendor-specific service is required.
Run this from the companion application repository
The commands below belong to the separately published D17 application repository, whose root contains apps/api. This Fumadocs/Scalar repository documents that service but does not bundle the runtime API source.
Configure
cp apps/api/.env.sepolia.example apps/api/.env.sepolia
cp apps/api/.env.mainnet.example apps/api/.env.mainnetSet RPC_URL independently in each file. Add WS_URL when available. Keep profile ports, state files, manifests, and logo directories distinct.
npm run api:allDefault health URLs:
- Sepolia:
http://127.0.0.1:8787/api/health - Mainnet:
http://127.0.0.1:8788/api/health
Web app switch
Set NEXT_PUBLIC_D17_DATA_MODE=api and point the web app's network-specific API/WS URLs at these profiles. This changes display reads only; deploy and participant transactions remain wallet-signed.
Catch-up and state
The index starts at the deployment manifest's start block. HTTP eth_getLogs performs initial catch-up, reconnect repair, reorg lookback, and safety reconciliation. WebSocket logs/heads are the primary live source when configured.
Each profile writes one JSON state file. Run exactly one writer for that file. Stop the profile before copying a backup. A mismatched chain ID or shared state path fails closed.
HTTP-only operation
Leave WS_URL empty and set INDEX_SOURCE_MODE=http-poll. This is simpler but introduces polling-interval latency. It does not change API shapes.