Is tRPC The End Of REST/GraphQL?

preview_player
Показать описание

tRPC is an incredible library that makes working between your client and server so much nicer. The best part of tRPC is how it brings type safety to your API and client interactions which is something I have never seen done before (especially so well). In this video I talk about what tRPC is and why you should learn it.

📚 Materials/References:

🌎 Find Me Here:

⏱️ Timestamps:

00:00 - Introduction
00:56 - Sponsor
02:07 - What Is tRPC?
02:45 - REST Example
06:14 - tRPC Example

#tRPC #WDS #TypeScript
Рекомендации по теме
Комментарии
Автор

Everyone has probably noticed that a lot of modern practices are now mostly old patterns and principles being rediscovered and adapted to modern ecosystems: RPC, Server-side rendering, Functional Programming, having Types, modular monoliths...

PaulSebastianM
Автор

Graphql is very much more useful than trpc when client and server are two completely different apps (which is much more common)

ayandhara
Автор

You can't compare this to REST or GQL. With both those, the expectation is that the server and client code are decoupled - like if you have an API and a UI. With tRPC, it only works if the client and server code are part of the same application. At least that's how I interpret it.

gosnooky
Автор

A mature tech like graphql or rest is never going to die they will always have their own space and will be used for years to come.

arslanali
Автор

This looks great for calls to the same server/network, but external services would require a shared object to make the type safety work. It would have been great to include the disclaimer of this limitation.

jfftck
Автор

Very straightforward and easy to understand. One of the best tutorials over tRPC. Looking forward to the full tRPC project!!!

ilovenaturesound
Автор

I love your videos. Short enough, straight to the point, and very interesting and valuable for any JavaScript dev. It’s also great that you add a gh repo in link so we can examine the code and play around. Please keep doing that. Good job man !

qcmira
Автор

What if my frontend is separated in other project? How cant I import the AppRouter?

Andersondns
Автор

SvelteKit offers endpoint typing out of the box automatically!

noahdunbar
Автор

I was thinking to slowly shift to the t3 stack made by Theo and your are helping me do it faster by explaining each technology that stack uses!

sahilaggarwal
Автор

That's really cool. I imagine that if the Backend and Frontend are separate repositories, we can simply have some kind of automation to connect them because not all apps are in a monorepo. e.g. A Github action that takes the generated types from the BE and create a Pull Request in the FE project with the changes types

_the_one_
Автор

You can easily type the return JSON from your APIs by using VS Code's "JSON to TS" extension. Just trying to spread the word.

MisouSup
Автор

Need a full in dept tutorial on tRPC very similar to your ZOD tutorial(awesome tutorial). Please!

faizanahmed
Автор

tRPC is going to replace REST/GraphQL the same way MongoDB replaced SQL

noaffie
Автор

Thank you for this REST/GraphQL comparison. Super helpful!

Systemv
Автор

You’re not talking about the cons of tRPC :
- can’t upload files
- need a monorepo/monolith for types, you can’t separate backend and frontend
- require JavaScript on front and back

Go with NestJS if you are working on a company project, you have an auth system, queues and everything ready for you with REST endpoints.

ghostlexly
Автор

Thanks Kyle. I would be interested in a trpc tutorial. Between trpc and zod you are so safe you can <fill in the blank>.

eleah
Автор

This is how we did it BEFORE rest. This is literally going backwards to the days of GWT/jsp/jsf only we've replaced Java with TypeScript.

If you think this replaces rest, you don't understand rest.

adambickford
Автор

There is also Protoc buff by google that have type safety but thanks for the new video :)

OzShurki
Автор

Funny that some of the older JS tooling already does this. Meteor with the zodern:relay package does this. And what's more, it works on realtime data subscriptions and supports piped operations and rate limiting.

pupfriend