https://github.com/whats-good/nexus
A load balancing blockchain RPC reverse proxy written in TypeScript.
https://github.com/whats-good/nexus
Last synced: about 1 year ago
JSON representation
A load balancing blockchain RPC reverse proxy written in TypeScript.
- Host: GitHub
- URL: https://github.com/whats-good/nexus
- Owner: whats-good
- Created: 2023-11-07T11:49:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-05T13:07:49.000Z (almost 2 years ago)
- Last Synced: 2025-04-06T23:13:26.898Z (about 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 1.13 MB
- Stars: 17
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-web3-data - nexus - Load balancing blockchain RPC reverse proxy in TypeScript. [Rust implementation](https://github.com/whats-good/rpc-gateway) W.I.P. (Infrastructure / Load Balancers)
README







## Introduction
Welcome to `Nexus` - a load balancing blockchain RPC reverse proxy written in TypeScript.
## Documentation
Check out our [documentation](https://nexus.whatsgood.dog) for detailed instructions.
## Installation
```sh
# npm
npm install @whatsgood/nexus
# pnpm
pnpm install @whatsgood/nexus
# yarn
yarn add @whatsgood/nexus
```
## Quickstart
```typescript
// node.js standalone server example
import { Nexus, NodeProvider, CHAIN } from "@whatsgood/nexus";
import { createServer } from "node:http";
const llamaRpcNodeProvider = new NodeProvider({
name: "llama-rpc",
chain: CHAIN.ETHEREUM_MAINNET,
url: "https://eth.llamarpc.com",
});
const tenderlyNodeProvider = new NodeProvider({
name: "tenderly",
chain: CHAIN.ETHEREUM_MAINNET,
url: "https://gateway.tenderly.co/public/mainnet",
});
const nexus = Nexus.create({
nodeProviders: [llamaRpcNodeProvider, tenderlyNodeProvider],
port: 4000,
});
createServer(nexus).listen(nexus.port, () => {
console.log(`🚀 Server ready at http://localhost:${nexus.port}`);
});
```
## Interaction
In this example, since we have configured the server to connect to `Ethereum Mainnet`, we supply the chain id = `1` as the endpoint.
```bash
curl \
-X POST http://localhost:4000/1 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
```