TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: As a dev, do you like GraphQL or REST API? Why?

6 pointsby coderideralmost 2 years ago

3 comments

ttfkamalmost 2 years ago
As a frontend developer, GraphQL is substantially better: fewer calls, hierarchy preserved, and no excess data over the wire.<p>As a backend developer, REST is substantially simpler to implement: HTTP endpoint is dead simple and the caching models are 30 years old (aka very well-defined).<p>The answer is definitely going to be skewed by what kind of developer you ask.<p>For backend, writing a GraphQL server by hand (schema, types, and resolvers) is a PITA. If you have a generator like Postgraphile or Hasura, it&#x27;s almost a no-brainer how easy it is. REST by comparison is almost always dead simple to reason about no matter the tooling, and literally everyone already knows how it works.<p>As a frontend developer, I have never said to myself, &quot;Gee! I&#x27;m sure glad I have to call these five separate REST endpoints with a bunch of extra data I&#x27;ll never use just to render this one web page.&quot; I have split GraphQL calls into separate requests, but only for performance optimization in specific cases.<p>REST gives backend more power. GraphQL gives frontend more power. If you&#x27;re like most shops, backend doesn&#x27;t fully trust frontend and are kind of lazy in an anal retentive kind of way. If you&#x27;re like Netflix, you&#x27;ve got so many different clients that supporting all variations of REST was simply unmaintainable, so GraphQL really was their only sane path forward.<p>Then of course there&#x27;s gRPC, but I still consider that a serialization optimization rather than a real paradigm difference.
joshstrangealmost 2 years ago
In my experience GraphQL doesn’t scale great and it is incompatible with frontend state stores (like Vuex&#x2F;Pinia) due to every component needing a different subset of data. Maybe you can write a layer that uses data from the store and progressively loads what’s needed but that sounds like a huge pain and frontend code that needs to be able to handle the absence of data until specific properties load.<p>Places where I’ve used GraphQL feel like we are just playing around and spend more time trying to get basics things to work with a ton of boilerplate vs actually building. Maybe that’s just my experience but yeah.
anandnairalmost 2 years ago
I&#x27;d say, development is much faster using GraphQL than REST.