REST APIs vs GraphQL or tRPC – The New Kid on the Block?

Sujay P VSujay P V
4 min read

In the world of full-stack development, one of the most common questions developers ask is:

"How should my frontend and backend talk to each other?"

For a long time, the answer was simple — REST APIs. Then came GraphQL, promising flexibility. And now, a new challenger is rising: tRPC, tailor-made for TypeScript lovers.

Let’s break down what each of these brings to the table — using simple explanations, real-world comparisons, and just a bit of tech flavor.


REST APIs – The Classic Workhorse

REST (Representational State Transfer) is the traditional way to connect the frontend and backend. Think of it like a menu in a restaurant — each dish (or API endpoint) has a name, and you request exactly what's written.

Example:

  • GET /users/123 → Get the user with ID 123

  • POST /create-user → Create a new user

  • DELETE /user/123 → Delete user 123

Why people still like REST:

  • It’s been around forever, so it’s well-understood

  • Works with any language or platform

  • Easy to get started, especially for simple apps

But there are downsides:

  • You often get either too much or too little data

  • You need to create separate endpoints for every action

  • Managing lots of endpoints can get messy in large projects


GraphQL – The Flexible Powerhouse

GraphQL was built by Facebook to solve some of REST’s limitations. Instead of hitting multiple endpoints and getting whatever the server gives you, GraphQL lets the client ask for exactly what it needs.

If REST is like ordering from a fixed restaurant menu, GraphQL is more like a buffet — you go and pick exactly what you want.

Here’s an example of a query:

query {
  user(id: "123") {
    username
    profilePicture
    posts {
      title
    }
  }
}

You can fetch deeply nested data in one go, without making multiple requests.

  • One endpoint handles all your data needs

  • You control the shape of the response

  • Strongly typed schema with built-in documentation

  • Amazing tooling (GraphiQL, Apollo, etc.)

  • Real-time support through subscriptions

What to consider:

  • Setup is more involved, especially for small apps

  • Caching is not as straightforward as REST

  • You have to define types, resolvers, and schemas manually

tRPC – The New Kid Built for TypeScript

tRPC (unofficially typescript Remote Procedure Call) is the latest addition to the full-stack communication world, released in 2021.
Conceptually inspired from gRPC, it's built specifically for full-stack TypeScript apps, and it allows you to call backend functions directly from the frontend — with complete type safety.

Imagine skipping the whole API setup altogether — no REST paths, no GraphQL schemas, no type duplication.
Just write your backend function and call it from the client like it’s already there.

const user = await trpc.user.getById.query({ id: "123" });

If REST is like ordering food through waiters, and GraphQL is a buffet where you serve yourself,
then tRPC is like cooking in your own kitchen — fast, direct, and exactly how you want it.

Why tRPC is gaining attention:

  • Zero boilerplate — no need to define routes, schemas, or types separately

  • Full type safety across client and server

  • Great developer experience if you're using Next.js or similar setups

  • Perfect for monorepos or teams fully invested in TypeScript

Where it might not be ideal:

  • It’s TypeScript-only — not suitable for teams using other languages

  • Not a great fit for public APIs that need to be consumed by third parties

  • Smaller community and ecosystem compared to REST and GraphQL (but growing fast)

So… Which One Should You Use?

There’s no universal answer here. Each of these tools has its place depending on your project needs.

Here’s how I think about it:

  • If you’re building something simple, public, or language-agnostic — REST is still a solid choice.

  • If you need to handle deeply nested data, support multiple frontend clients, or want more control from the client side — GraphQL is a powerful option.

  • If you’re building a TypeScript-heavy app and want minimal boilerplate with maximum type safety — give tRPC a shot.

Wrapping Up

The web development world isn’t short on tools, but that’s a good thing. We now have options that let us pick what works best, not just what’s most common.

You don’t have to pick a side forever either. I’ve used REST in some projects, GraphQL in others, and recently, tRPC in smaller TypeScript apps where it shines.

Use the tool that helps you move faster without sacrificing reliability or clarity.

Curious to hear what you’re using — REST, GraphQL, or tRPC? Feel free to share your experience in the comments.


Thanks for reading!

If you found this helpful, feel free to check out more of my work or connect with me:

I write about web development, DSA, and tech in general — always with the goal of making things simpler to understand.

See you around!

0
Subscribe to my newsletter

Read articles from Sujay P V directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sujay P V
Sujay P V