Why GraphQL could be the best solution for your next web application

Dennis Eichardt
Axel Springer Tech
Published in
3 min readMar 6, 2019

Until late 2018, GraphQL was just another new technical term buzzing around the web for me. That is until I became involved in some awesome new project most likely implementing GraphQL in the future.

Photo by Joshua Sortino on Unsplash

So what is all the buzz about then? Are we just chasing another buzzword, another hyped up and potentially already dying language? In order to grasp what GraphQL is and what it could be useful for I think it’s best to compare it to a plain, old-fashioned relational database system like MySQL.

  • GraphQL keeps easy things simple, it focuses more on representing connections between everyday objects rather than technical data. Remember good old SQL databases or other similar technologies? Primary keys, foreign keys, relationship tables? You can forget about all of them! If you like, GraphQL still allows you to use all the previously mentioned data sources under the hood with no impact on the interface layer, your end user won’t have to struggle with any of these old pain points ever again.
  • GraphQL delivers only the data you need and only that. To contrast, imagine a classical SELECT-Query on a SQL database. Maybe you only wanted to query the name field of a specific book but instead the query returns plenty of other fields because most of the time you query fields in a bunch. In GraphQL you define the fields you need in your specific query. You only want to know the author(s) of a book in that particular query? There you go. You only get the author(s) of a book.
  • GraphQL syntax treats you as a developer or any interested learner fair. The GraphQL query language is easy to use. Let’s assume I would like to request all SPRING employees:
employees {
name
age
department
}

But these departments also have their own names and floor numbers too, right? What if I also want to know what they are? Easy:

employees {
name
age
department {
name
floor
}
}
  • Tools like GraphQL Voyager allow you to traverse your GraphQL data like a star ship captain traverses the stars, it makes understanding GraphQL much easier.
  • Get some REST. Or don’t. You can easily replace old, complicated REST interfaces with GraphQL and live a happier life from then on. Personally, I would say this is one of the if not the best thing GraphQL could bring to your life! As well as having all the advantages I mentioned earlier, ditching REST in favor of GraphQL also means that you don’t have to worry about PUT, GET, DELETE or any of their accomplices anymore. You also won’t have to think about classic REST URLs anymore too, yuck!
  • GraphQL is an additional layer between your technology stack and your end user. In the past a commonly seen bad practice has often been to wire up technologies directly to some front- or backend. If you modularly build up your graph, it doesn’t matter which kind of system runs on the backend of your system. You decide.

“Dude, now I’m interested. Where can I find more resources?” — no panic, I’ve got you covered:

I hope I was able to give you a little insight on how GraphQL may be of service to you, your team and your project. Under the hood your project can be brimming with data sources if you so wish but on the outside your project is displaying a clean easy to use visual representation of your data.

I would like to take this opportunity to personally thank my colleagues Edgar and Benedict for enabling us to learn the skillset needed to use GraphQL at our jobs. Furthermore, I’d like to thank Nina and Adrian, since this is my very first Medium article, I also greatly appreciate your helpful input!

--

--

Dennis Eichardt
Axel Springer Tech

From Hamburg, Germany. Technology has to serve the people but for that, technology has to become a part of people. Articial intelligence, VR, robotics.