When not to use tRPC?
If I'm building a mobile and/or a web app with React Native / NextJS (TS), is there any scenario you would advise people not to use tRPC? (We can assume all the clients are in the same repo as the server)
Are there any current limitations or cons of tRPC that people should be aware of?
35 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Okey as a condition we can add this.
When not to use tRPC when I have all the clients in the same repository? 🙂
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Which of the different adapters would you both recommend for tRPC btw?
I was considering Fastify for when it's only going to be mobile clients (or even web but high backend complexity) and NextJS when there will be web or web + mobile with (lower backend complexity)
Does this seem reasonable? @Amirko28 @git commit -m "changes" +250k -3
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Yeah I'm not saying there will be two implementations for one project.
I'm saying that based on what I'll be developing it wold either use NextJS or it would use Fastify.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I don't have much experience with any of this but using NextJS for the BE won't make much sense if there's not a web client right?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Yeah I'm not saying it's not good.
I'm saying if you are developing a mobile app does it really make sense to build the backend with NextJS?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
React Native results in native mobile apps.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
You can't use Nextjs for developing the mobile app client.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Nowadays it's rather Kotlin for Android if you're developing separate apps
But if I can code for iOS, Android and Web with one code base and use React Native for all UI and have like 60-90% code sharing between web / mobile with good performance I don't really see a good reason to build separate apps for web / iOS / Android
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Curious what you are building @wezter96
Right now I'm working on two different apps but this is not really for those but for future projects that will be web / mobile / both 🙂
How do you decide if you need both mobile and web? I was like you a few months ago and doing a lot of research for the "ultimate universal stack" and in the end I said fuck it and just started building with Next.js + tRPC + Chakra 😛
but then you're building web only I'm guessing?
If a client wants their project to be accessible both as an app and through web.
This is where I'm at right now.
Yeah just web cus it's just my personal stuff and don't think my users will necessarily want a mobile app
I am waiting for Tamagui to become stable and veering away of the idea that Solito is smart
What is it that you don't like about Solito?
I just feel like it seems simple to share screens across web and mobile but in the end it was a pain in the arse for me and it was easier to just create them separately 🤷♂️ maybe I am just doing it wrong
I've only tried with like three screens so far but for those it was pretty smooth.
And if you're gonna build a responsive website anyway then it's not that big of a step to make it work through mobile app as well it feels like.
Are you building this for personal use or client?
If client and server are both 1. Owned by same team and 2. Using TS, it’s really hard to justify NOT using tRPC
Other solutions are less a question of “what’s bad about tRPC”, more questions of organization structure
Same team = monorepo right?
Monorepo or monolith
Doesn’t matter too much as long as one group of people owns it
Mainly thinking about it for projects for future clients right now.
Ah thanks a lot for the input!
Would you say that if there's high backend complexity (or if I don't have any web client) for the project then building a tRPC server with the fastify adapter would be preferred and if I have web clients and lower backend complexity then using it with Nextjs would be preferred?
Also wondering what you do to keep the backend scaleable with Nextjs?
What do you have to replace load balancers and such so you can handle a lot of traffic.
Is it possible to have multiple different web clients go towards the same Nextjs "server"?
Start with the simplest thing and make changes when you run into problems. Next is usually that thing. Scale is not a problem in serverless. Anything can query anything if "anything" has a URL associated
Okey and how do I add access for the server for my NextJS backend to additional web / mobile clients? (I guess that would be handled my authentication provider and my server would just validate my tokens?)
I think in an organisation there's a lot of other reasons, but you'll know what they are at that point
Is it possible for client that aren't in the same repo to connect to a tRPC backend?
To connect? Absolutely. To be a good dev experience? Questionable