Dedupe Requests Plugin
The Dedupe Requests Plugin prevents redundant requests by deduplicating similar ones, helping reduce the number of requests sent to the server. docs
import { DedupeRequestsPlugin } from '@orpc/client/plugins'
const link = new RPCLink({
plugins: [
new DedupeRequestsPlugin({
filter: ({ request }) => request.method === 'GET', // Filter requests to deduplicate
groups: [
{
condition: () => true,
context: {}, // Context used throughout the request lifecycle
},
],
}),
],
})
Buffered Mode in Batch Plugin
By default, the plugin uses streaming
mode, which sends responses asynchronously as they arrive. This ensures that no single request blocks others, enabling faster and more efficient batching.
If your environment doesn’t support streaming
responses - such as certain serverless platforms or older browsers - you can switch to buffered mode. In this mode, all responses are collected and sent together. docs
const link = new RPCLink({
url: 'https://api.example.com/rpc',
plugins: [
new BatchLinkPlugin({
mode: typeof window === 'undefined' ? 'buffered' : 'streaming',
groups: [
{
condition: options => true,
context: {},
},
],
}),
],
})
Hey API Integration
Easily convert a Hey API generated client into an oRPC client to take full advantage of the oRPC ecosystem. docs
npx @hey-api/openapi-ts \
-i https://get.heyapi.dev/hey-api/backend \
-o src/client \
-c @hey-api/client-fetch
import { experimental_toORPCClient } from '@orpc/hey-api'
import * as sdk from 'src/client/sdk.gen'
export const client = experimental_toORPCClient(sdk)
const { body } = await client.listPlanets()
AWS Lambda Adapter
docs
oRPC supports AWS Lambda response streaming only.
If you need support for chunked responses, use a combination of Hono’s aws-lambda
adapter and oRPC.
import { APIGatewayProxyEventV2 } from 'aws-lambda'
import { experimental_RPCHandler as RPCHandler } from '@orpc/server/aws-lambda'
const rpcHandler = new RPCHandler(router)
export const handler = awslambda.streamifyResponse<APIGatewayProxyEventV2>(async (event, responseStream, context) => {
const { matched } = await rpcHandler.handle(event, responseStream, {
prefix: '/rpc',
context: {}, // Provide initial context if needed
})
// ...
})
New TanStack Query Integration
A unified TanStack Query integration that supports all libraries under TanStack Query (React, Vue, Angular, Solid, Svelte, etc.). docs
Most use cases will migrate without issue - just update the import.
streamed Options update
The refetchMode
option has been moved from the root level to within queryFnOptions
:
const query = useQuery(orpc.streamed.experimental_streamedOptions({
input: { id: 123 },
- refetchMode: 'reset',
+ queryFnOptions: {
+ refetchMode: 'reset',
+ }
}))
Parse Bracket Notation Update
Now, properties with the same name (i.e., multiple values) are parsed as arrays. docs
color=red&color=blue → { color: ["red", "blue"] }
inferRPCMethodFromContractRouter
By using inferRPCMethodFromContractRouter
, the RPCLink
automatically uses the method specified in the contract when sending requests. docs
import { inferRPCMethodFromContractRouter } from '@orpc/contract'
const link = new RPCLink({
url: 'http://localhost:3000/rpc',
method: inferRPCMethodFromContractRouter(contract),
})
Router to Contract
We now provide documentation and utilities to help convert a router to a client contract without leaking business logic. docs
route.spec
You now can override entire auto-generated operation object via route.spec
docs
const ping = os
.route({
spec: {
operationId: 'customOperationId',
tags: ['tag'],
summary: 'the summary',
requestBody: {
required: true,
content: {
'application/json': {},
}
},
responses: {
200: {
description: 'customSuccessDescription',
content: {
'application/json': {},
},
}
},
}
})
.handler(() => {})
Validation Schema Update
- Zod: Updated support to version 3.25.49
- valibot: Added support for output strategy in the schema converter
🚀 Features
- client:
- client, server:
- contract:
- contract, openapi:
- hey-api:
- openapi:
- standard-server:
- tanstack-query:
- valibot:
- zod: