This syntax is in alpha and may change at any moment. Use with caution!

Procedures are split into 3 distict types:

Common terms

Middleware - TODO

Resolver - TODO

Procedure - A procedure is the basic building block of rspc. A procedure is built up of a chain of Middleware and a Resolver. These form a single unit that represents a single operation on your server.

Router - A router is a collection of procedures. Routers can be combined together to allow splitting your API definition over multiple files. It's recommended each router hols all of the procedures to do the support operations for a single resource.

Context - TODO

Types of procedures

Query - A query represents a request for data. It is assumed that all queries do not have side effects (opens in a new tab). This makes it safe for the frontend to automatically retry or refetch the data.

Mutation - A request to change data. It is assumed that these will have side effects and is designed to be called with data from an event listener.

Subscription - A server to client stream of data. This is designed to allow building real time systems.

Defining a procedure


Defining a router