Software Development

Is GraphQL losing its edge to TRPC and App Router in 2024?

ER Asked by Eric Sullivan · 12-02-2024
0 upvotes 10,570 views 0 comments
The question

For a new Fullstack TypeScript project, I'm torn between the traditional GraphQL/Apollo setup and the newer TRPC approach with Next.js App Router. GraphQL feels like overkill for a single-client app, but I worry about scalability. What are you seeing in the industry for mid-sized enterprise apps this year? 

3 answers

0
AN
Answered on 18-02-2024

If you are building a "Mono-repo" where the frontend and backend share the same TypeScript codebase, TRPC is a dream for developer experience. The "type safety" without code generation is incredibly productive. However, the moment you need to expose your API to third-party developers or multiple mobile apps, GraphQL wins hands down. We used TRPC for our internal admin dashboard but stuck with GraphQL for our public-facing marketplace. It’s not about one losing to the other; it’s about choosing the right tool for the consumer of the API. 

0
KE
Answered on 25-02-2024

Does TRPC handle complex relational nesting as easily as a GraphQL fragment, or do you find yourself over-fetching data more often? 

TH 02-03-2024

Kevin, TRPC doesn't have the "selection set" logic that GraphQL has, so you do have to be more intentional with your procedures to avoid over-fetching. We solve this by creating specific "View Models" for different UI components. It requires more backend work than a generic GraphQL query, but the trade-off is zero runtime overhead and a much smaller bundle size. For most mid-sized apps, that speed is worth the extra procedure definition.

0
RE
Answered on 05-03-2024

We stuck with GraphQL because our data comes from five different microservices. Aggregating those in TRPC would have been a nightmare compared to Apollo Federation. 

ER 08-03-2024

Exactly, Rebecca. For distributed systems, GraphQL acts as the perfect gateway. TRPC is amazing for "BFF" (Backend for Frontend) patterns but struggles in a fragmented microservices world.

Share your thoughts

Your email address will not be published. Required fields are marked (*)

Professional Counselling Session

Still have questions?
Schedule a free counselling session

Our experts are ready to help you with any questions about courses, admissions, or career paths. Get personalized guidance from industry professionals.

Request a Call Back

Search Online

We Accept

We Accept

Follow Us

"PMI®", "PMBOK®", "PMP®", "CAPM®" and "PMI-ACP®" are registered marks of the Project Management Institute, Inc. | "CSM", "CST" are Registered Trade Marks of The Scrum Alliance, USA. | COBIT® is a trademark of ISACA® registered in the United States and other countries.

Book Free Session