Do I even need this anymore?
Вставка
- Опубліковано 22 сер 2024
- HUGE SHOUTOUT TO OUR SPONSOR HIGHLIGHT: www.highlight....
I added tRPC to the Ping codebase in September 2021. It's crazy to think how much has changed since.
USE CREATE T3 APP github.com/t3-...
ALL MY VIDEOS ARE POSTED EARLY ON PATREON / t3dotgg
Everything else (Twitch, Twitter, Discord & my blog): t3.gg/links
S/O Mir for the awesome edit 🙏
CHECK OUT HIGHLIGHT THEY'RE PRETTY DOPE www.highlight.io/r/theo-trpc
Pros and cons for tRPC after I checked it out:
Pros:
- you get type safety on front end
- very easy to call your api
- you can add a middleware to your apis and check for roles and auth
- backend and frontend on same repository
Cons:
- you can use server actions from nextjs for same result and built in
- you can’t upload files with tRPC protocol
- you can’t separate backend and frontend
- you can’t develop a mobile app and connect it to your tRPC backend on a separate repo, everything need to be on the same repo (you can still check turbo repo but meh..)
- you can’t use queues and jobs with a nextjs full stack (bullmq, bee..)
- everything is changing so fast, better go with a more stable choice like NestJS for the backend
thanks. i'll pass on trpc then. if it restricts the scalability to further take my nextjs codebase to extend on mobile platforms then im good without trpc
Would submodules in a github repo, solve the problem "you can’t develop a mobile app and connect it to your tRPC backend on a separate repo, everything need to be on the same repo"?
My reaction on your cons:
- Server actions have their own specific pro's and cons. To be fair you are comparing clientside data fetching with serverside data fetching. Regardless of tRPC, these are 2 different concepts. Would you for example make a project without client-side state and solely rely on serverside state? I think not.
- Why would you want to do that, when uploading you would request an upload URL from your upload service that handles that. tRPC can perfectly handle that.
- That is the purpose of using tRPC or any backend for frontend pattern. You want tightly coupled backend and frontends. Your real backend would be for example a nodejs express server, not your tRPC server
- Again your Backend for Frontend should ALWAYS be in the same repo as your frontend. This is a tightly coupled setup
- Queues and jobs are to be used with your nodeJs backend that has the trpc adapter on it. So your setup could for example be React FE, NodeJs Express BFF + tRPC
- Everything is changing fast but the concepts and foundation will always remain the same. Know your history, MVC has been here for a long time. The BFF pattern is a proven strategy. I don't see that changing soon.
Here's some alternatives to tRPC (33k) supporting end-to-end type safety (with current GitHub stars):
- ts-rest (2k)
- Zodios (1.6k)
- Hono (16k)
- ElysiaJS (8.5k)
ts-rest and Zodios seem too new and far from mature. ElysiaJS is focusing only on Bun. Hono looks the most interesting to me.
Half the points are invalid as there’s trpc-openapi you can use to generate openapi spec or export the types as package
You never loose low level router control, you can always make an upload endpoint
A t3 tutorial by the man himself would be great!
Alex?
I would love an actual full t3 tutorial instead. Like dig deep on everything. It's probably already there and I'm not aware.
It's on it's way!
Uploaded 7 hours ago lol. Theo probably saw your comment!
Unsolicited feedback.
Theo, you seem like a genuine person and your take on certain libraries convinced me to give them a try, and some of them even have turned out to be a good match for me. Personally I enjoy your way of presentation. Yet clickbaity titles like this one, where you are playing with emotions, giving in a little bit to javascript fatigue, while video is basically "everything's good and even better" is off-putting and contradictory to who you seem to present to be - a person trying to find a right balance within a sea of options. I understand "stand out or die" problem in online space, yet even though I'm interested what you have to say I will be ignoring your youtube or twitch channel because I have no way of discerning between content that provide value to my life and ones that do not. But maybe it's what gave you prominence here and reason why I heard about you in the first place even though it was through a friend.
Not only is it clickbait, it is straight up confusing. I am here half-way through the video wondering if I am totally misunderstanding something in the message, or if the title itself was a sarcastic piece of clickbait. Like really? These 5 minutes (+ the 10 minutes of getting distracted from this video bc I couldn't understand) could have been spent on another video that actually taught me something useful. At this point I just wasted 15 minutes on a video and learned 0 things about what TRPC even is. So yeah, I watched a 5 minute video about a thing and when the video ended, I still do not know a thing about it. Eh.
stop whining
t3 stack tutorial is so much needed i watched the roundest vod but it was a bit chaotic 😅
Check out the docs :)
Amazing timing, needed a video like this to pitch using trpc to the company I am working for
Your boss might give you a raise
I'd happily watch and follow along a T3 course if you made one, even though I don't need this tech for the app I'm building.
Well you should be hyped for what's coming
I support that. Would totally buy it. Just don't make it prohibitively expensive.
@@ChristofFritz I will never charge for education materials that could help a developer get a job.
Will be up on the channel by next week at latest. Ideally by Friday. 3 hours long.
I worked my ass off for this.
I went from graphql to tRPC and I'm never looking back. Theo isn't lying when he's saying developer experience has never been better
@@t3dotgg HOLY SHIT. I really can't wait now. Thanks ALOT!
Theo and TRPC - better love story than twilight
Would be great for a tutorial or course from you, I'm sure the quality would be great
It's on it's way! for the t3 stack
Is tRPC still good though if the front end and back end teams are separate? And if not, then does that mean that you're able to get away with tRPC at Ping because the front end and back end teams are combined?
You can still use tRPC at the BFF layer. Often when using REST APIs you end up making a ton of requests on the browser. Instead you can make those requests in the BFF, then expose frontend-specific APIs that fit your needs on the frontend.
While it doesn't free up the maintenance of types from the backend -> BFF, it does free up the types from BFF -> frontend as well as improving the UX by doing less requests in the browser.
@ui_wizard BFFs are plain evil
@@snehanshuphukon728 Elaborate please.
What the heck Theo, crazy timing again 😂😂😂
I should really go to bed
Bad news - I posted a vid on the 2nd channel as well 🤣
Was able to end up watching the video. Just want to say thanks for all of the hard work you put in here! Your videos inspire me to getting around and making some of my own too. I haven't made any dev videos yet before.
in typescript its trivial to write a typesafe RPC
important bits are underlying infrastructure
I'm the like button for : Full t3 tutorial that digs deep on everything
How does trpc hold up with RSC? It wasn’t very obvious to me when reading the docs.
I would like to see a video outlining the best practices / methodology behind using hooks for API calls (useQuery / useMutation). Coming from single API call land, I am having to ease myself into this new pattern and would like to use it but fear doing so without some sort of background into the most effective usage will result in losing a lot of the benefits I'd imagine come with such patterns. I watched the "Data Fetching in React with Remix" video and it touches upon these but I think something with more focus on the specifics of trpc would be great and in line with the area that you place yourself bridging new developers with advanced concepts.
Thanks, Theo for all of the hard work. I have been struggling to decide on my project. I have been watching you and I like trpc. So, now I’m having hard time in choosing my tech stack. I think atm I have two choices I.e trpc with nextjs or rust with nextjs. What would you recommend?
Give us that trpc tutorial, don't hold out on us man!
I would like to see a video outlining the best practices
Will your t3 tutorial that you are preparing be using next-auth or clerk for handling the auth layer?
I wonder if you have a CMS recommendation to go with T3.
My guess is that payloadcms would be a great way to establish CMS in your app. You can give it a look and check if it meets your needs :)
please show how to deal with n+1 problems that we would solve with dataloader in graphql
what also would be great is how to work with tRPC in a team.
For example if you have a pure frontend and backend team and what the best practices are if you want to split tRPC in two different servers, one just for frontend and one just for backend.
yep, we might need that trpc tutorial chief
You didn’t talked about server actions vs tRPC
trpc doesn't solve a problem, if I'm not mistaken: Type safety with external API.
What about ConnectRPC? The newer solution from the Buf team?
Even though you took down the video, I really appreciated the Twitch video! It's great to have a content creator who is genuine
It’s still up - on my other channel
It's on Theo Rants
I am but a fool
This sounds great overall, but as a big trpc/NextJS noob:
I see in T3 stack that trpc's api client is using `ssr: false`. How is this current implementation ever running the queries server-side? Would love an explanation on that.
SSR = React code is run on server every request
API = some data is requested from a server
TRPC is using Next APIs, not SSR. tRPC SSR = “Every page is rendered and all the data it’s fetched on the server on every page request”
I've been using ct3 app in a side project and its rly cool. I want to ask u guys how ct3 app match with other paradigms in order to scale an app like: Event-driven design, CQRS, DDD, repository pattern, etc.
trpc looks too verbose for adding routes, inputd, mutations, etc. Is there an alternative using decorators?
i have been enjoying trpc since i picked up t3 app. i would love if you could make a tutorial vid for t3 app and your approach to how you build pages and components and all
Add Configuration for testing t3 stack
I am facing difficulties in testing , due to env . vitest and jest are throwing errors
We currently use GraphQL, have some deeply nested relationships, and use partial loading which works well, but this only works because we can write one resolver with two different GQL documents that query different amounts of data from said resolver. Is something like this possible with tRPC?
Refactor time aside, this is one of the major things holding us back from migrating.
Yes and no. GraphQL's resolvers are powerful when you have distributed endpoints, because those resolvers are handled at field level. That said, tRPC can still be used with a Dataloader, just like you'd do with queries that results in N+1 problems.
If you define your procedures based on the needs of the components that consume them, you can resolve the dependencies in those procedures and just respond with the structure as the frontend needs it.
Is there any reason to migrate away from GraphQL? How large is your project and how many services do you have? Do you use federation?
@@dealloc It's less about GraphQL as a whole and more to do with TypeORM/TypeGraphQL. Inherited a codebase that's riddled with performance issues and hacky workarounds that we've only been able to nail down to existing issues or quirks with either library.
Something like tRPC is just one of the options we've considered since we migrated to a monorepo, just weighing up options really.
Sitting at around 120 queries/mutations and a couple subscriptions in a single monolith right now.
We need a replacement for Prisma!!!! Prisma cant handle larger projects. T3 really has been a game changer.
"I can return something on my backend, and then call it on my frontend, and there is no bullsh*t between those things."
As someone who has run into issues with developers not paying attention and sending misshapen data from a JavaScript frontend to a Scala backend (and vice versa), I feel this.
React server components are here because people wouldn't use relay which has a ton of benefits , i wouldn't use tRPC for a small project because it's just abunch of unnecessary overhead for APIs that won't change that much , and for ab bigger project GraphQl is still king and has better performance and features
Theo is for Trpc what Primeagen is for Rust
+1 for T3 tutorial
Yes
Relay pretty coo, had this shit years ago
Your useBackend thing is just like $server in solidStart
Have you used Tinybird before?
A tutorial would be fantastic.
Being interested in full-stack rust solutions, it seems like rust could potentially do this at least as well as typescript. Without trying to copy the interface of trpc exactly, attributes, gereric, macros and or custom derive macros seem like they provide more than the necessary power to do "validation first" typing. I'm an absolute beginner with rust but as someone who used to be so into the black magic of C++ template metaprogramming, I have a clue how rust might represent these things at the type level.
What about tRPC vs gRPC ?
Idk if you’re trying to trigger me but pls check my channel for my gRPC vid if you’re serious here
We need your tutorial!
Please make that T3 tutorial!
do I need it if I’m using remix framework,
vue support?
How to use T3 with jwt and OAuth2?
+1 for a tutorial. Please have auth as part of it.
Fetch API all the way
does stil GOD?
so the answer is yes? you still need it?
make the tutorial, ITS NOT UP FOR DEBATE
Sounds like an abstraction over an abstraction over another abstraction...
nope, RTFM!
Look into it. You'll thank us later.
If you hate abstractions so much, why don't you write some assembly code for web dev. Heck, why not go for the transistors directly lol.
No dude. Write a few lines with it
Well that's literally computer science, we just use tons of layers of indirection :D
gRPC vs tRPC?
Please no
Who wants to use Prisma. Massive overhead for very little of value. I understands it avoids the dialects: but prisma does not work with Mango anyway. May be Zod by I don't know... Still too much overhead.
clickbait title
do I need it if I’m using remix framework,