tRPC

T

tRPC

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

Join

NextJS & Keystone CMS, issues when connecting both in a monorepo

Hello everyone, so I have a monorepo with NextJS and keystone cms, both are running trpc v10beta.15. Screenshot 1: I receive a type error when trying to use the CmsAppRouter type in my NextJS when calling createTRPCProxyClient....

Best practices for implementing an offline application

Hey there! I'm building a full stack react-native app with Expo and a tRPC backend. I'd like for this app to be functional offline. Currently I'm accomplishing this via a simple optimistic update like: ``` const createUser = trpc.userCreate.useMutation({ onMutate: async () => {...

somehow when move typed function out of the router files, frontend infer type to be any ?

this is inferred corrected since they are in the same file. ``` getX: t.procedure.query(() => { return getX() }) ...

Big companies that use tRPC?

Some of my fellow colleagues were wondering if there are any big companies that use tRPC and how mature you would say it is for production in "real" projects?

SSG on nextJS when appRouter is made with fastify adapter?

```js export const getStaticProps: GetStaticProps = async () => { const ssg = await createSSGHelpers({ router: appRouter //This app router is in fastify ctx: await createContext(),...

Migrating to V10 from V9

If someone has some ideas on what I might have screwed up when trying to bump tRPC for this public starter please let me know. https://github.com/chamatt/create-kaol-app/pull/7/files...

Authentication broke after bump to v10 from v9

Anyone that has any suggestions on what might have caused this? I get the following error when trying to sign in or sign up.: ``` "Cannot use 'in' operator to search for 'auth.signUp' in undefined"...

Show a spinner when any mutation is loading?

Looking to show an activity spinner in the header of our application whenever a mutation is in flight (Hoping this will be easier than showing it in every conceivable place to say that your request is loading). There might be a few ways to do this, but any recommendations for minimal boilerplate?...

Sharing schemas between server and client

In a typical nextJs setup, what is the idiomatic way to share zod schemas between frontend and backend? Suppose the following use-case: we have a mutation that takes an input: ...

v10 Migration interop, router doesnt have attributes

Hi, i've tried to migrate like stated in the docs, these are my routers. Question: Shouldn't appRouter now have access to the merged routers above?

Recommended file structure for next.js?

Hey all - using tRPC heavily with next.js and it's great. Our main [trpc].ts file is getting huge and unwieldily - wondering what the recommendations are out there for organizing?

Unhandled Runtime ErrorTRPCClientError

Call Stack Function.from node_modules@trpc\client\dist\TRPCClientError-09b8a26b.esm.js (57:0) transformRPCResponse node_modules@trpc\client\dist\httpRequest-62c5cce4.esm.js (15:11)...

Weird error when running unit test

10.0.0-proxy-beta.5 works just fine, error occurs on 10.0.0-proxy-beta.6 with the introduction of @swc/helpers.

Sharing middleware between TRPC servers

We currently have microservices REST API's on Cloudflare Workers and I'm thinking about moving this to TRPC Microservices. We currently have a middleware in a shared package that we can reuse between microservices for authentication, how do I do this within TRPC? How do I define a MiddlewareFunction that can be reused between multiple TRPC instances?...

Is `trpc.withTRPC` for Next supposed to work with pages or only `_app`?

I'd love to only have TRPC mount on certain pages of my Next.js app. Is this currently supported?

TRPClientError

The operation has been aborted at Function. This is the file with the error. The current file is here: https://github.com/makyfj/GymPal/blob/main/src/pages/workout/%5Bid%5D.tsx...

What does the WebSocketHandler do?

I'm not sure what this is doing on the background.

Are there any example of subscriptions working with react native ?

queries and mutations are working pretty well with react native, I'm unable however to get subscriptions to work.

Recommended way to prefetch client-side

In react-query, you can do
queryClient.prefetchQuery(['todos', input], queryFn)
queryClient.prefetchQuery(['todos', input], queryFn)
...