tRPC

T

tRPC

Move Fast & Break Nothing. End-to-end typesafe APIs made easy.

Join

Help understanding how to deploy tRPC in monorepo.

Hi All, I read in the FAQ that most benefits come from using tRPC in a monorepo. So if i want to build an app, that for example used tRPC with Fastify and a nextJS frontend. How exactly would this be deployed? Would it still work as expected if deploying the client and server separately to different ec2 instances for example. Am i right in thinking that the benefit comes with the type safety during development so how its deployed does not really matter?...

best way to delete trpc?

I want to delete TRPC from a Nextjs project. What is the most appropiate way to take it out? Thanks

Query string params

Hi , new to tRPC, is there a way to send query string params with tRPC when making a request ?

Error running dist/client/index.js

Got this error during node dist/client/index.js I have ran tsc -b also followed as same as in docs...
No description

TRPC, Cookies, fetch

I try to cakl my backend inside trpc procedures and I an using fetch for this. Is it possible so that trpc passes any headers to fetch?

`The property 'query' in your router collides with a built-in method`

I'm seeing an error (attached) where I can get autocompletes on TRPC in the file where the client is defined, but not anywhere I import it in. ``` // client.ts import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";...
Solution:
I was reexporting my type signatures in a barrel file. Importing directly fixed the issue.
No description

Using trpc backend across multiple seperate front ends

I want to create a nodejs backend with trpc to expose some api endpoints. This will then be called across multiple different frontend react apps. How do I ensure type safety if they are in different repos?...

Page couldn't be rendered statically because it used `cookies`

Has anyone had this issue? I'm using trpc in a server component and in localhost it works fine but it won't work when deployed toVercel. Any help will be appreciated...
No description

Comparing tRPC and Server Actions for a SaaS Template: Seeking Insights and Advice

Hey everyone 👋, I've just posted a detailed comparison and discussion request on Reddit about tRPC vs. Server Actions in the context of a SaaS template using Next.js. My current setup uses tRPC with its experimental feature for server actions, and I'm considering a switch due to the community's lean towards server actions. Main points I'm pondering:...

setting up trpc in next 14

Pleaase I need help on how to integrate trpc in next js 14, please help me

Have anyone tried migration from TRPC router to app router api

I was learning the trpc and I wanna know to go back and forth with trpc and restapi. can anyone know how to migrate from trpc to app router api route

Has anyone integrated trpc + udp (quic/webtransport api)?

Hi all, I'm thinking about taking advantage of quic for a certain part of my project. Basically I'm trying to capture user movement in 3d space, and I think udp might be a bit better to work with. Has anyone seen a trpc-link out there trying to do this? Has anyone experimented with this?

onSuccess invalidate

I'm trying to follow along with Theo's T3 tutorial using the latest Next version and the app router. The "setInput("")" and the invalidation don't seem to be working inside of onSuccess, the console.log is being called, what am I missing? Is this supposed to work? ```ts "use client"; ...

React Query client and caller client under one object

Would love to know if it is possible to have caller and react query clients under one object? I feel like it would be great to go api.cart.getCartItems() in server components that would utilise caller and api.card.getCartItems.useQuery() in client components....

I want to refetch and set the inital data of an useState

Hello guys, currently i am retrieving the data i use in useState with SSR, but i want to use somethinng that makes it possible to update the useState on interactions from the user. Im guessing I should use useQuery?
How can i set it so initialData in my useState works. this is my current useState line: ```tsx...

Vanilla Client Error Handling

What is the right way to handle errors when using the vanilla client? If I setup a client like so: ``` import type { Router } from '../../../server/src/routers'...
Solution:
There is actually a docs page on this, does that answer the question? https://trpc.io/docs/client/vanilla/infer-types#infer-trpcclienterror-types

sidebar search

Please how will I implement a search on the left sidebar to let the items on the search bar be searchable
No description

WS with TRPC

```ts │ îȘ‡ Type '({ req, res, }: { req: Request; res: Response; }) => CreateInnerContextOpts' is not assignable to type 'NodeHTTPCreateContextFn<CreateRouterInner<RootConfig<{ ctx: CreateInnerContextOpts; meta: object; errorShape: { data: { zodError: typeToFlattenedError<any, string> | null; code: "PARSE_ERROR" | ... 13 more ... | "CLIENT_CLOSED_REQUEST"; httpStatus: number; path?: string | undefined; stack?: string | undefined; }; me...'. typescript (2322) [12, 3] │ Types of parameters '__0' and 'opts' are incompatible. │ Type 'NodeHTTPCreateContextFnOptions<IncomingMessage, WebSocket>' is not assignable to type '{ req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>; res: Response<any, Record<string, any>>; }'. │ Types of property 'req' are incompatible. ...