DEV Community

Discussion on: To GraphQL or not to GraphQL? Pros and Cons

Collapse
pjotre86 profile image
pjotre86 • Edited on

Awesome introduction and comparison, thanks alot!
I've been creating plenty of REST APIs and can totally feel the pain points you mentioned!
Am I correct when I say that your suggesting that GraphQL is a better fit for monolithic backends than for a (micro)-service architecture?
Or is there something which can present a multitude of services with their own (REST)APIs as a single GraphQL API?

Collapse
ivomeissner profile image
Ivo Meißner Author

GraphQL works great with a microservice architecture as well. In the end, GraphQL is just the API layer. It works great as kind of a thin API gateway that is responsible for routing the requests to the corresponding backend services.

Here's a 30 minute video of Steven Luscher showing how to do that: youtube.com/watch?v=UBGzsb2UkeY

Facebook is obviously not a monolith and that is what GraphQL was initially invented for.

I would just make sure to batch as much as possible and put those limits in place as mentioned in the article so you don't overwhelm your micro services.