How roborun-xyz/sol-rpc-router works
sol-rpc-router is a Solana JSON-RPC and WebSocket gateway that authenticates clients, enforces per-key limits, and routes traffic across configured providers. The principal HTTP path is client → assembled router/middleware → authenticated proxy handler → backend selection and upstream attempt, with retries or transaction fan-out where configured. Separate capabilities include WebSocket proxying, health probes and detailed health reporting, Prometheus metrics, and API-key administration. Edges below are limited to relationships shown in the excerpts or explicitly documented in the README; unsampled wiring is omitted.
Main entry points: handlers.rs Proxy and WS Handlers · state.rs Application State · router.rs HTTP and WS Routers · keystore.rs Key Stores
Components 17
Gateway Entry
- HTTP and WS Routers
src/router.rs - Proxy and WS Handlers
src/handlers.rs - RPC Parsing
src/rpc.rs - Application State
src/state.rs
Routing and Upstreams
- Backend Selection
src/state.rs - Upstream Requests
src/upstream.rs
Identity and Config
- Runtime Configuration
src/config.rs - Key Stores
src/keystore.rs - Key Administration
src/bin/rpc-admin.rs
Health and Observability
- Health Probes
src/health.rs - Backend Health State
src/health.rs - Metrics and Health Routes
src/router.rs - Grafana Dashboard
grafana/dashboards/sol-rpc-router.json
Other components
- RPC Client
- Solana Providers
- Redis
- Prometheus Scraper
Connections 20
- RPC Client → HTTP and WS Routers: sends RPC
README.md - HTTP and WS Routers → Proxy and WS Handlers: routes requests
src/router.rs - Proxy and WS Handlers → Key Stores: validates key
README.md - Proxy and WS Handlers → RPC Parsing: probes method
README.md - Proxy and WS Handlers → Application State: reads runtime state
src/handlers.rs - Application State → Backend Selection: holds routing state
src/state.rs - Proxy and WS Handlers → Backend Selection: selects backend
README.md - Proxy and WS Handlers → Upstream Requests: builds attempts
src/handlers.rs - Upstream Requests → Solana Providers: forwards RPC
README.md - Solana Providers → Proxy and WS Handlers: returns response
- Runtime Configuration → Application State: configures runtime
- Runtime Configuration → Key Stores: chooses store
src/config.rs - Key Stores → Redis: reads keys
src/keystore.rs - Key Administration → Redis: manages keys
- Health Probes → Solana Providers: probes backend
src/health.rs - Health Probes → Backend Health State: updates status
src/health.rs - Application State → Backend Health State: retains health
- HTTP and WS Routers → Metrics and Health Routes: exposes routes
src/router.rs - Prometheus Scraper → Metrics and Health Routes: scrapes metrics
- Grafana Dashboard → Prometheus Scraper: visualizes metrics