tRPC
trpc/trpc: ๐งโ Move Fast and Break Nothing. End-to-end typesafe APIs made easy.
tRPC is a library that allows you to build and consume fully typesafe APIs without schemas or code generation. It is an alternative to traditional REST or GraphQL, designed specifically for full-stack TypeScript developers. With tRPC, you can share types directly between your client and server without relying on code generation.
tRPC provides full static type safety and auto-completion on the client for inputs, outputs, and errors. It has zero dependencies and a small client-side footprint. The library is also framework agnostic, with adapters built for popular frameworks, and supports subscriptions and request batching.
RPC (Remote Procedure Call) is a way of calling functions on one computer (the server) from another computer (the client). tRPC allows you to call functions and receive responses without considering implementation details like HTTP/REST.
To start with RPC, you'll need to install the necessary packages and set up a backend router. You can then define your API procedures (queries, mutations, and subscriptions) and serve the API using an adapter. Finally, you can use the RPC client to interact with the API on the client side, leveraging complete type safety and auto-completion.