Scaling tRPC
I’ve been seeing issues regarding tRPC routers and performance issues as routers grow.
I’m wondering if there is any documentation on this and how to avoid them if possible?
3 Replies
What sort of performance issues? Editor? Runtime?
The biggest runtime drag in my experience is the stuff you put in ctx
You can using middlewares and Context Merging to add dependencies more a la carte instead of a giant bag of dependencies via createContext
Editor is what I’ve seen. My worry is that using next.js and typescript alone without tRPC is sort of a slower experience, that using tRPC with >100 routes with various zod inputs, etc, will cause slow downs in editor.
I’m assuming runtime performance is fine.
My experience is using a lot of Zod types has given me problems. It's something I'm actively looking into at work
Most projects won't have an issue though, I have a very specific setup