ChrisEvans
ChrisEvans
TTCTheo's Typesafe Cult
Created by ChrisEvans on 2/12/2025 in #questions
What's the difference between the `api` exported from react.tsx and the `api` from server.ts?
I'm using Next, tRPC, & prisma. In the boilerplate, there's two api objects. One is created with createTRPCReact, and the other created with createHydrationHelpers. What's the difference in what they do? In the examples on StackBlitz there's only one, and it's created with createTRPCNext: https://stackblitz.com/run?file=example-app%2Fsrc%2Fpages%2Findex.tsx,example-app%2Fsrc%2Futils%2Fapi.ts
9 replies
TTCTheo's Typesafe Cult
Created by ChrisEvans on 2/6/2025 in #questions
Is it possible to see cache hit/skip in the terminal when using Next with tRPC in the t3 template?
There's a feature in Next where you are shown whether your API calls were sent to the server or whether they used the cached data: https://nextjs.org/docs/app/api-reference/config/next-config-js/logging. You usually get a little { cache: HIT } for example next to your API call in the terminal. However, those docs mention that this only works out of the box with fetch. Does anyone know if there's a way to set this up with tRPC?
2 replies
TTCTheo's Typesafe Cult
Created by ChrisEvans on 1/30/2025 in #questions
Do you really need an ORM?
I'm designing a Next app with a postgres DB in supabase, and want to use tRPC so I have some methods I can share to other apps I might make in future (using React Native or something). I've got the db defined in supabase - there's a bunch of tools that make that super easy - then I can use supabase typegen to make the requisite types. Then I can create tRPC methods using those types. So what's the use in an ORM like prisma or drizzle? What is it adding?
12 replies