Server Actions
Leverage oRPC for type-safe and powerful server actions
Server Actions in oRPC allow you to define type-safe server-side procedures that can be seamlessly invoked from client applications.
To enable a procedure as a server action, you need to call the .actionable() method.
Basic Usage
To make a procedure compatible with server actions, use .actionable() as shown below:
Passing Context via .actionable()
When calling .actionable(), you can pass a context function that provides additional information for the procedure:
Using Middleware to Inject Context
Middleware can be used to inject context dynamically before the procedure is executed:
