Skip to content

Remix Integration

Remix is a full stack JavaScript framework for building web applications with React. For additional context, refer to the Fetch Server Integration guide.

Basic

app/routes/rpc.$.ts
ts
import { RPCHandler } from '@orpc/server/fetch'

const handler = new RPCHandler(router)

export async function loader({ request }: LoaderFunctionArgs) {
  const { response } = await handler.handle(request, {
    prefix: '/rpc',
    context: {} // Provide initial context if needed
  })

  return response ?? new Response('Not Found', { status: 404 })
}

INFO

The handler can be any supported oRPC handler, such as RPCHandler, OpenAPIHandler, or another custom handler.

Released under the MIT License.