Ahmed Elsakaan
Ahmed Elsakaan
TtRPC
Created by Teesh on 11/7/2024 in #❓-help
What is tRPC, when and where should I use it?
So case scenario for example: You have a react web app, a mobile app and a desktop app lets say. You want your server in typescript, then trpc would be a perfect fit because you don't need to go through the traditional openapi specs + generating types on these frontends
10 replies
TtRPC
Created by Teesh on 11/7/2024 in #❓-help
What is tRPC, when and where should I use it?
If you're only going to have one app for example nextjs, then probably server actions will do you just fine. tRPC is beneficial when you want a dedicated API that you have multiple consumers of like a react app and a react native app for example. Basically trpc is just a rest API framework just benefit is that you don't need to generate types on the frontend to consume the API endpoints and it integrates with things like react query really easily
10 replies
TtRPC
Created by Teesh on 11/7/2024 in #❓-help
What is tRPC, when and where should I use it?
10 replies
TtRPC
Created by Deepak Sharma on 8/13/2024 in #❓-help
Nested tRPC procedures.
the one I would give is, start with one router until it feels complex enough to need to split/nest it
16 replies
TtRPC
Created by Deepak Sharma on 8/13/2024 in #❓-help
Nested tRPC procedures.
no worries
16 replies
TtRPC
Created by Deepak Sharma on 8/13/2024 in #❓-help
Nested tRPC procedures.
yeah
16 replies
TtRPC
Created by Deepak Sharma on 8/13/2024 in #❓-help
Nested tRPC procedures.
also with trpc, there is no one set guideline, organise it the way you like basically 😅
16 replies
TtRPC
Created by Deepak Sharma on 8/13/2024 in #❓-help
Nested tRPC procedures.
there is no reason for the nesting here because you only have one procedure inside the nested routers
16 replies
TtRPC
Created by Deepak Sharma on 8/13/2024 in #❓-help
Nested tRPC procedures.
trpc.products.discount?
16 replies
TtRPC
Created by saloodpeepo on 5/24/2024 in #❓-help
trpc query help
Is the data fetching of the list of posts happening on the client side or the server side?
3 replies
TtRPC
Created by bill92 on 5/24/2024 in #❓-help
conditional useQuery without input
a query is enabled by default, so you don't need enabled: true
6 replies
TtRPC
Created by joseph on 12/31/2023 in #❓-help
TRPC & Zod Logging
I think you can do that in the errorFormatter method on the initTRPC.create function call, like so:
const t = initTRPC.context<Context>().create({
transformer: SuperJSON,
errorFormatter(opts) {
const { shape, error } = opts;

// log error
console.log(error);

return {
...shape,
data: {
...shape.data,
zodError:
error.code === 'BAD_REQUEST' && error.cause instanceof ZodError
? error.cause.flatten()
: null,
},
};
},
});
const t = initTRPC.context<Context>().create({
transformer: SuperJSON,
errorFormatter(opts) {
const { shape, error } = opts;

// log error
console.log(error);

return {
...shape,
data: {
...shape.data,
zodError:
error.code === 'BAD_REQUEST' && error.cause instanceof ZodError
? error.cause.flatten()
: null,
},
};
},
});
4 replies
TtRPC
Created by Zion on 12/29/2023 in #❓-help
tRPC and vite serverless, are there any exmaples?
apparently vite has a vercel plugin that allows you to do api endpoints like next.js
21 replies
TtRPC
Created by Zion on 12/29/2023 in #❓-help
tRPC and vite serverless, are there any exmaples?
21 replies
TtRPC
Created by Zion on 12/29/2023 in #❓-help
tRPC and vite serverless, are there any exmaples?
@julius 😜
21 replies
TtRPC
Created by Zion on 12/29/2023 in #❓-help
tRPC and vite serverless, are there any exmaples?
if it uses normal request/response you can hook up the trpc fetch adapter to it
21 replies
TtRPC
Created by Zion on 12/29/2023 in #❓-help
tRPC and vite serverless, are there any exmaples?
vite by default isn't a full stack type of tool, so it can't be compared with nextjs fully. What I would recommend if you're going with that route is to just have tRPC as it's own server using the standalone adapter and seeing if that works for you, you can use other adapters like fastify for example if you need something more than that.
21 replies
TtRPC
Created by taylor.presto on 11/18/2023 in #❓-help
I am getting a errors after starting a TRPC project with T3. "Unsafe return of an `any` typed value"
you didn’t use ctx at all
13 replies
TtRPC
Created by taylor.presto on 11/18/2023 in #❓-help
I am getting a errors after starting a TRPC project with T3. "Unsafe return of an `any` typed value"
its ctx.db not just db
13 replies
TtRPC
Created by CodingWithJamal on 10/26/2023 in #❓-help
Disable trpc route cahce?
app router master
9 replies