Live data from Hacker News

tRPC – Build and consume typesafe APIs without schemas or code generation

trpc.io

11–20 of 223 posts

Re: tRPC – Build and consume typesafe APIs without schemas or code generation

#11
post #9

I have used tRPC for two ~50k loc web applications and love it. The DX is incredible. But I feel like tRPC had its hype time some time ago, so RSC’s hype quickly caught up. These days everyone speaks about whether to use or not to use RSC while there is such a great stable solution like tRPC out there. I am not against RSC, but there is way too much discussion about it. tRPC is a super pragmatic way to create applica…

What does the Royal Shakespeare Company have to do with RPC?

(or please define/link acronyms folks may not know!)

Re: tRPC – Build and consume typesafe APIs without schemas or code generation

#13
post #7

We’ve use an API style similar to tRPC at Notion, although our API predated tRPC by 4 years or so. You can build this kind of thing yourself easily using Typescript’s mapped types, by building an object type where the keys are your API names, and the values are { request, response } types. Structure your “server” bits to define each API handler as a function taking APIs[“addUser”][“request”] and returning Promise . T…

Is there some trick to doing validation of request data using this process? That's a valuable part of using something like tRPC, JSON Schema + type generation, zod, etc.

Re: tRPC – Build and consume typesafe APIs without schemas or code generation

#14
post #9

I have used tRPC for two ~50k loc web applications and love it. The DX is incredible. But I feel like tRPC had its hype time some time ago, so RSC’s hype quickly caught up. These days everyone speaks about whether to use or not to use RSC while there is such a great stable solution like tRPC out there. I am not against RSC, but there is way too much discussion about it. tRPC is a super pragmatic way to create applica…

What does the Royal Shakespeare Company have to do with RPC? (or please define/link acronyms folks may not know!)

I'm guessing React Server Components which is apple to oranges with tRPC.

Re: tRPC – Build and consume typesafe APIs without schemas or code generation

#15
post #9

I have used tRPC for two ~50k loc web applications and love it. The DX is incredible. But I feel like tRPC had its hype time some time ago, so RSC’s hype quickly caught up. These days everyone speaks about whether to use or not to use RSC while there is such a great stable solution like tRPC out there. I am not against RSC, but there is way too much discussion about it. tRPC is a super pragmatic way to create applica…

For what it’s worth I have never heard of RSC and it’s not googleable. Have a link?

Re: tRPC – Build and consume typesafe APIs without schemas or code generation

#18

I am up voting this because its a good idea and you have really nice web site. I wrapped up something like this myself a few weeks ago, so I am in a position to offer some suggestions other people may not think about. The most common mistake I see with RPC, especially WebSockets, using Node.js is that they must be based off of HTTP. My attempt is based upon WebSockets, RFC 6455, where RPC is a generic term for socket…

You can design to be transport agnostic. Then add various transport types: sockets, http, in memory (for testing)…
Post reply on HN