tRPC

T

tRPC

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

Join

test post 2

hello again
Solution:
solution

query debounce

Hey there ! I wonder if anyone could point me to a standard recipe to achieve query debouncing and caching using trpc and useQuery in react. I'm basically firing an api call everytime the user change his input which start to be quite a lot when he keep the "delete" key pressed on the keyboard....

Type of createServerSideHelpers?

I'm currently trying to implement a helper for getServerSideProps to reduce duplication. It's still wip, but I'm encountering a problem I can't figure out: ```typescript export async function createServerSideProps( ctx: GetServerSidePropsContext,...

how to set request timeout in client

createProxyClient has no option about timeout like axios does. Just in one router request (query or mutate) use AbortController.But I do not want each router request to add this signal.It is boring.Any solutions?...

trpc rate limiting

hi I am currently having some problems with a race condition in my TRPC nextJS api. Essentially what is happening is I have a enforceGuildPermissions method, which basically checks if the user who is making the request has permission to get the data for that guild....

trpc pipe middleware

Hey all. I'm currently trying to create a middle ware on endpoints using the new pipe API. This is on a specific route which is formatted like:...

Has anyone ever used tRPC (with SSR) and i18n?

No matter the lib (next-intl, next-i18n, next-translate), I simply stumble from one problem to another - most of them simply solved by disabling SSR. Unfortunately, I need SSR and i18n. I know the GitHub issue that the problem here is on next.js, but anyone ever solved this? Hard to believe no one has ever used tRPC with i18n

New to tRPC and Need Help with Basics

I made a new T3 app, but I don't quite understand how tRPC works, and I would love to get some help and insight in this. If you could get on a call with me on Discord, I would appreciate that more because then I could share my screen and get more help and information out of the conversation. Let me know if you're available.

web socket keeps on disconnecting and connecting

Hi! Its my first time using web sockets. The first code snippet is my socket code. The second code snippet is where I create context to use in the applyWSSHandler. My issue is that in my createContext function. When I try to use the getUser function, the socket keeps on connecting and disconnecting rapidly (like every few milliseconds). But the moment I remove that function, everything works fine. Any idea what could be issue? The create context has no issue without running the socket. Thank you! ```js import { createContext } from "./context";...

Pagination Query

Hi, I'm new for web dev and I'm moved to tRPC not so long I'm looking for example of pagination query like blitzjs (input: page, limit and sort) https://blitzjs.com/docs/use-paginated-query#arguments ...

Enrich the response object for TRPC endpoint

Currently when I hit a trpc endpoint I get something like: ```typescript { result: {...

Can i fetch tRPC in different project

@coco- : I Make a tRPC in my project. Can I use the enpoint api in different project ?

Importing AppRouter types from an external repo

I've got a production T3 app already in production. I've created a fresh expo app to start building our app. Before turning this into one big monorepo I just want to test it both independently so the server code is in a different repo. Might be a dumb question but how can I import the AppRouter type into my expo app? import { type AppRouter } from "<external repo location>";...

TypeScript type for request object for route handlers

So far I've been writing my routes like: ```typescript export const router = t.router({ helloWorld: t.procedure.query(async (req) => "Hello World"),...

Typed wrappers for procedures

I have a TRPC client with working queries and mutations. I wanted to create wrapper functions for all the procedure so that instead of trpc.someQuery.query(...) I can use someQuery(...), and instead of trpc.someMutation.mutate(...), someMutation(...). I'm having trouble with getting the wrapped functions to have correct parameter and return types. Currently I have: ``` function wrap<F extends ((...args: any[]) => any)>(fnWithClient: (c: typeof client) => F): (...args: Parameters<F>) => ReturnType<F> { return (...args: Parameters<F>) => fnWithClient(getClient())(...args); }...

Are TRPC server procedures actual endpoints? Meaning can you directly do a `post` request to them?

Lets say you have a public procedure called getHelloWorld, can you hit it by doing localhost:3000/trpc/baseRouter/getHelloWorld? or something

TRPCClientError - No "query"-procedure on path "user.all"

Im using react native expo, prisma, trpc and the postgres database is on railway I have run the following commands: npx prisma generate and pnpm db-push so its up to date. ...

Am I the only one struggling with pnpm + TypeScript monorepo + trpc?

Hello all, When using pnpm in a TypeScript monorepo without node-linker, I hit those errors: ```...

tRPC standalone server in monorepo

Hi, I'm using t3-stack monorepo as my base and I've swapped out NextJS backend for standalone HTTP server but I just can't get it work Discord wouldn't let me post the code as it was too long so I've uploaded the api.ts and client.ts along with the error to gist https://gist.github.com/neo773/7c8a314785d5e4f54c724cde7e5fa65c...

Codemod to v10 is not modifying any file

Hello 👋, I must be super dumb but running pnpm dlx trpc-v10-migrate-codemod in my project isn't applying any change. I see all the files listed as "migrated" but nothing is saved on disk?...