Skip to main content
The @orpc/client package lets you call your oRPC procedures from the browser, Node.js, or any JavaScript runtime. It connects to your server through a link, gives you a fully typed proxy client, and integrates with popular data-fetching libraries.

Installation

npm install @orpc/client

How it works

Every client call flows through a link. A link is responsible for serialising the request, sending it over the wire, and deserialising the response. The built-in RPCLink communicates with an oRPC server over HTTP.
import type { RouterClient } from '@orpc/server'
import { createORPCClient } from '@orpc/client'
import { RPCLink } from '@orpc/client/fetch'
import type { router } from './server'

const link = new RPCLink({
  url: 'http://localhost:3000/rpc',
})

export const orpc: RouterClient<typeof router> = createORPCClient(link)
The RouterClient<typeof router> type parameter wires up the exact input, output, and error types for every procedure in your router — so TypeScript catches mistakes before they reach the network.

Calling procedures

The client is a deeply nested proxy that mirrors your router shape:
// Calls planet.list with { limit: 10 }
const planets = await orpc.planet.list({ limit: 10 })

// Calls planet.find with { id: 1 }
const planet = await orpc.planet.find({ id: 1 })

// Calls planet.create
const newPlanet = await orpc.planet.create({ name: 'Earth' })
Each call returns a Promise typed with the procedure’s output type. If the server throws an ORPCError, it propagates to the client as the same typed error class.

Available integrations

RPC client

Learn about createORPCClient, the safe client, and the proxy pattern.

Links

RPCLink, DynamicLink, plugins, and custom headers.

Error handling

ORPCError, isDefinedError, and the safe() helper.

TanStack Query

Works across React, Vue, Solid, Svelte, and Angular.

React Query

Framework-specific utilities for React.

Vue Query

Framework-specific composables for Vue.

Solid Query

Reactive primitives for SolidJS.

Svelte Query

Svelte store integration.

SWR

SWR integration for React.

Vue Colada

Pinia Colada integration for Vue.

Build docs developers (and LLMs) love