Cloudflare Tunnel
Expose @dome/backend over HTTPS without opening inbound ports.
Use Cloudflare Tunnel to publish the Dome indexer, relayer, and RPC proxy on your domain — typical setup: https://api.yourdomain.com → http://127.0.0.1:8788.
Published routes
| Path | Service |
|---|---|
/health | Backend health |
/config | Pool limits for SDK |
/get_encrypted, /merkle/root, /commitment | Indexer |
/relayer/withdraw | Relayer |
/rpc | JSON-RPC proxy to Base Sepolia |
Prerequisites
- Domain on Cloudflare (DNS active)
@dome/backendrunning on port 8788 (localhost bind is fine)cloudflaredinstalled:
bash scripts/cloudflare/install-cloudflared.shOne-time setup
cp .dome-local/cloudflare.env.example .dome-local/cloudflare.env
# Edit DOME_TUNNEL_HOSTNAME=api.yourdomain.com
bash scripts/cloudflare/setup-tunnel.shsetup-tunnel.sh will:
- Run
cloudflared tunnel login(open the URL in a browser once) - Create a named tunnel
dome-backend - Write
.dome-local/cloudflare/config.yml - Create DNS:
api.yourdomain.com→ tunnel
Dashboard token (alternative)
In Cloudflare Zero Trust → Networks → Tunnels → create tunnel → copy token.
Add to .dome-local/cloudflare.env:
CLOUDFLARE_TUNNEL_TOKEN=eyJ...Set the public hostname in the dashboard to http://127.0.0.1:8788.
Start / stop
# Backend + tunnel (Base Sepolia)
bash scripts/cloudflare/up-sepolia.sh
# Stop tunnel, circuits server, and Sepolia backend
bash scripts/cloudflare/down-sepolia.shLogs:
.dome-local/run/backend-sepolia.log.dome-local/run/cloudflared.log
Verify
curl -s https://api.yourdomain.com/health | jq
curl -s https://api.yourdomain.com/config | jqExpect ok: true, chainId: 84532, and your pool address from base-sepolia-deploy.json.
Client configuration
SDK / mobile:
DOME_EVM_INDEXER_URL=https://api.yourdomain.com
DOME_ETH_POOL_ADDRESS=0x...Web (dome-web/.env.local):
DOME_BACKEND_URL=https://api.yourdomain.com
DOME_EVM_INDEXER_URL=/api/indexer
DOME_BASE_RPC=/api/rpcOr point directly at the tunnel URL for both indexer and RPC.
Security
- Backend binds to 127.0.0.1; only
cloudflaredreaches it - Set
DOME_RELAYER_SECRETinsepolia.envbefore going public - Tune
DOME_RATE_LIMIT_*in backend env - Do not commit
.dome-local/cloudflare.envor tunnel credentials
Circuits on the same domain
Serve Groth16 artifacts at https://circuits.yourdomain.com:
# In .dome-local/cloudflare.env
DOME_CIRCUITS_HOSTNAME=circuits.yourdomain.com
bash scripts/cloudflare/setup-circuits-route.sh
bash scripts/cloudflare/up-sepolia.shSee Circuit Hosting for R2 and static hosting options.
Production systemd
sudo cloudflared service install
sudo systemctl enable --now cloudflaredUse the config path from .dome-local/cloudflare.env (DOME_TUNNEL_CONFIG).