Getting started
Direct is a drop-in RPC provider. Point your app at your Direct RPC URL and it works like any other endpoint — then add a Direct client, in the browser or on your backend, to make those same requests dramatically faster.
1. Use your Direct RPC endpoint
Every Direct project has an RPC URL:
https://prod.rpc.direct.dev/v1/<project>.<token>/<network>Use it anywhere you’d use an RPC endpoint — raw fetch, viem, ethers, or any other library. It speaks standard JSON-RPC, so nothing about your code changes.
import { createPublicClient, http } from "viem";
import { mainnet } from "viem/chains";
const client = createPublicClient({
chain: mainnet,
transport: http("https://prod.rpc.direct.dev/v1/<project>.<token>/ethereum"),
});
await client.getBlockNumber();That already routes your requests through Direct’s network. To go faster, add a Direct client — the SDK in the browser, or the CLI client on your backend.
2. Optimize your requests
The plain URL already works on its own, so adding a Direct client is optional — but highly recommended. It speaks the same JSON-RPC, so your code doesn’t change; it just makes those same requests dramatically faster and more resilient.
Browser
In the browser, install the SDK and call install() once at startup:
npm install @direct.dev/sdkimport { install } from "@direct.dev/sdk";
install();The SDK quietly takes over requests to your Direct RPC URLs — and only those — so viem, ethers, and plain fetch keep working unchanged. On top of the plain endpoint you get:
- Sub-millisecond reads— popular requests are answered instantly from a local cache.
- Less bandwidth— Direct Sync streams only what changed since your last request, instead of resending the full payload.
- A compact wire format— Direct Wire, a binary protocol tuned for web3, replaces verbose JSON-RPC on the network.
- Automatic failover— requests reroute through a healthy path when an upstream is unavailable, with no retry logic to write.
- Optional data integrity— enable quorum checks to send the same request to several providers and compare the results, so you don’t have to trust a single one.
Preload for an instant first request
Add a preload link to your HTML <head>so the browser warms the endpoint before your JS bundle even loads — your first request then resolves locally:
<link
rel="preload"
as="fetch"
crossorigin="anonymous"
href="https://prod.rpc.direct.dev/v1/<project>.<token>/ethereum"
/>The SDK picks up these tags automatically — no extra configuration needed.
Backend
Coming soon— here’s what the CLI client will do.
For server-side workloads, the CLI client brings Direct to your backend. You run it alongside your service, and it exposes a local JSON-RPC endpoint — point your app at it and keep sending the same requests. No library to integrate, no code changes.
const client = createPublicClient({
chain: mainnet,
transport: http("http://localhost:<port>"),
});Everything the SDK gives you:
- Sub-millisecond reads from a local cache.
- Direct Sync— only what changed since your last request.
- Direct Wire— the compact binary protocol tuned for web3.
- Automatic failover across healthy paths.
- Optional quorum data integrity across multiple providers.
Plus true peer-to-peer connectivity.Running natively, without the browser’s networking limits, the CLI client connects straight into the peer-to-peer network:
- Direct UDP connections— hole-punched, node-to-node links instead of routing everything over HTTP.
- Many nodes at once— every request is spread across multiple nodes in the network.
- More throughput, real redundancy— direct connections push higher performance, and fanning out across many nodes keeps you resilient.
That makes the CLI client the fastest way to use Direct: maximum throughput, real peer-to-peer performance, and no single point of failure — built for demanding backend services.
Read next
- Using Direct— both clients and their features in detail.
- How Direct works— the network and the clients, explained.