oRPC is currently pre-stable, please report any issues on our Discord or GitHub 🚧
oRPC
background

Caller/Client

Make your procedures callable in oRPC.

Make procedures callable with .callable()

import {  } from '@orpc/server'
import {  } from 'zod'
 
export const  = 
  .(.({
    : .(),
  }))
  .(.())
  .(async ({  }) => {
    return `Hello ${.}`
  })
  .()
 
// use it like a regular function
const  = await ({ : 'Unnoq' })

use call helper function

import {  } from '@orpc/server'
import {  } from '@orpc/server'
import {  } from 'zod'
 
export const  = 
  .(.({
    : .(),
  }))
  .(.())
  .(async ({  }) => {
    return `Hello ${.}`
  })
 
// call a procedure without creating a client
const  = await (, { : 'Unnoq' })

Use createRouterClient or createProcedureClient

To call multiple procedures with shared context, use a Router Client.

import { , ,  } from '@orpc/server'
 
const  = .({
    : .(() => 'pong')
})
 
const  = ()
 
const  = await .() // result is 'pong'
 
const  = (.)
const  = await () // result is 'pong'

On this page