Skip to content

Latest commit

 

History

History
83 lines (57 loc) · 2.49 KB

File metadata and controls

83 lines (57 loc) · 2.49 KB

Roxy

An extensible and modular RPC request router and proxy service built in Rust.

CI Crates.io License: MIT

Demo

demo.mov

Overview

Roxy is a JSON-RPC proxy that sits between clients and upstream RPC backends. It distributes requests across multiple backends using exponential moving average (EMA) based health tracking to route traffic toward healthier endpoints. Responses can be cached in a tiered system with an in-memory LRU cache and optional Redis backing. Rate limiting uses a sliding window algorithm to control request throughput. The server accepts both HTTP and WebSocket connections and exposes Prometheus metrics for observability.

Installation

cargo install roxy-proxy

Usage

Run the proxy with a configuration file:

roxy-proxy --config roxy.toml

Validate configuration without starting the server:

roxy-proxy --config roxy.toml --check

Configuration

Create a TOML configuration file:

[[backends]]
name = "primary"
url = "https://eth-mainnet.example.com"

[[backends]]
name = "fallback"
url = "https://eth-mainnet-fallback.example.com"

[[groups]]
name = "main"
backends = ["primary", "fallback"]
load_balancer = "ema"

[routing]
default_group = "main"

[cache]
enabled = true
memory_size = 10000

[server]
host = "0.0.0.0"
port = 8545
Section Description
server Bind address, port, connection limits
backends Upstream RPC endpoints with timeout and retry
groups Backend groups with load balancing strategy
cache Memory size and TTL settings
rate_limit Requests per second and burst limits
routing Method routing rules and blocked methods
metrics Prometheus metrics endpoint

Acknowledgments

Roxy's design draws inspiration from the commonwarexyz/monorepo.

License

This project is licensed under the MIT License - see the LICENSE file for details.