@nexload-sdk/orpc-client
v2.0.0
Published
A minimal, high-performance factory for creating optimized oRPC clients, designed for persistent, low-latency, server-to-server communication in cloud-native architectures.
Maintainers
Readme
@nexload-sdk/orpc-client
Minimal wrapper around oRPC client creation for server-side usage.
Install
pnpm add @nexload-sdk/orpc-clientExport
- default export:
ORPCClientclass
Quick Start
import ORPCClient from "@nexload-sdk/orpc-client";
import type { AppRouter } from "./contract";
const factory = new ORPCClient<AppRouter>("http://localhost:3000");
const client = factory.createClient();Behavior
ORPCClient:
- reads env values using
@nexload-sdk/env - merges
@nexload-sdk/env/presetsnode preset withPAYLOAD_API_URL - builds default headers for RPC requests:
Content-TypeAcceptAccept-EncodingUser-AgentX-ServiceX-Communication
Environment Variables
PAYLOAD_API_URL: optional override for the constructor URLNODE_ENVSERVICE_NAMELOG_LEVEL(through logger)
API
new ORPCClient(defaultApiUrl?)
Creates a client factory instance.
createClient(options?)
Returns a typed ContractRouterClient<TRouter> using @orpc/client + fetch RPCLink.
Notes
- This package currently uses oRPC's fetch link directly.
