Choosing Pagination Strategies for tRPC APIs
A technical guide on choosing between Offset and Cursor pagination in tRPC, featuring performance comparisons and a production-ready implementation for stable data fetching.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
A technical guide on choosing between Offset and Cursor pagination in tRPC, featuring performance comparisons and a production-ready implementation for stable data fetching.
Stop fighting API drift. Learn how tRPC uses TypeScript type inference and Zod to create a zero-codegen, end-to-end type-safe contract between your server and client.
Learn how to diagnose and fix HTTP 400 BAD_REQUEST errors in tRPC caused by Zod schema mismatches between the client payload and server expectations.
tRPC's real payoff isn't "types" — it's deleting the duplicated contract between server and client. Here's the worked example, the rename test that proves it, and where it falls down.
Learn how to implement tRPC procedures to eliminate type drift between your TypeScript server and client using Zod validation and middleware.
Problem The goal is to determine whether tRPC can safely roll back or tolerate a breaking schema change without causing client‑side validation failures. Currently, when a procedure’s Zod schema is altered—for example, by changing an optional field to required—the server validates incoming requests against the new schema and throws a ZodValidationError if the
Request Strategy Trade-offs When designing a tRPC client for users on high-latency connections, the choice between httpBatchLink and httpLink impacts both perceived performance and server resource utilization. The httpBatchLink reduces the number of HTTP handshakes and header overhead by combining multiple procedure calls into a single request. However, this
tRPC relies on a composition pattern where developers define procedure factories, such as publicProcedure and protectedProcedure , to manage access levels. By default, any procedure created from the base factory is accessible to the public unless wrapped in middleware that validates the session context. In large-scale routers with numerous nested endpoints,